fix(hypr): use native Lua dispatchers for exit, fullscreen, cycle, resize, and setprop
This commit is contained in:
+56
-16
@@ -93,41 +93,81 @@ hl.config({
|
||||
**Legacy:**
|
||||
```hyprlang
|
||||
bind = SUPER, Q, killactive,
|
||||
bind = SUPER SHIFT ALT, Q, exit,
|
||||
bindd = SUPER, B, Launch Browser, exec, firefox
|
||||
bind = SUPER, left, movefocus, l
|
||||
bind = SUPER, 1, workspace, 1
|
||||
bind = SUPER SHIFT, 1, movetoworkspace, 1
|
||||
bind = SUPER SHIFT, left, swapwindow, l
|
||||
bind = SUPER, mouse_down, workspace, e+1
|
||||
bindm = SUPER, mouse:272, movewindow
|
||||
bindm = SUPER, mouse:273, resizewindow
|
||||
bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+
|
||||
bind = SUPER, code:10, workspace, 1
|
||||
bind = SUPER SHIFT, S, swapwindow, l
|
||||
bind = SUPER, code:20, resizeactive, -100 0
|
||||
bind = SUPER, BACKSPACE, setprop, opaque toggle
|
||||
```
|
||||
**Lua:**
|
||||
Flags from the legacy format (`e` for repeat, `l` for locked, `m` for mouse) become booleans in the options table. Dispatchers must use the `hl.dsp.*` API. **If a dispatcher isn't listed below, fall back to `hl.dsp.exec_cmd("hyprctl dispatch <dispatcher> <args>")`**.
|
||||
Flags from the legacy format (`e` for repeat, `l` for locked, `m` for mouse) become booleans in the options table. Dispatchers must use the native `hl.dsp.*` API functions.
|
||||
```lua
|
||||
hl.bind("SUPER + Q", hl.dsp.window.close())
|
||||
-- Session & Window Lifecycle
|
||||
hl.bind("SUPER + Q", hl.dsp.window.close(), { description = "Close active window" })
|
||||
hl.bind("SUPER + SHIFT + ALT + Q", hl.dsp.exit(), { description = "Exit Hyprland" })
|
||||
|
||||
-- Applications / Commands
|
||||
hl.bind("SUPER + B", hl.dsp.exec_cmd("firefox"), { description = "Launch Browser" })
|
||||
|
||||
-- Focus & Workspaces
|
||||
hl.bind("SUPER + left", hl.dsp.focus({ direction = "left" }))
|
||||
hl.bind("SUPER + 1", hl.dsp.focus({ workspace = 1 }))
|
||||
hl.bind("SUPER + TAB", hl.dsp.focus({ workspace = "e+1" }))
|
||||
hl.bind("SUPER + mouse_down", hl.dsp.focus({ workspace = "e+1" }))
|
||||
|
||||
-- Moving Windows
|
||||
hl.bind("SUPER + SHIFT + 1", hl.dsp.window.move({ workspace = 1 }))
|
||||
hl.bind("SUPER + SHIFT + left", hl.dsp.window.swap({ direction = "left" }))
|
||||
|
||||
-- Window States
|
||||
hl.bind("SUPER + V", hl.dsp.window.float({ action = "toggle" }))
|
||||
hl.bind("SUPER + P", hl.dsp.window.pseudo())
|
||||
hl.bind("SHIFT + F11", hl.dsp.window.fullscreen({ mode = "fullscreen" }))
|
||||
hl.bind("ALT + F11", hl.dsp.window.fullscreen({ mode = "maximized" }))
|
||||
hl.bind("SUPER + BACKSPACE", hl.dsp.window.set_prop({ prop = "opaque", value = "toggle" }))
|
||||
|
||||
-- Window Cycling & Stacking
|
||||
hl.bind("ALT + TAB", hl.dsp.window.cycle_next())
|
||||
hl.bind("ALT + SHIFT + TAB", hl.dsp.window.cycle_next({ next = false }))
|
||||
hl.bind("ALT + TAB", hl.dsp.window.bring_to_top())
|
||||
|
||||
-- Resizing & Dragging
|
||||
hl.bind("SUPER + code:20", hl.dsp.window.resize({ x = -100, y = 0, relative = true }))
|
||||
hl.bind("SUPER + mouse:272", hl.dsp.window.drag(), { mouse = true })
|
||||
hl.bind("SUPER + mouse:273", hl.dsp.window.resize(), { mouse = true })
|
||||
|
||||
-- Repeating & Locked (e.g. Media Keys)
|
||||
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"), { repeating = true, locked = true })
|
||||
|
||||
-- Keycodes use the `code:` prefix directly in the string
|
||||
hl.bind("SUPER + code:10", hl.dsp.focus({ workspace = 1 }))
|
||||
|
||||
-- Fallback for undocumented or complex dispatchers
|
||||
hl.bind("SUPER + SHIFT + S", hl.dsp.exec_cmd("hyprctl dispatch swapwindow l"))
|
||||
```
|
||||
*Note: Key combinations are joined by ` + `.*
|
||||
*Common Dispatchers translation:*
|
||||
|
||||
#### Complete Dispatcher Reference:
|
||||
- `exit` -> `hl.dsp.exit()`
|
||||
- `killactive` -> `hl.dsp.window.close()`
|
||||
- `togglefloating` -> `hl.dsp.window.float({ action = "toggle" })`
|
||||
- `fullscreen, 0` -> `hl.dsp.window.fullscreen(0)`
|
||||
- `togglesplit` -> `hl.dsp.layout("togglesplit")`
|
||||
- `movefocus, l` -> `hl.dsp.focus({ direction = "left" })`
|
||||
- `workspace, 1` -> `hl.dsp.focus({ workspace = 1 })`
|
||||
- `movetoworkspace, 1` -> `hl.dsp.window.move({ workspace = 1 })`
|
||||
- `cyclenext` -> `hl.dsp.exec_cmd("hyprctl dispatch cyclenext")`
|
||||
- `pseudo` -> `hl.dsp.window.pseudo()`
|
||||
- `fullscreen, 0` -> `hl.dsp.window.fullscreen({ mode = "fullscreen" })`
|
||||
- `fullscreen, 1` -> `hl.dsp.window.fullscreen({ mode = "maximized" })`
|
||||
- `togglesplit` / `layoutmsg, <cmd>` -> `hl.dsp.layout("<cmd>")`
|
||||
- `movefocus, <l|r|u|d>` -> `hl.dsp.focus({ direction = "left" | "right" | "up" | "down" })`
|
||||
- `workspace, <ws>` -> `hl.dsp.focus({ workspace = <number or string like "e+1"> })`
|
||||
- `movetoworkspace, <ws>` -> `hl.dsp.window.move({ workspace = <number or string> })`
|
||||
- `swapwindow, <l|r|u|d>` -> `hl.dsp.window.swap({ direction = "left" | "right" | "up" | "down" })`
|
||||
- `cyclenext` -> `hl.dsp.window.cycle_next()`
|
||||
- `cyclenext, prev` -> `hl.dsp.window.cycle_next({ next = false })`
|
||||
- `bringactivetotop` -> `hl.dsp.window.bring_to_top()`
|
||||
- `resizeactive, <x> <y>` -> `hl.dsp.window.resize({ x = <x>, y = <y>, relative = true })`
|
||||
- `setprop, <prop> <val>` -> `hl.dsp.window.set_prop({ prop = "<prop>", value = "<val>" })`
|
||||
- `togglespecialworkspace, <name>` -> `hl.dsp.workspace.toggle_special("<name>")`
|
||||
- `exec, <command>` -> `hl.dsp.exec_cmd("<command>")`
|
||||
|
||||
### 6. Window and Layer Rules
|
||||
**Legacy:**
|
||||
|
||||
Reference in New Issue
Block a user