diff options
Diffstat (limited to 'accounts/gkleen@sif/niri/default.nix')
-rw-r--r-- | accounts/gkleen@sif/niri/default.nix | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/accounts/gkleen@sif/niri/default.nix b/accounts/gkleen@sif/niri/default.nix index 09482c51..fde08ae9 100644 --- a/accounts/gkleen@sif/niri/default.nix +++ b/accounts/gkleen@sif/niri/default.nix | |||
@@ -140,6 +140,25 @@ let | |||
140 | ''; | 140 | ''; |
141 | }; | 141 | }; |
142 | with-select-window-action = config.lib.niri.actions.spawn (lib.getExe with_select_window); | 142 | with-select-window-action = config.lib.niri.actions.spawn (lib.getExe with_select_window); |
143 | |||
144 | with_predicate_window = pred: pkgs.writeShellApplication { | ||
145 | name = "with-predicate-window"; | ||
146 | runtimeInputs = [ niri pkgs.gojq pkgs.socat config.programs.fuzzel.package pkgs.gawk ]; | ||
147 | text = '' | ||
148 | action="$1" | ||
149 | shift | ||
150 | |||
151 | windows_json="$(niri msg -j windows)" | ||
152 | window_json="$(gojq -rc 'map(select(${pred})) | .[0]' <<<"$windows_json")" | ||
153 | |||
154 | [[ -z "$window_json" || $window_json = "null" ]] && exit 1 | ||
155 | |||
156 | jq -c "$action" <<<"$window_json" | socat STDIO "$NIRI_SOCKET" | ||
157 | ''; | ||
158 | }; | ||
159 | |||
160 | with-urgent-window-action = config.lib.niri.actions.spawn (lib.getExe (with_predicate_window ".is_urgent")); | ||
161 | with-focused-window-action = config.lib.niri.actions.spawn (lib.getExe (with_predicate_window ".is_focused")); | ||
143 | in { | 162 | in { |
144 | imports = [ | 163 | imports = [ |
145 | ./waybar.nix | 164 | ./waybar.nix |
@@ -938,6 +957,9 @@ in { | |||
938 | "Mod+X".action = set-dynamic-cast-window; | 957 | "Mod+X".action = set-dynamic-cast-window; |
939 | "Mod+Shift+X".action = set-dynamic-cast-monitor; | 958 | "Mod+Shift+X".action = set-dynamic-cast-monitor; |
940 | "Mod+Control+Shift+X".action = clear-dynamic-cast-target; | 959 | "Mod+Control+Shift+X".action = clear-dynamic-cast-target; |
960 | |||
961 | "Mod+D".action = with-urgent-window-action "{\"Action\":{\"FocusWindow\":{\"id\": .id}}}"; | ||
962 | "Mod+Shift+D".action = with-focused-window-action "{\"Action\":{\"UnsetUrgent\":{\"id\": .id}}}"; | ||
941 | })) | 963 | })) |
942 | (map ({ name, selector, spawn, key, ...}: if key != null && selector != null && spawn != null then bind key { action = focus-or-spawn-action selector name spawn; } else null) cfg.scratchspaces) | 964 | (map ({ name, selector, spawn, key, ...}: if key != null && selector != null && spawn != null then bind key { action = focus-or-spawn-action selector name spawn; } else null) cfg.scratchspaces) |
943 | (map ({ name, moveKey, ...}: if moveKey != null then bind moveKey { action = kdl.magic-leaf "move-column-to-workspace" name; } else null) cfg.scratchspaces) | 965 | (map ({ name, moveKey, ...}: if moveKey != null then bind moveKey { action = kdl.magic-leaf "move-column-to-workspace" name; } else null) cfg.scratchspaces) |