Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2a615d8

Browse files
committed
feat(whkd): add special_keys option for customizable hotkeys
- Introduced a new `special_keys` list option to allow users to define custom hotkeys.- Each entry in the list includes a `key` and a `key_replace` for flexible key mapping.- Updated documentation to reflect the new option and provide examples.- Added a preview image for better visualization of the widget.
1 parent8112d4e commit2a615d8

File tree

4 files changed

+441
-280
lines changed

4 files changed

+441
-280
lines changed

‎docs/widgets/(Widget)-Whkd.md

Lines changed: 119 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,141 @@ Whkd is a simple hotkey daemon for Windows that reacts to input events by execut
55
| Option| Type| Default| Description|
66
|------------------|----------|--------------------------------|-----------------------------------------------------------------------------|
77
|`label`| string|`"\uf11c"`| The string for the label button.|
8+
|`special_keys`| list|`None`| A list of special keys to be used as hotkeys.|
89
|`container_padding`| dict|`{'top': 0, 'left': 0, 'bottom': 0, 'right': 0}`| Explicitly set padding inside widget container.|
910
|`animation`| dict|`{'enabled': True, 'type': 'fadeInOut', 'duration': 200}`| Animation settings for the widget.|
1011

1112

1213
##Example Configuration
1314

1415
```yaml
15-
whkd:
16-
type:"yasb.whkd.WhkdWidget"
17-
options:
18-
label:"<span>\uf11c</span>"
16+
whkd:
17+
type:"yasb.whkd.WhkdWidget"
18+
options:
19+
label:"<span>\uf11c</span>"
20+
special_keys:
21+
-key:"win"
22+
key_replace:"\ue70f"
23+
-key:"ctrl"
24+
key_replace:"Ctrl"
25+
-key:"alt"
26+
key_replace:"Alt"
27+
-key:"shift"
28+
key_replace:"Shift"
29+
-key:"left"
30+
key_replace:"\u2190"
31+
-key:"right"
32+
key_replace:"\u2192"
33+
-key:"up"
34+
key_replace:"\u2191"
35+
-key:"down"
36+
key_replace:"\u2193"
1937
```
2038
## Description of Options
2139
2240
- **label:** The string for the label button.
41+
- **special_keys:** A list of special keys to be used as hotkeys. The list contains dictionaries with two keys:`key` and `key_replace`. The `key` is the special key to be used as a hotkey and the `key_replace` is the string to replace the special key with.
42+
- **key:** The special key to be used as a hotkey.
43+
- **key_replace:** The string to replace the special key with.
2344
- **container_padding:** Explicitly set padding inside widget container.
2445
- **animation:** A dictionary specifying the animation settings for the widget. It contains three keys: `enabled`, `type`, and `duration`. The `type` can be `fadeInOut` and the `duration` is the animation duration in milliseconds.
2546

26-
## Example Style
47+
> [!NOTE]
48+
> The special keys are keys which you can style and replace with custom icons. Special keys settings are optional. If you don't want to use special keys, you can leave the `special_keys` option empty.
49+
50+
> [!NOTE]
51+
> To use header like on screenshot below, you need to edit whkdrc and comment string with double hash `##`. Example `## Open Applications`
52+
## Style
2753
```css
2854
.whkd-widget {}
2955
.whkd-widget .windget-container {}
3056
.whkd-widget .label {}
3157
.whkd-widget .icon {}
32-
```
58+
.whkd-popup {}
59+
.whkd-popup .edit-config-button {}
60+
.whkd-popup .keybind-buttons-container {}
61+
.whkd-popup .keybind-button {}
62+
.whkd-popup .keybind-button.special {}
63+
.whkd-popup .keybind-row{}
64+
.whkd-popup .plus-separator {}
65+
.whkd-popup .filter-input {}
66+
.whkd-popup .keybind-command {}
67+
.whkd-popup .keybind-header {}
68+
```
69+
70+
## Example Styling
71+
```css
72+
.whkd-widget {
73+
padding: 0 6px 0 6px;
74+
}
75+
.whkd-widget .icon {
76+
font-size: 18px;
77+
}
78+
.whkd-popup .edit-config-button {
79+
background-color:#1743a1;
80+
color: #ffffff;
81+
padding: 4px 8px 6px 8px;
82+
font-size: 14px;
83+
font-weight: 600;
84+
border-radius: 4px;
85+
font-family: 'Segoe UI', sans-serif;
86+
}
87+
88+
.whkd-popup .keybind-buttons-container {
89+
min-width: 240px;
90+
}
91+
.whkd-popup .keybind-button {
92+
background-color: #343538;
93+
color: white;
94+
padding: 4px 8px 6px 8px;
95+
font-size: 14px;
96+
font-weight: 600;
97+
border: 1px inset #4f5055;
98+
border-bottom: 2px inset #4f5055;
99+
border-radius: 4px;
100+
font-family: 'JetBrainsMono NFP';
101+
}
102+
.whkd-popup .keybind-button.special {
103+
background-color: #343538;
104+
}
105+
.whkd-popup .keybind-row:hover{
106+
background-color: rgba(136, 138, 155, 0.2);
107+
border-radius: 8px;
108+
}
109+
.whkd-popup .plus-separator {
110+
padding: 0 0px;
111+
border:none;
112+
font-size: 16px;
113+
font-weight: bold;
114+
background-color:transparent
115+
}
116+
.whkd-popup .filter-input {
117+
padding: 0 8px 2px 8px;
118+
font-size: 14px;
119+
font-family: 'Segoe UI', sans-serif;
120+
border: 1px solid #2e2e2e;
121+
border-radius: 4px;
122+
outline: none;
123+
color: white;
124+
background-color: #2e2e2e;
125+
min-height: 32px;
126+
}
127+
.whkd-popup .filter-input:focus {
128+
border: 1px solid #0078D4;
129+
}
130+
.whkd-popup .keybind-command {
131+
font-size: 14px;
132+
}
133+
.whkd-popup .keybind-header {
134+
font-size: 16px;
135+
font-weight: 600;
136+
color: white;
137+
padding: 8px 0;
138+
margin-top: 20px;
139+
background-color: rgba(255, 255, 255, 0.05);
140+
border: 1px solid rgba(255, 255, 255, 0.1);
141+
border-radius: 8px;
142+
}
143+
```
144+
## Preview of the weather card
145+
![YASB WHKD Widget](assets/765432109-1a2b3c4d-5e6f-78ab-9012-3456789abcd.png)

‎src/core/validation/widgets/yasb/whkd.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,17 @@
3030
}
3131
},
3232
'default':DEFAULTS['animation']
33-
},
33+
},
34+
'special_keys': {
35+
'type':'list',
36+
'schema': {
37+
'type':'dict',
38+
'schema': {
39+
'key': {'type':'string'},
40+
'key_replace': {'type':'string'}
41+
}
42+
}
43+
},
3444
'container_padding': {
3545
'type':'dict',
3646
'required':False,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp