refactor(hyprland): use key chord as registry entry

This commit is contained in:
2026-10-10 15:13:06 -04:00
parent 2f2fdb2b31
commit 94e6478511
3 changed files with 4 additions and 18 deletions

View File

@@ -12,8 +12,7 @@ in
options.modules.desktop.apps.ghostty.enable = lib.mkEnableOption "Ghostty as the desktop terminal"; options.modules.desktop.apps.ghostty.enable = lib.mkEnableOption "Ghostty as the desktop terminal";
config = lib.mkIf config.modules.desktop.apps.ghostty.enable { config = lib.mkIf config.modules.desktop.apps.ghostty.enable {
registry.keybind.${config.networking.hostName}.ghostty = { registry.keybind.${config.networking.hostName}."SUPER + Return" = {
keys = "SUPER + Return";
action = { action = {
kind = "exec"; kind = "exec";
command = "${pkgs.ghostty}/bin/ghostty"; command = "${pkgs.ghostty}/bin/ghostty";

View File

@@ -35,9 +35,9 @@
settings = { settings = {
config.general.layout = "dwindle"; config.general.layout = "dwindle";
bind = lib.mapAttrsToList (_name: keybind: { bind = lib.mapAttrsToList (keys: keybind: {
_args = [ _args = [
keybind.keys keys
(lib.generators.mkLuaInline "hl.dsp.exec_cmd(${lib.generators.toLua { } keybind.action.command})") (lib.generators.mkLuaInline "hl.dsp.exec_cmd(${lib.generators.toLua { } keybind.action.command})")
]; ];
}) (lib.attrByPath [ config.networking.hostName ] { } config.registry.keybind); }) (lib.attrByPath [ config.networking.hostName ] { } config.registry.keybind);

View File

@@ -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 { type = lib.types.submodule {
options = { options = {
keys = lib.mkOption {
description = "Sets the key chord for this desktop keybind.";
type = lib.types.str;
example = "SUPER + Return";
};
action = lib.mkOption { action = lib.mkOption {
description = "Declares the action this keybind runs."; description = "Declares the action this keybind runs.";
type = lib.types.submodule { type = lib.types.submodule {