summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/niri/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'accounts/gkleen@sif/niri/default.nix')
-rw-r--r--accounts/gkleen@sif/niri/default.nix19
1 files changed, 15 insertions, 4 deletions
diff --git a/accounts/gkleen@sif/niri/default.nix b/accounts/gkleen@sif/niri/default.nix
index af1af07a..09482c51 100644
--- a/accounts/gkleen@sif/niri/default.nix
+++ b/accounts/gkleen@sif/niri/default.nix
@@ -45,7 +45,6 @@ let
45 ''; 45 '';
46 }; 46 };
47 focus-or-spawn-action = config.lib.niri.actions.spawn (lib.getExe focus_or_spawn); 47 focus-or-spawn-action = config.lib.niri.actions.spawn (lib.getExe focus_or_spawn);
48 focus-or-spawn-action-app_id = app_id: focus-or-spawn-action ''select(.app_id == "${app_id}")'';
49 48
50 with_adjacent_workspace = pkgs.writeShellApplication { 49 with_adjacent_workspace = pkgs.writeShellApplication {
51 name = "with-adjacent-workspace"; 50 name = "with-adjacent-workspace";
@@ -84,7 +83,7 @@ let
84 }; 83 };
85 with-adjacent-workspace-action = config.lib.niri.actions.spawn (lib.getExe with_adjacent_workspace) "^${lib.concatMapStringsSep "|" ({ name, ...}: name) cfg.scratchspaces}$"; 84 with-adjacent-workspace-action = config.lib.niri.actions.spawn (lib.getExe with_adjacent_workspace) "^${lib.concatMapStringsSep "|" ({ name, ...}: name) cfg.scratchspaces}$";
86 focus-adjacent-workspace = direction: with-adjacent-workspace-action direction ''{"Action":{"FocusWorkspace":{"reference":{"Id": .id}}}}''; 85 focus-adjacent-workspace = direction: with-adjacent-workspace-action direction ''{"Action":{"FocusWorkspace":{"reference":{"Id": .id}}}}'';
87 move-column-to-adjacent-workspace = direction: with-adjacent-workspace-action direction ''{"Action":{"MoveColumnToWorkspace":{"reference":{"Id": .id}}}}''; 86 move-column-to-adjacent-workspace = direction: with-adjacent-workspace-action direction ''{"Action":{"MoveColumnToWorkspace":{"reference":{"Id": .id}, "focus": true}}}'';
88 87
89 with_unnamed_workspace = pkgs.writeShellApplication { 88 with_unnamed_workspace = pkgs.writeShellApplication {
90 name = "with-unnamed-workspace"; 89 name = "with-unnamed-workspace";
@@ -171,6 +170,17 @@ in {
171 type = lib.types.nullOr lib.types.str; 170 type = lib.types.nullOr lib.types.str;
172 default = null; 171 default = null;
173 }; 172 };
173 moveKey = lib.mkOption {
174 type = lib.types.nullOr lib.types.str;
175 default = let
176 keys = lib.splitString "+" config.key;
177 defMoveKey = lib.concatStringsSep "+" (lib.flatten [
178 (lib.take (lib.length keys - 1) keys)
179 ["Shift"]
180 (lib.takeEnd 1 keys)
181 ]);
182 in if config.key == null then null else defMoveKey;
183 };
174 spawn = lib.mkOption { 184 spawn = lib.mkOption {
175 type = lib.types.nullOr (lib.types.listOf lib.types.str); 185 type = lib.types.nullOr (lib.types.listOf lib.types.str);
176 default = null; 186 default = null;
@@ -851,7 +861,7 @@ in {
851 "Mod+Shift+Asterisk".action = kdl.magic-leaf "move-column-to-workspace" "vid"; 861 "Mod+Shift+Asterisk".action = kdl.magic-leaf "move-column-to-workspace" "vid";
852 862
853 "Mod+Plus".action = with-unnamed-workspace-action ''{"Action":{"FocusWorkspace":{"reference":{"Id": .id}}}}''; 863 "Mod+Plus".action = with-unnamed-workspace-action ''{"Action":{"FocusWorkspace":{"reference":{"Id": .id}}}}'';
854 "Mod+Shift+Plus".action = with-unnamed-workspace-action ''{"Action":{"MoveColumnToWorkspace":{"reference":{"Id": .id}}}}''; 864 "Mod+Shift+Plus".action = with-unnamed-workspace-action ''{"Action":{"MoveColumnToWorkspace":{"reference":{"Id": .id}, "focus": true}}}'';
855 865
856 "Mod+M".action = consume-or-expel-window-left; 866 "Mod+M".action = consume-or-expel-window-left;
857 "Mod+W".action = consume-or-expel-window-right; 867 "Mod+W".action = consume-or-expel-window-right;
@@ -923,13 +933,14 @@ in {
923 "Mod+Comma".action = spawn makoctl "restore"; 933 "Mod+Comma".action = spawn makoctl "restore";
924 934
925 "Mod+Control+W".action = with-empty-unnamed-workspace-action "{\"Action\":{\"FocusWorkspace\":{\"reference\":{\"Id\": $workspace_id}}}}"; 935 "Mod+Control+W".action = with-empty-unnamed-workspace-action "{\"Action\":{\"FocusWorkspace\":{\"reference\":{\"Id\": $workspace_id}}}}";
926 "Mod+Control+Shift+W".action = with-empty-unnamed-workspace-action "{\"Action\":{\"MoveColumnToWorkspace\":{\"reference\":{\"Id\": $workspace_id}}}}"; 936 "Mod+Control+Shift+W".action = with-empty-unnamed-workspace-action "{\"Action\":{\"MoveColumnToWorkspace\":{\"reference\":{\"Id\": $workspace_id}, \"focus\": true}}}";
927 937
928 "Mod+X".action = set-dynamic-cast-window; 938 "Mod+X".action = set-dynamic-cast-window;
929 "Mod+Shift+X".action = set-dynamic-cast-monitor; 939 "Mod+Shift+X".action = set-dynamic-cast-monitor;
930 "Mod+Control+Shift+X".action = clear-dynamic-cast-target; 940 "Mod+Control+Shift+X".action = clear-dynamic-cast-target;
931 })) 941 }))
932 (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) 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)
943 (map ({ name, moveKey, ...}: if moveKey != null then bind moveKey { action = kdl.magic-leaf "move-column-to-workspace" name; } else null) cfg.scratchspaces)
933 ] 944 ]
934 )) 945 ))
935 ]; 946 ];