repositories

NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor

clonegit clone https://git.daemon-sec.xyz/NixDaemon.git
bindings.luaLua212 lines12.5 KiBraw download
-- bindings.lua — shortcuts/bindings.lua from the vault, adapted for NixOS:
--   * /home/daemon-sec/.local/bin became o.bin (the user is daemonsec here);
--   * Omarchy-only commands (Omamail, the lock-screen explorer) show what they
--     did instead of failing silently; tools not in the carried bin/
--     (clipboard-backup, omarchy-menu-tmux-keybindings) run when present;
--   * the stock Obsidian and YouTube binds on SUPER+SHIFT+O / Y are unbound
--     before vault-open and bakx take those keys (on Omarchy both fired);
--   * `require("hypr.caelestia")` moved to hyprland.lua, which loads
--     caelestia.lua after this file.
-- Everything else, comments included, is as carried.

-- Keep only your personal keybinding overrides here. Add new bindings or
-- unbind defaults before replacing them.

-- Omamail (replaces the default Email webapp binding)
hl.unbind("SUPER + SHIFT + E")
o.bind("SUPER + SHIFT + E", "Omamail", "omarchy-not-ported Omamail 'Omarchy mail webapp'")

-- Lock Screen Explorer (io.github.sirjul1337.lock-explorer)
o.bind("SUPER + SHIFT + L", "Lock screen explorer", "omarchy-not-ported 'Lock screen explorer' 'omarchy-shell lock explore'")

-- Trackpad on/off at the firmware level (the pad's corner touch-button is
-- inert on Linux — see ~/trackpad-fix/README.md). LED lights when disabled.
o.bind("SUPER + SHIFT + T", "Trackpad toggle", o.bin .. "/padx toggle --notify")

-- ── Move floating windows with Super+Shift+arrows ────────────────────────────
-- By default Super+Shift+arrows only *swap* tiled windows (a no-op on a
-- floating window). This keeps the tiled-swap behaviour, but when the focused
-- window is floating it nudges the window in that direction instead. Runs the
-- branch at keypress time as a Lua function dispatcher (same mechanism Omarchy
-- uses for its universal clipboard keys).
local move_step = 60 -- pixels per nudge for floating windows

local function move_or_swap(direction, dx, dy)
  return function()
    local win = hl.get_active_window()
    if win and win.floating then
      hl.dispatch(hl.dsp.window.move({ x = dx, y = dy, relative = true }))
    else
      hl.dispatch(hl.dsp.window.swap({ direction = direction }))
    end
  end
end

hl.unbind("SUPER + SHIFT + LEFT")
hl.unbind("SUPER + SHIFT + RIGHT")
hl.unbind("SUPER + SHIFT + UP")
hl.unbind("SUPER + SHIFT + DOWN")

o.bind("SUPER + SHIFT + LEFT",  "Move/swap window left",  move_or_swap("l", -move_step, 0))
o.bind("SUPER + SHIFT + RIGHT", "Move/swap window right", move_or_swap("r",  move_step, 0))
o.bind("SUPER + SHIFT + UP",    "Move/swap window up",    move_or_swap("u", 0, -move_step))
o.bind("SUPER + SHIFT + DOWN",  "Move/swap window down",  move_or_swap("d", 0,  move_step))


-- ── Terminal cheat sheets (Kitty & Tmux) ─────────────────────────────────────
-- SUPER+ALT+K opens the Kitty cheat sheet (K for Kitty).
-- Tmux keybindings moved to SUPER+ALT+T (T for Tmux).
hl.unbind("SUPER + ALT + K")
o.bind("SUPER + ALT + K", "Kitty cheat sheet", "omarchy-menu-kitty")
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/"))


-- ── RK Royal Kludge R65 keyboard cheat sheet ─────────────────────────────────
-- Same Quickshell popup as the rest of the K family: every Fn combo, the volume
-- knob and the B/G mode switch of the R65 (66-key 65%, BT/2.4G/wired, mono/RGB).
-- Pure reference; Enter copies the highlighted combo to the clipboard.
-- On SUPER+CTRL+ALT+K to stay clear of the K family's taken slots
-- (K=keys, ALT+K, CTRL+K, SHIFT+K); this 3-modifier combo was free, so no
-- unbind is needed and existing K-family cheats are left untouched.
o.bind("SUPER + CTRL + ALT + K", "RK R65 keyboard (cheat sheet)", "omarchy-menu-r65")

-- ── Editor cheat sheets ─────────────────────────────────────────────────
-- Mnemonic editor initials on two unused default/user combinations. These use
-- the same searchable Omarchy menu as the K-family sheets; Enter copies the
-- highlighted shortcut to the clipboard.
o.bind("SUPER + ALT + E", "Emacs cheat sheet", "omarchy-menu-emacs")
o.bind("SUPER + ALT + N", "Neovim / AstroNvim cheat sheet", "omarchy-menu-nvim")

-- ── mpv cheat sheet ──────────────────────────────────────────────────────────
-- Same searchable popup as the rest of the family: every DEFAULT mpv key
-- binding (there is no ~/.config/mpv/input.conf on this box, so nothing is
-- overridden). Enter copies the highlighted key to the clipboard.
-- SUPER+ALT+M keeps the mnemonic-initial pattern of ALT+E / ALT+N and was free:
-- SUPER+M is Window mode, SUPER+SHIFT+M is Music and SUPER+SHIFT+ALT+M is the
-- music TUI, so no unbind is needed.
-- Terminal twin of the same card: `mpv-cheat` (sectioned, in colour).
o.bind("SUPER + ALT + M", "mpv cheat sheet", "omarchy-menu-mpv")

-- ── zathura cheat sheet ──────────────────────────────────────────────────────
-- Same searchable popup as the rest of the family: every DEFAULT zathura key
-- (the zathurarc here sets no `map` lines), the : commands, the settings worth
-- flipping mid-document, and the zimg / zbook wrappers that cover the formats
-- this poppler build cannot open. Enter copies the highlighted key.
-- SUPER+ALT+Z keeps the mnemonic-initial pattern of ALT+E / ALT+N / ALT+M and
-- was free: only SUPER+CTRL+Z and SUPER+CTRL+ALT+Z (Reset zoom) use Z, so no
-- unbind is needed.
o.bind("SUPER + ALT + Z", "Zathura cheat sheet", "omarchy-menu-zathura")

-- ── Notes vault + dotfiles ──────────────────────────────────────────────────
-- SUPER+SHIFT+O opens the notes vault in Obsidian; SUPER+SHIFT+Y runs the
-- personal backup script. Both are ~/.local/bin tools, not part of this flake.
local BIN = o.bin
hl.unbind("SUPER + SHIFT + O") -- stock Obsidian bind
hl.unbind("SUPER + SHIFT + Y") -- stock YouTube bind
o.bind("SUPER + SHIFT + O", "Open notes vault (Obsidian)", BIN .. "/vault-open")
o.bind("SUPER + SHIFT + Y", "Back up vault + dotfiles", BIN .. "/bakx")

-- SUPER+SHIFT+V backs up clipboard history + saved images: tar + xz + gpg
-- to the vault (see clipboard-backup). SUPER+V (Universal paste) and
-- SUPER+CTRL+V (Clipboard manager, opens History) are stock Omarchy binds
-- and were left untouched.
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/"))

-- ── Window Mode: a modal for moving/resizing/snapping windows ────────────────
-- SUPER+M enters a submap where bare keys manage the focused window, so you can
-- rapid-fire moves and snaps without holding modifiers. Reuses move_or_swap
-- (above) so movement works on tiled *and* floating windows. Floating snaps go
-- through ~/.local/bin/winsnap (Hyprland only auto-tiles; floating has no snap).
-- Escape / Return / q / SUPER+M all exit. If ever stuck:
--   hyprctl dispatch 'hl.dsp.submap("reset")'
local WINSNAP = BIN .. "/winsnap"
local rstep = 40 -- px per resize tick in window mode

local function resize_by(dx, dy)
  return hl.dsp.window.resize({ x = dx, y = dy, relative = true })
end

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()
  hl.dispatch(hl.dsp.submap("window"))
  hl.dispatch(hl.dsp.exec_cmd(
    "notify-send -t 2500 -a 'Window mode' 'Window mode' "
    .. "'hjkl move · Ctrl+hjkl resize · Shift+hjkl halves\\n1-4 quarters · f full · c center · t float · g group · Esc exit'"))
end)

hl.define_submap("window", function()
  -- Move / swap (works on floating and tiled), auto-repeat while held.
  hl.bind("h", move_or_swap("l", -move_step, 0), { repeating = true })
  hl.bind("j", move_or_swap("d", 0, move_step), { repeating = true })
  hl.bind("k", move_or_swap("u", 0, -move_step), { repeating = true })
  hl.bind("l", move_or_swap("r", move_step, 0), { repeating = true })
  hl.bind("left", move_or_swap("l", -move_step, 0), { repeating = true })
  hl.bind("down", move_or_swap("d", 0, move_step), { repeating = true })
  hl.bind("up", move_or_swap("u", 0, -move_step), { repeating = true })
  hl.bind("right", move_or_swap("r", move_step, 0), { repeating = true })

  -- Resize: Ctrl + hjkl (h/l = width, k/j = height).
  hl.bind("CTRL + h", resize_by(-rstep, 0), { repeating = true })
  hl.bind("CTRL + l", resize_by(rstep, 0), { repeating = true })
  hl.bind("CTRL + k", resize_by(0, -rstep), { repeating = true })
  hl.bind("CTRL + j", resize_by(0, rstep), { repeating = true })

  -- Floating snap: Shift + hjkl = left/bottom/top/right half.
  hl.bind("SHIFT + h", hl.dsp.exec_cmd(WINSNAP .. " left"))
  hl.bind("SHIFT + j", hl.dsp.exec_cmd(WINSNAP .. " bottom"))
  hl.bind("SHIFT + k", hl.dsp.exec_cmd(WINSNAP .. " top"))
  hl.bind("SHIFT + l", hl.dsp.exec_cmd(WINSNAP .. " right"))

  -- Quarters + fill + recenter.
  hl.bind("1", hl.dsp.exec_cmd(WINSNAP .. " tl"))
  hl.bind("2", hl.dsp.exec_cmd(WINSNAP .. " tr"))
  hl.bind("3", hl.dsp.exec_cmd(WINSNAP .. " bl"))
  hl.bind("4", hl.dsp.exec_cmd(WINSNAP .. " br"))
  hl.bind("f", hl.dsp.exec_cmd(WINSNAP .. " full"))
  hl.bind("c", hl.dsp.exec_cmd(WINSNAP .. " center"))

  -- Toggles that fit the same modal.
  hl.bind("t", hl.dsp.window.float({ action = "toggle" }))
  hl.bind("g", hl.dsp.group.toggle())
  hl.bind("v", hl.dsp.layout("togglesplit"))

  -- Exits.
  hl.bind("escape", hl.dsp.submap("reset"))
  hl.bind("return", hl.dsp.submap("reset"))
  hl.bind("q", hl.dsp.submap("reset"))
  hl.bind("SUPER + M", hl.dsp.submap("reset"))
end)

-- ── Yazi file manager ────────────────────────────────────────────────────────
-- TUI file manager in a kitty window. SUPER+ALT+Y was free by default.
-- (yazi is not in the toolbox closure; add it to home/modules/tools.nix to use this.)
o.bind("SUPER + ALT + Y", "Yazi (file manager)", { launch = "kitty --class yazi -e yazi" })

-- SUPER+W remains Omarchy's default close shortcut. SUPER+Q is a convenient
-- alias: a swallowed MPV window closes independently, revealing Yazi beneath.
o.bind("SUPER + Q", "Close window", hl.dsp.window.close())

-- ── Dropdown terminal (quake style) ──────────────────────────────────────────
-- SUPER+` slides a kitty down from the top edge on special:dropterm, riding the
-- springy slidevert animation from looknfeel.lua. ~/.local/bin/dropterm spawns
-- it on first use and toggles it afterwards; a 4-finger swipe down does the
-- same (gesture in looknfeel.lua). SUPER+` was free by default.
o.window("^dropterm$", {
  workspace = "special:dropterm",
  float = true,
  -- size/move take muParser expression strings ("x y"), with monitor_w/h and
  -- window_w/h as variables (percent syntax is the deprecated hyprlang form).
  size = "monitor_w*0.94 monitor_h*0.58",
  move = "monitor_w*0.03 monitor_h*0.04",
})
o.bind("SUPER + GRAVE", "Dropdown terminal", BIN .. "/dropterm")
hl.gesture({ fingers = 4, direction = "down", action = "special", workspace_name = "dropterm" })

-- ── AstroNvim ────────────────────────────────────────────────────────────────
-- Opens the editor straight to its dashboard in a kitty window of its own.
-- SUPER+SHIFT+N ("Editor") already reaches Neovim via omarchy-launch-editor,
-- but that follows ~/.local/state/omarchy/defaults/editor and gives the window
-- a generic app-id. This is a direct, dedicated launcher with its own class, so
-- window rules can target it and it keeps the SUPER+ALT+<initial> pattern of
-- ALT+Y (yazi). SUPER+ALT+A was free by default, so no unbind is needed.
-- (neovim is not in the toolbox closure; add it to home/modules/tools.nix to use this.)
o.bind("SUPER + ALT + A", "AstroNvim", { launch = "kitty --class astronvim -e nvim" })