Add o.rebind for replacing Hyprland keybindings

This commit is contained in:
Ryan Hughes committed 2026-09-06 16:01:50 -04:00
1 parent a9eaf7978e
commit 1d466c4003
6 files changed
+40 -16

No files matched your search

+1 -1
View File
@@ -278,7 +278,7 @@ This skill intentionally does not cover Omarchy source development. Do not use t
## Example Requests
- "Change my theme to catppuccin" -> `omarchy theme set catppuccin`
- "Add a keybinding for Super+E to open file manager" -> Check existing bindings first, call `hl.unbind` if needed, then `o.bind` in `~/.config/hypr/bindings.lua`
- "Add a keybinding for Super+E to open file manager" -> Check existing bindings first, then use `o.rebind` to replace one or `o.bind` to add one in `~/.config/hypr/bindings.lua`
- "Configure my external monitor" -> Edit `~/.config/hypr/monitors.lua`
- "Make the window gaps smaller" -> Edit `~/.config/hypr/looknfeel.lua`
- "Turn on night light" -> `omarchy toggle nightlight` (for time-based schedules, edit `~/.config/hypr/hyprsunset.conf` profiles, then `omarchy restart hyprsunset`)
+4 -6
View File
@@ -43,18 +43,16 @@ View current bindings: `omarchy menu keybindings --print`
**IMPORTANT: When re-binding an existing key:**
1. First check existing bindings: `omarchy menu keybindings --print`
2. If the key is already bound, you MUST call `hl.unbind(...)` BEFORE the new `o.bind(...)`
2. If the key is already bound, use `o.rebind(...)` to remove the existing binding and add its replacement. It takes the same arguments as `o.bind(...)`.
3. Inform the user what the key was previously bound to
Example - rebinding SUPER+F (which is bound to fullscreen by default):
```lua
-- Unbind existing SUPER+F (was: fullscreen)
hl.unbind("SUPER + F")
-- New binding for file manager
o.bind("SUPER + F", "File manager", { launch = "nautilus" })
-- Replace SUPER+F (was: fullscreen) with the file manager.
o.rebind("SUPER + F", "File manager", { launch = "nautilus" })
```
Always tell the user: "Note: SUPER+F was previously bound to fullscreen. I've added an unbind to override it."
Tell the user which action was replaced. Use `hl.unbind(...)` to remove a binding without replacing it.
## Display/Monitors
+5
View File
@@ -105,6 +105,11 @@ function o.bind(keys, description, dispatcher, options)
hl.bind(keys, dispatcher, opts)
end
function o.rebind(keys, description, dispatcher, options)
hl.unbind(keys)
o.bind(keys, description, dispatcher, options)
end
function o.launch(command)
return "uwsm-app -- " .. command
end