repositories

NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor

clonegit clone https://git.daemon-sec.xyz/NixDaemon.git
omarchy.luaLua58 lines2.1 KiBraw download
-- omarchy.lua — compatibility shim for the carried Omarchy-style Lua files.
--
-- Omarchy configures Hyprland in Lua on top of Hyprland's own `hl` API and adds
-- a few `o.*` conveniences. bindings.lua, lid.lua and caelestia.lua were
-- written against those, so the two helpers they use are provided here with
-- the same shapes, plus one NixOS addition (o.cmd_or_gone). `o` is also set as
-- a global, which is how the carried files reach it.
local o = {}

o.bin = os.getenv("HOME") .. "/.local/bin"

local function to_dispatcher(command)
  if type(command) == "string" then
    return hl.dsp.exec_cmd(command)
  end
  if type(command) == "table" and command.launch then
    -- launch = "cmd": run in its own systemd scope (uwsm) like Omarchy's launcher did
    return hl.dsp.exec_cmd("uwsm app -- " .. command.launch)
  end
  return command -- a dispatcher (hl.dsp.*) or a Lua function
end

-- o.bind(keys, description, command, options)
--   command: shell string, { launch = "…" }, hl.dsp.* dispatcher, or function
--   options: hl.bind flags (locked, repeating, release, mouse, …)
function o.bind(keys, description, command, options)
  local flags = {}
  for k, v in pairs(options or {}) do
    flags[k] = v
  end
  if description and description ~= "" then
    flags.description = description
  end
  return hl.bind(keys, to_dispatcher(command), flags)
end

-- o.window(match, rules): match is a class regex or a match table
function o.window(match, rules)
  local rule = { match = type(match) == "table" and match or { class = match } }
  for k, v in pairs(rules) do
    rule[k] = v
  end
  return hl.window_rule(rule)
end

-- o.cmd_or_gone(cmd, description, note): shell string that runs `cmd` when its
-- program is on PATH and otherwise shows what the key used to do. For binds
-- whose tool is not in the carried toolbox (yet).
function o.cmd_or_gone(cmd, description, note)
  local name = cmd:match("^%S+")
  return string.format(
    "sh -c 'command -v %s >/dev/null 2>&1 && exec %s || exec omarchy-not-ported %q %q'",
    name, cmd, description, note or ""
  )
end

_G.o = o
return o