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.nix35
1 files changed, 30 insertions, 5 deletions
diff --git a/accounts/gkleen@sif/niri/default.nix b/accounts/gkleen@sif/niri/default.nix
index 924d3843..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;
@@ -711,7 +721,21 @@ in {
711 "Mod+Slash".action = show-hotkey-overlay; 721 "Mod+Slash".action = show-hotkey-overlay;
712 722
713 "Mod+Return".action = spawn terminal; 723 "Mod+Return".action = spawn terminal;
714 "Mod+Shift+Return".action = spawn terminal (lib.getExe config.programs.nushell.package); 724 "Mod+Shift+Return".action =
725 let
726 nushellKitty = pkgs.symlinkJoin {
727 name = "nushell-kitty";
728 paths = [ config.programs.kitty.package ];
729 buildInputs = [ pkgs.makeWrapper ];
730 postBuild = ''
731 wrapProgram $out/bin/kitty \
732 --add-flags "--config ${pkgs.writeText "kitty.conf" ''
733 include $HOME/${config.xdg.configFile."kitty/kitty.conf".target}
734 shell ${lib.getExe config.programs.nushell.package}
735 ''}"
736 '';
737 };
738 in spawn (lib.getExe' nushellKitty "kitty");
715 "Mod+Q".action = close-window; 739 "Mod+Q".action = close-window;
716 "Mod+O".action = spawn (lib.getExe config.programs.fuzzel.package); 740 "Mod+O".action = spawn (lib.getExe config.programs.fuzzel.package);
717 "Mod+Shift+O".action = spawn (lib.getExe config.programs.fuzzel.package) "--list-executables-in-path"; 741 "Mod+Shift+O".action = spawn (lib.getExe config.programs.fuzzel.package) "--list-executables-in-path";
@@ -837,7 +861,7 @@ in {
837 "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";
838 862
839 "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}}}}'';
840 "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}}}'';
841 865
842 "Mod+M".action = consume-or-expel-window-left; 866 "Mod+M".action = consume-or-expel-window-left;
843 "Mod+W".action = consume-or-expel-window-right; 867 "Mod+W".action = consume-or-expel-window-right;
@@ -909,13 +933,14 @@ in {
909 "Mod+Comma".action = spawn makoctl "restore"; 933 "Mod+Comma".action = spawn makoctl "restore";
910 934
911 "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}}}}";
912 "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}}}";
913 937
914 "Mod+X".action = set-dynamic-cast-window; 938 "Mod+X".action = set-dynamic-cast-window;
915 "Mod+Shift+X".action = set-dynamic-cast-monitor; 939 "Mod+Shift+X".action = set-dynamic-cast-monitor;
916 "Mod+Control+Shift+X".action = clear-dynamic-cast-target; 940 "Mod+Control+Shift+X".action = clear-dynamic-cast-target;
917 })) 941 }))
918 (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)
919 ] 944 ]
920 )) 945 ))
921 ]; 946 ];