bindings.lua (13259B)
1 -- bindings.lua — shortcuts/bindings.lua from the vault, adapted for NixOS: 2 -- * /home/daemon-sec/.local/bin became o.bin (the user is daemonsec here); 3 -- * Omarchy-only commands (Omamail, the lock-screen explorer) show what they 4 -- did instead of failing silently; tools not in the carried bin/ 5 -- (clipboard-backup, omarchy-menu-tmux-keybindings) run when present; 6 -- * the stock Obsidian and YouTube binds on SUPER+SHIFT+O / Y are unbound 7 -- before vault-open and bakx take those keys (on Omarchy both fired); 8 -- * `require("hypr.caelestia")` moved to hyprland.lua, which loads 9 -- caelestia.lua after this file. 10 -- Everything else, comments included, is as carried. 11 12 -- Keep only your personal keybinding overrides here. Add new bindings or 13 -- unbind defaults before replacing them. 14 15 -- Omamail (replaces the default Email webapp binding) 16 hl.unbind("SUPER + SHIFT + E") 17 o.bind("SUPER + SHIFT + E", "Omamail", "omarchy-not-ported Omamail 'Omarchy mail webapp'") 18 19 -- Lock Screen Explorer (io.github.sirjul1337.lock-explorer) 20 o.bind("SUPER + SHIFT + L", "Lock screen explorer", "omarchy-not-ported 'Lock screen explorer' 'omarchy-shell lock explore'") 21 22 -- Trackpad on/off at the firmware level (the pad's corner touch-button is 23 -- inert on Linux — see ~/trackpad-fix/README.md). LED lights when disabled. 24 o.bind("SUPER + SHIFT + T", "Trackpad toggle", o.bin .. "/padx toggle --notify") 25 26 -- ── Move floating windows with Super+Shift+arrows ──────────────────────────── 27 -- By default Super+Shift+arrows only *swap* tiled windows (a no-op on a 28 -- floating window). This keeps the tiled-swap behaviour, but when the focused 29 -- window is floating it nudges the window in that direction instead. Runs the 30 -- branch at keypress time as a Lua function dispatcher (same mechanism Omarchy 31 -- uses for its universal clipboard keys). 32 local move_step = 60 -- pixels per nudge for floating windows 33 34 local function move_or_swap(direction, dx, dy) 35 return function() 36 local win = hl.get_active_window() 37 if win and win.floating then 38 hl.dispatch(hl.dsp.window.move({ x = dx, y = dy, relative = true })) 39 else 40 hl.dispatch(hl.dsp.window.swap({ direction = direction })) 41 end 42 end 43 end 44 45 hl.unbind("SUPER + SHIFT + LEFT") 46 hl.unbind("SUPER + SHIFT + RIGHT") 47 hl.unbind("SUPER + SHIFT + UP") 48 hl.unbind("SUPER + SHIFT + DOWN") 49 50 o.bind("SUPER + SHIFT + LEFT", "Move/swap window left", move_or_swap("l", -move_step, 0)) 51 o.bind("SUPER + SHIFT + RIGHT", "Move/swap window right", move_or_swap("r", move_step, 0)) 52 o.bind("SUPER + SHIFT + UP", "Move/swap window up", move_or_swap("u", 0, -move_step)) 53 o.bind("SUPER + SHIFT + DOWN", "Move/swap window down", move_or_swap("d", 0, move_step)) 54 55 56 -- ── Terminal cheat sheets (Kitty & Tmux) ───────────────────────────────────── 57 -- SUPER+ALT+K opens the Kitty cheat sheet (K for Kitty). 58 -- Tmux keybindings moved to SUPER+ALT+T (T for Tmux). 59 hl.unbind("SUPER + ALT + K") 60 o.bind("SUPER + ALT + K", "Kitty cheat sheet", "omarchy-menu-kitty") 61 o.bind("SUPER + ALT + T", "Tmux keybindings", o.cmd_or_gone("omarchy-menu-tmux-keybindings", "Tmux keybindings", "the script is not in the carried bin/")) 62 63 64 -- ── RK Royal Kludge R65 keyboard cheat sheet ───────────────────────────────── 65 -- Same Quickshell popup as the rest of the K family: every Fn combo, the volume 66 -- knob and the B/G mode switch of the R65 (66-key 65%, BT/2.4G/wired, mono/RGB). 67 -- Pure reference; Enter copies the highlighted combo to the clipboard. 68 -- On SUPER+CTRL+ALT+K to stay clear of the K family's taken slots 69 -- (K=keys, ALT+K, CTRL+K, SHIFT+K); this 3-modifier combo was free, so no 70 -- unbind is needed and existing K-family cheats are left untouched. 71 o.bind("SUPER + CTRL + ALT + K", "RK R65 keyboard (cheat sheet)", "omarchy-menu-r65") 72 73 -- ── Editor cheat sheets ───────────────────────────────────────────────── 74 -- Mnemonic editor initials on two unused default/user combinations. These use 75 -- the same searchable Omarchy menu as the K-family sheets; Enter copies the 76 -- highlighted shortcut to the clipboard. 77 o.bind("SUPER + ALT + E", "Emacs cheat sheet", "omarchy-menu-emacs") 78 o.bind("SUPER + ALT + N", "Neovim / AstroNvim cheat sheet", "omarchy-menu-nvim") 79 80 -- ── mpv cheat sheet ────────────────────────────────────────────────────────── 81 -- Same searchable popup as the rest of the family: every DEFAULT mpv key 82 -- binding (there is no ~/.config/mpv/input.conf on this box, so nothing is 83 -- overridden). Enter copies the highlighted key to the clipboard. 84 -- SUPER+ALT+M keeps the mnemonic-initial pattern of ALT+E / ALT+N and was free: 85 -- SUPER+M is Window mode, SUPER+SHIFT+M is Music and SUPER+SHIFT+ALT+M is the 86 -- music TUI, so no unbind is needed. 87 -- Terminal twin of the same card: `mpv-cheat` (sectioned, in colour). 88 o.bind("SUPER + ALT + M", "mpv cheat sheet", "omarchy-menu-mpv") 89 90 -- ── zathura cheat sheet ────────────────────────────────────────────────────── 91 -- Same searchable popup as the rest of the family: every DEFAULT zathura key 92 -- (the zathurarc here sets no `map` lines), the : commands, the settings worth 93 -- flipping mid-document, and the zimg / zbook wrappers that cover the formats 94 -- this poppler build cannot open. Enter copies the highlighted key. 95 -- SUPER+ALT+Z keeps the mnemonic-initial pattern of ALT+E / ALT+N / ALT+M and 96 -- was free: only SUPER+CTRL+Z and SUPER+CTRL+ALT+Z (Reset zoom) use Z, so no 97 -- unbind is needed. 98 o.bind("SUPER + ALT + Z", "Zathura cheat sheet", "omarchy-menu-zathura") 99 100 -- ── NetrunnerVault + dotfiles ─────────────────────────────────────────────── 101 -- SUPER+SHIFT+O opens the vault in Obsidian (focuses it if already open). 102 -- SUPER+SHIFT+Y banks BOTH repos up with `bakx`: ports live config into 103 -- daemon-sec-dotfiles, commits each delta long-hand (every added/modified/ 104 -- removed path in the message), and pushes. Fast-forward only — a real 105 -- divergence stops and tells you, never an auto-merge. 106 -- 107 -- These replaced the daemon-sec.vault / daemon-sec.dotfiles bar plugins 108 -- (retired 2026-09-09): backing up is a manual act now, not a daily timer. 109 -- A keybind run is headless, so bakx reports through notify-send; run it in a 110 -- terminal for the full breakdown, or `bakx status` to just look. 111 local BIN = o.bin 112 hl.unbind("SUPER + SHIFT + O") -- stock Obsidian bind 113 hl.unbind("SUPER + SHIFT + Y") -- stock YouTube bind 114 o.bind("SUPER + SHIFT + O", "Open NetrunnerVault (Obsidian)", BIN .. "/vault-open") 115 o.bind("SUPER + SHIFT + Y", "Bank up vault + dotfiles (bakx)", BIN .. "/bakx") 116 117 -- SUPER+SHIFT+V backs up clipboard history + saved images: tar + xz + gpg 118 -- to the vault (see clipboard-backup). SUPER+V (Universal paste) and 119 -- SUPER+CTRL+V (Clipboard manager, opens History) are stock Omarchy binds 120 -- and were left untouched. 121 o.bind("SUPER + SHIFT + V", "Backup clipboard history (encrypted)", o.cmd_or_gone(BIN .. "/clipboard-backup", "Backup clipboard history (encrypted)", "clipboard-backup is not in the carried bin/")) 122 123 -- ── Window Mode: a modal for moving/resizing/snapping windows ──────────────── 124 -- SUPER+M enters a submap where bare keys manage the focused window, so you can 125 -- rapid-fire moves and snaps without holding modifiers. Reuses move_or_swap 126 -- (above) so movement works on tiled *and* floating windows. Floating snaps go 127 -- through ~/.local/bin/winsnap (Hyprland only auto-tiles; floating has no snap). 128 -- Escape / Return / q / SUPER+M all exit. If ever stuck: 129 -- hyprctl dispatch 'hl.dsp.submap("reset")' 130 local WINSNAP = BIN .. "/winsnap" 131 local rstep = 40 -- px per resize tick in window mode 132 133 local function resize_by(dx, dy) 134 return hl.dsp.window.resize({ x = dx, y = dy, relative = true }) 135 end 136 137 o.bind("SUPER + M", "Window mode: hjkl move · S+hjkl halves · 1-4 quarters · C+hjkl resize · f fill · c center · t float · g group · Esc exit", function() 138 hl.dispatch(hl.dsp.submap("window")) 139 hl.dispatch(hl.dsp.exec_cmd( 140 "notify-send -t 2500 -a 'Window mode' 'Window mode' " 141 .. "'hjkl move · Ctrl+hjkl resize · Shift+hjkl halves\\n1-4 quarters · f full · c center · t float · g group · Esc exit'")) 142 end) 143 144 hl.define_submap("window", function() 145 -- Move / swap (works on floating and tiled), auto-repeat while held. 146 hl.bind("h", move_or_swap("l", -move_step, 0), { repeating = true }) 147 hl.bind("j", move_or_swap("d", 0, move_step), { repeating = true }) 148 hl.bind("k", move_or_swap("u", 0, -move_step), { repeating = true }) 149 hl.bind("l", move_or_swap("r", move_step, 0), { repeating = true }) 150 hl.bind("left", move_or_swap("l", -move_step, 0), { repeating = true }) 151 hl.bind("down", move_or_swap("d", 0, move_step), { repeating = true }) 152 hl.bind("up", move_or_swap("u", 0, -move_step), { repeating = true }) 153 hl.bind("right", move_or_swap("r", move_step, 0), { repeating = true }) 154 155 -- Resize: Ctrl + hjkl (h/l = width, k/j = height). 156 hl.bind("CTRL + h", resize_by(-rstep, 0), { repeating = true }) 157 hl.bind("CTRL + l", resize_by(rstep, 0), { repeating = true }) 158 hl.bind("CTRL + k", resize_by(0, -rstep), { repeating = true }) 159 hl.bind("CTRL + j", resize_by(0, rstep), { repeating = true }) 160 161 -- Floating snap: Shift + hjkl = left/bottom/top/right half. 162 hl.bind("SHIFT + h", hl.dsp.exec_cmd(WINSNAP .. " left")) 163 hl.bind("SHIFT + j", hl.dsp.exec_cmd(WINSNAP .. " bottom")) 164 hl.bind("SHIFT + k", hl.dsp.exec_cmd(WINSNAP .. " top")) 165 hl.bind("SHIFT + l", hl.dsp.exec_cmd(WINSNAP .. " right")) 166 167 -- Quarters + fill + recenter. 168 hl.bind("1", hl.dsp.exec_cmd(WINSNAP .. " tl")) 169 hl.bind("2", hl.dsp.exec_cmd(WINSNAP .. " tr")) 170 hl.bind("3", hl.dsp.exec_cmd(WINSNAP .. " bl")) 171 hl.bind("4", hl.dsp.exec_cmd(WINSNAP .. " br")) 172 hl.bind("f", hl.dsp.exec_cmd(WINSNAP .. " full")) 173 hl.bind("c", hl.dsp.exec_cmd(WINSNAP .. " center")) 174 175 -- Toggles that fit the same modal. 176 hl.bind("t", hl.dsp.window.float({ action = "toggle" })) 177 hl.bind("g", hl.dsp.group.toggle()) 178 hl.bind("v", hl.dsp.layout("togglesplit")) 179 180 -- Exits. 181 hl.bind("escape", hl.dsp.submap("reset")) 182 hl.bind("return", hl.dsp.submap("reset")) 183 hl.bind("q", hl.dsp.submap("reset")) 184 hl.bind("SUPER + M", hl.dsp.submap("reset")) 185 end) 186 187 -- ── Yazi file manager ──────────────────────────────────────────────────────── 188 -- TUI file manager in a kitty window. SUPER+ALT+Y was free by default. 189 -- (yazi is not in the toolbox closure; add it to home/modules/tools.nix to use this.) 190 o.bind("SUPER + ALT + Y", "Yazi (file manager)", { launch = "kitty --class yazi -e yazi" }) 191 192 -- SUPER+W remains Omarchy's default close shortcut. SUPER+Q is a convenient 193 -- alias: a swallowed MPV window closes independently, revealing Yazi beneath. 194 o.bind("SUPER + Q", "Close window", hl.dsp.window.close()) 195 196 -- ── Dropdown terminal (quake style) ────────────────────────────────────────── 197 -- SUPER+` slides a kitty down from the top edge on special:dropterm, riding the 198 -- springy slidevert animation from looknfeel.lua. ~/.local/bin/dropterm spawns 199 -- it on first use and toggles it afterwards; a 4-finger swipe down does the 200 -- same (gesture in looknfeel.lua). SUPER+` was free by default. 201 o.window("^dropterm$", { 202 workspace = "special:dropterm", 203 float = true, 204 -- size/move take muParser expression strings ("x y"), with monitor_w/h and 205 -- window_w/h as variables (percent syntax is the deprecated hyprlang form). 206 size = "monitor_w*0.94 monitor_h*0.58", 207 move = "monitor_w*0.03 monitor_h*0.04", 208 }) 209 o.bind("SUPER + GRAVE", "Dropdown terminal", BIN .. "/dropterm") 210 hl.gesture({ fingers = 4, direction = "down", action = "special", workspace_name = "dropterm" }) 211 212 -- ── AstroNvim ──────────────────────────────────────────────────────────────── 213 -- Opens the editor straight to its dashboard in a kitty window of its own. 214 -- SUPER+SHIFT+N ("Editor") already reaches Neovim via omarchy-launch-editor, 215 -- but that follows ~/.local/state/omarchy/defaults/editor and gives the window 216 -- a generic app-id. This is a direct, dedicated launcher with its own class, so 217 -- window rules can target it and it keeps the SUPER+ALT+<initial> pattern of 218 -- ALT+Y (yazi). SUPER+ALT+A was free by default, so no unbind is needed. 219 -- (neovim is not in the toolbox closure; add it to home/modules/tools.nix to use this.) 220 o.bind("SUPER + ALT + A", "AstroNvim", { launch = "kitty --class astronvim -e nvim" })