{
  host,
  config,
  lib,
  ...
}: let
  inherit (import ../../../hosts/${host}/variables.nix) browser terminal;
in {
  programs.niri.settings = {
    binds = with config.lib.niri.actions; {
      # Terminal & application launcher
      "Mod+Return".action.spawn = "${terminal}";
      "Mod+D".action.spawn = "fuzzel";
      "Mod+R".action.spawn = "rofi-launcher";

      # Window management
      "Mod+Q".action = close-window;
      "Mod+F".action = fullscreen-window;
      "Mod+Shift+F".action = maximize-column;
      "Mod+Shift+Space".action = toggle-window-floating;
      "Mod+Space".action = switch-focus-between-floating-and-tiling;

      # Session control
      "Mod+Shift+E".action.quit = {skip-confirmation = false;};
      "Mod+Shift+Q".action.quit = {skip-confirmation = true;};
      "Mod+L" = {
        action.spawn = ["swaylock"];
        allow-when-locked = true;
      };

      # Focus windows
      "Mod+Left".action = focus-column-left;
      "Mod+Right".action = focus-column-right;
      "Mod+Up".action = focus-window-up;
      "Mod+Down".action = focus-window-down;
      "Mod+Home".action = focus-column-first;
      "Mod+End".action = focus-column-last;

      # Focus monitors
      "Mod+Shift+Left".action = focus-monitor-left;
      "Mod+Shift+Right".action = focus-monitor-right;
      "Mod+Shift+Up".action = focus-monitor-up;
      "Mod+Shift+Down".action = focus-monitor-down;

      # Move windows within workspace
      "Mod+Ctrl+Left".action = move-column-left;
      "Mod+Ctrl+Right".action = move-column-right;
      "Mod+Ctrl+Up".action = move-window-up;
      "Mod+Ctrl+Down".action = move-window-down;
      "Mod+Ctrl+W".action = toggle-column-tabbed-display;
      "Mod+Ctrl+Home".action = move-column-to-first;
      "Mod+Ctrl+End".action = move-column-to-last;

      # Move windows to monitors
      "Mod+Shift+Ctrl+Left".action = move-column-to-monitor-left;
      "Mod+Shift+Ctrl+Right".action = move-column-to-monitor-right;
      "Mod+Shift+Ctrl+Up".action = move-column-to-monitor-up;
      "Mod+Shift+Ctrl+Down".action = move-column-to-monitor-down;

      # Workspaces
      "Mod+1".action = {focus-workspace = 1;};
      "Mod+2".action = {focus-workspace = 2;};
      "Mod+3".action = {focus-workspace = 3;};
      "Mod+4".action = {focus-workspace = 4;};
      "Mod+5".action = {focus-workspace = 5;};
      "Mod+6".action = {focus-workspace = 6;};
      "Mod+7".action = {focus-workspace = 7;};
      "Mod+8".action = {focus-workspace = 8;};
      "Mod+9".action = {focus-workspace = 9;};

      "Mod+Page_Down".action = focus-workspace-down;
      "Mod+Page_Up".action = focus-workspace-up;

      "Mod+Shift+1".action = {move-window-to-workspace = 1;};
      "Mod+Shift+2".action = {move-window-to-workspace = 2;};
      "Mod+Shift+3".action = {move-window-to-workspace = 3;};
      "Mod+Shift+4".action = {move-window-to-workspace = 4;};
      "Mod+Shift+5".action = {move-window-to-workspace = 5;};
      "Mod+Shift+6".action = {move-window-to-workspace = 6;};
      "Mod+Shift+7".action = {move-window-to-workspace = 7;};
      "Mod+Shift+8".action = {move-window-to-workspace = 8;};
      "Mod+Shift+9".action = {move-window-to-workspace = 9;};

      "Mod+Shift+Page_Down".action = move-window-to-workspace-down;
      "Mod+Shift+Page_Up".action = move-window-to-workspace-up;

      "Mod+Ctrl+1".action = {move-column-to-workspace = 1;};
      "Mod+Ctrl+2".action = {move-column-to-workspace = 2;};
      "Mod+Ctrl+3".action = {move-column-to-workspace = 3;};
      "Mod+Ctrl+4".action = {move-column-to-workspace = 4;};
      "Mod+Ctrl+5".action = {move-column-to-workspace = 5;};
      "Mod+Ctrl+6".action = {move-column-to-workspace = 6;};
      "Mod+Ctrl+7".action = {move-column-to-workspace = 7;};
      "Mod+Ctrl+8".action = {move-column-to-workspace = 8;};
      "Mod+Ctrl+9".action = {move-column-to-workspace = 9;};

      "Mod+Ctrl+Page_Down".action = move-column-to-workspace-down;
      "Mod+Ctrl+Page_Up".action = move-column-to-workspace-up;

      # Layout & Sizing
      "Mod+Plus".action = {set-column-width = "+10%";};
      "Mod+Shift+Plus".action = {set-column-width = "+10";};
      "Mod+odiaeresis".action = {set-column-width = "-10%";};
      "Mod+Shift+odiaeresis".action = {set-column-width = "-10";};

      "Mod+Ctrl+Plus".action = {set-window-height = "+10%";};
      "Mod+Ctrl+Shift+Plus".action = {set-window-height = "+10";};
      "Mod+Ctrl+odiaeresis".action = {set-window-height = "-10%";};
      "Mod+Ctrl+Shift+odiaeresis".action = {set-window-height = "-10";};

      "Mod+Shift+R".action = reset-window-height;
      "Mod+comma".action = switch-preset-column-width;
      "Mod+period".action = switch-preset-window-height;
      "Mod+M".action = maximize-column;
      "Mod+C".action = center-column;

      # Overview mode
      "Mod+Tab".action = toggle-overview;
      "Mod+numbersign".action = show-hotkey-overlay;

      # Screenshots
      "Print".action.screenshot = {};
      "Ctrl+Print".action.screenshot-screen = {};
      "Alt+Print".action.screenshot-window = {};

      # Media keys
      "XF86AudioRaiseVolume" = {
        action.spawn = ["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+"];
        allow-when-locked = true;
      };
      "XF86AudioLowerVolume" = {
        action.spawn = ["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1-"];
        allow-when-locked = true;
      };
      "XF86AudioMute" = {
        action.spawn = ["wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"];
        allow-when-locked = true;
      };
      "XF86AudioMicMute" = {
        action.spawn = ["wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"];
        allow-when-locked = true;
      };

      # Brightness
      "XF86MonBrightnessUp" = {
        action.spawn = ["brightnessctl" "set" "10%+"];
        allow-when-locked = true;
      };
      "XF86MonBrightnessDown" = {
        action.spawn = ["brightnessctl" "set" "10%-"];
        allow-when-locked = true;
      };

      # Scroll bindings
      "Mod+WheelScrollDown" = {
        action = focus-workspace-down;
        cooldown-ms = 150;
      };
      "Mod+WheelScrollUp" = {
        action = focus-workspace-up;
        cooldown-ms = 150;
      };
      "Mod+WheelScrollRight".action = focus-column-right;
      "Mod+WheelScrollLeft".action = focus-column-left;
      "Mod+TouchpadScrollDown" = {
        action.spawn = ["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.02+"];
        cooldown-ms = 150;
      };
      "Mod+TouchpadScrollUp" = {
        action.spawn = ["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.02-"];
        cooldown-ms = 150;
      };

      # Custom applications
      "Mod+W".action.spawn = "${browser}";
      "Mod+E".action.spawn = "thunar";
      "Mod+Ctrl+Escape".action.spawn = "btop";

      # Advanced
      "Mod+H".action = consume-window-into-column;
      "Mod+K".action = expel-window-from-column;
      "Mod+Ctrl+H".action = consume-or-expel-window-left;
      "Mod+Ctrl+L".action = consume-or-expel-window-right;
      "Mod+Shift+T".action = do-screen-transition;
      "Mod+O".action = toggle-window-rule-opacity;
      "Mod+Shift+Ctrl+T".action = toggle-debug-tint;
      "Mod+Escape" = {
        action = toggle-keyboard-shortcuts-inhibit;
        allow-inhibiting = false;
      };
    };
  };
}
