-
-
Notifications
You must be signed in to change notification settings - Fork 175
Keybindings
YASB supports global keyboard shortcuts (hotkeys) to trigger widget actions. Keybindings are configured per-widget in the widget's options section. This feature uses the native Windows RegisterHotKey API and requires no third-party dependencies.
-
Per-widget instance: Keybindings are tied to the specific widget name in your config (e.g.,
clockvsclock_2) - Multiple keybindings: A single widget can have multiple keybindings for different actions
- Screen-aware: Hotkeys trigger the widget on the currently focused screen
- Zero overhead: If no keybindings are defined, no hotkey listener is started
-
No auto-repeat: Holding a hotkey fires only once (uses
MOD_NOREPEAT)
Add a keybindings list to any widget's options. Each keybinding requires:
-
keys: The key combination (e.g.,"win+c","ctrl+shift+f1") -
action: The callback action to trigger (e.g.,"toggle_calendar","toggle_label") -
screen(optional):"active","cursor", or"primary"to specify which screen to target if multiple are present (defaults to"active"— the focused window's screen)
clock:
type: "yasb.clock.ClockWidget"
options:
label: "{%H:%M}"
keybindings:
- keys: "win+c"
action: "toggle_calendar"
- keys: "ctrl+shift+t"
action: "toggle_label"clock:
type: "yasb.clock.ClockWidget"
options:
keybindings:
- keys: "win+c"
action: "toggle_calendar"
screen: "cursor"
volume:
type: "yasb.volume.VolumeWidget"
options:
keybindings:
- keys: "win+v"
action: "toggle_menu"| Key Name | Description |
|---|---|
win, windows, super, meta
|
Windows key |
alt |
Alt key |
ctrl, control
|
Control key |
shift |
Shift key |
Note:
RegisterHotKeydoes not distinguish between left and right modifier keys.
| Key Name | Description |
|---|---|
f1 - f24
|
Function keys F1 through F24 |
| Key Name | Description |
|---|---|
a - z
|
Letter keys (case-insensitive) |
0 - 9
|
Number keys |
| Key Name | Aliases | Description |
|---|---|---|
space |
Spacebar | |
tab |
Tab key | |
enter, return
|
Enter/Return key | |
esc, escape
|
Escape key | |
backspace |
Backspace key | |
delete, del
|
Delete key | |
insert, ins
|
Insert key | |
home |
Home key | |
end |
End key | |
pageup, pgup
|
Page Up key | |
pagedown, pgdn
|
Page Down key | |
pause |
Pause key | |
capslock, caps
|
Caps Lock key | |
numlock |
Num Lock key | |
scrolllock |
Scroll Lock key | |
printscreen, prtsc
|
Print Screen key |
| Key Name | Description |
|---|---|
left |
Left arrow |
up |
Up arrow |
right |
Right arrow |
down |
Down arrow |
| Key Name | Description |
|---|---|
numpad0 - numpad9
|
Numpad number keys |
multiply |
Numpad * |
add |
Numpad + |
subtract |
Numpad - |
decimal |
Numpad . |
divide |
Numpad / |
| Key Name | Description |
|---|---|
semicolon |
; key |
equal, equals
|
= key |
comma |
, key |
minus |
- key |
period |
. key |
slash |
/ key |
backquote, grave
|
` key |
bracketleft |
[ key |
bracketright |
] key |
backslash |
\ key |
quote |
' key |
YASB only supports modifier + single key combinations. You cannot bind multiple non-modifier keys together:
| Configuration | Valid |
|---|---|
"alt+a" |
Yes |
"ctrl+shift+f1" |
Yes |
"a+b" |
No - two non-modifier keys |
"f13+h" |
No - two non-modifier keys |
Windows Explorer pre-registers many Win+key shortcuts (e.g., Win+S, Win+W, Win+Shift+S). RegisterHotKey cannot override these - the registration will silently fail. Use Alt, Ctrl, or Ctrl+Shift based combinations instead for reliable hotkeys.
You cannot use a modifier key alone as a hotkey:
| Configuration | Valid |
|---|---|
"ctrl" |
No - no main key |
"alt+shift" |
No - no main key |
"win+a" |
Yes |
Unlike a low-level hook, RegisterHotKey does not reject extra modifiers. If you register alt+x, pressing ctrl+alt+x will also trigger it. Keep this in mind when choosing key combinations.
Each widget has its own set of available callback actions. Common actions include:
| Action | Description |
|---|---|
toggle_label |
Toggle between primary and alternate label |
toggle_menu |
Show/hide the widget's menu |
update_label |
Force refresh the widget label |
do_nothing |
No action (useful for disabling) |
Refer to individual widget documentation for widget-specific actions. For example, the Clock widget supports:
-
toggle_calendar- Show/hide calendar popup -
toggle_label- Toggle between label formats -
next_timezone- Cycle to next timezone -
context_menu- Show context menu
When a hotkey is triggered, YASB determines which screen's widget should respond. You can control this per-keybinding with the screen option:
| Value | Behavior |
|---|---|
"active" (default) |
Targets the screen containing the currently focused window. Falls back to primary if no window is focused. |
"cursor" |
Targets the screen where the mouse cursor is currently located. |
"primary" |
Always targets the primary screen. |
This means pressing win+c will toggle the calendar on the monitor where you're currently working (by default), or you can override this to follow the mouse cursor or always use the primary screen.
If the same key combination is assigned to multiple widgets, YASB will:
- Log a warning message indicating the conflict
- Use the last defined keybinding (later widgets override earlier ones)
WARNING: Hotkey conflict: 'win+c' is already assigned to 'yasb.clock.ClockWidget',
overriding with 'yasb.volume.VolumeWidget'
If another application has already registered the same hotkey with Windows, YASB will log a warning and that hotkey will not work.
To avoid conflicts, use unique key combinations for each widget action.
- Check the logs: Enable debug logging to see if the hotkey was registered successfully
- Verify key names: Ensure you're using supported key names from the tables above
-
Check for conflicts: Another application may have registered the same combination -
RegisterHotKeyis first-come-first-served -
Reserved Windows combos:
Win+L(lock screen) andCtrl+Alt+Deletecannot be overridden
If the log shows the hotkey was registered successfully but it doesn't trigger:
- Ensure the widget has the corresponding action callback
- Check that the widget's
keybindingsconfig matches the expected action name
- Home
- Installation
- Configuration
- Keybindings
- Styling
- YASB CLI
- FAQ
- Contributing
- Writing Widget
- UI Components
- Widgets:
- Active Windows Title
- Ai Chat
- Applications
- Battery
- Bluetooth
- Brightness
- Cava
- Copilot
- CPU
- Clock
- Custom
- Github
- GlazeWM Binding Mode
- GlazeWM Tiling Direction
- GlazeWM Workspaces
- Glucose Monitor
- Grouper
- GPU
- Home
- Disk
- Language
- Launchpad
- Libre Hardware Monitor
- Media
- Memory
- Microphone
- Notifications
- Notes
- OBS
- Open Meteo
- Server Monitor
- Systray
- Todo
- Traffic
- Taskbar
- Pomodoro
- Power Menu
- Power Plan
- Quick Launch
- Recycle Bin
- Update Check
- Visual Studio Code
- Volume
- Wallpapers
- Weather
- WiFi
- WHKD
- Window Controls
- Windows Desktops
- Komorebi Control
- Komorebi Layout
- Komorebi Stack
- Komorebi Workspaces