From 94e6478511953ca783a27b16580eec53d8e25f65 Mon Sep 17 00:00:00 2001 From: alexion Date: Sat, 10 Oct 2026 15:13:06 -0400 Subject: [PATCH] refactor(hyprland): use key chord as registry entry --- configs/nixos/modules/desktop/apps/ghostty.nix | 3 +-- .../modules/desktop/session/hyprland/default.nix | 4 ++-- configs/nixos/registry/keybind.nix | 15 +-------------- 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/configs/nixos/modules/desktop/apps/ghostty.nix b/configs/nixos/modules/desktop/apps/ghostty.nix index dd07245..0e1f97d 100644 --- a/configs/nixos/modules/desktop/apps/ghostty.nix +++ b/configs/nixos/modules/desktop/apps/ghostty.nix @@ -12,8 +12,7 @@ in options.modules.desktop.apps.ghostty.enable = lib.mkEnableOption "Ghostty as the desktop terminal"; config = lib.mkIf config.modules.desktop.apps.ghostty.enable { - registry.keybind.${config.networking.hostName}.ghostty = { - keys = "SUPER + Return"; + registry.keybind.${config.networking.hostName}."SUPER + Return" = { action = { kind = "exec"; command = "${pkgs.ghostty}/bin/ghostty"; diff --git a/configs/nixos/modules/desktop/session/hyprland/default.nix b/configs/nixos/modules/desktop/session/hyprland/default.nix index e73441e..8942b3d 100644 --- a/configs/nixos/modules/desktop/session/hyprland/default.nix +++ b/configs/nixos/modules/desktop/session/hyprland/default.nix @@ -35,9 +35,9 @@ settings = { config.general.layout = "dwindle"; - bind = lib.mapAttrsToList (_name: keybind: { + bind = lib.mapAttrsToList (keys: keybind: { _args = [ - keybind.keys + keys (lib.generators.mkLuaInline "hl.dsp.exec_cmd(${lib.generators.toLua { } keybind.action.command})") ]; }) (lib.attrByPath [ config.networking.hostName ] { } config.registry.keybind); diff --git a/configs/nixos/registry/keybind.nix b/configs/nixos/registry/keybind.nix index 4fc516d..6c56ec7 100644 --- a/configs/nixos/registry/keybind.nix +++ b/configs/nixos/registry/keybind.nix @@ -1,20 +1,7 @@ -{ lib, util, ... }: +{ lib, ... }: { - checks = [ - { - assertion = util.registry.predicates.uniqueValue (entry: entry.value.keys); - message = "Desktop keybinds must use unique key chords."; - } - ]; - type = lib.types.submodule { options = { - keys = lib.mkOption { - description = "Sets the key chord for this desktop keybind."; - type = lib.types.str; - example = "SUPER + Return"; - }; - action = lib.mkOption { description = "Declares the action this keybind runs."; type = lib.types.submodule {