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.nix129
1 files changed, 49 insertions, 80 deletions
diff --git a/accounts/gkleen@sif/niri/default.nix b/accounts/gkleen@sif/niri/default.nix
index 35a3d799..5ae372c1 100644
--- a/accounts/gkleen@sif/niri/default.nix
+++ b/accounts/gkleen@sif/niri/default.nix
@@ -7,10 +7,6 @@ let
7 7
8 niri = cfg.package; 8 niri = cfg.package;
9 terminal = lib.getExe config.programs.kitty.package; 9 terminal = lib.getExe config.programs.kitty.package;
10 makoctl = lib.getExe' config.services.mako.package "makoctl";
11 loginctl = lib.getExe' hostConfig.systemd.package "loginctl";
12 systemctl = lib.getExe' hostConfig.systemd.package "systemctl";
13 swayosd-client = lib.getExe' config.services.swayosd.package "swayosd-client";
14 10
15 focus_or_spawn = pkgs.writeShellApplication { 11 focus_or_spawn = pkgs.writeShellApplication {
16 name = "focus-or-spawn"; 12 name = "focus-or-spawn";
@@ -165,12 +161,6 @@ let
165 with-urgent-window-action = config.lib.niri.actions.spawn (lib.getExe (with_predicate_window ".is_urgent")); 161 with-urgent-window-action = config.lib.niri.actions.spawn (lib.getExe (with_predicate_window ".is_urgent"));
166 with-focused-window-action = config.lib.niri.actions.spawn (lib.getExe (with_predicate_window ".is_focused")); 162 with-focused-window-action = config.lib.niri.actions.spawn (lib.getExe (with_predicate_window ".is_focused"));
167in { 163in {
168 imports = [
169 ./waybar.nix
170 ./mako.nix
171 ./swayosd.nix
172 ];
173
174 options = { 164 options = {
175 programs.niri.scratchspaces = lib.mkOption { 165 programs.niri.scratchspaces = lib.mkOption {
176 type = lib.types.listOf (lib.types.submodule ({ config, ... }: { 166 type = lib.types.listOf (lib.types.submodule ({ config, ... }: {
@@ -231,36 +221,7 @@ in {
231 }; 221 };
232 222
233 config = { 223 config = {
234 systemd.user.services.xwayland-satellite = { 224 home.packages = [ pkgs.xwayland-satellite-unstable ];
235 Unit = {
236 BindsTo = [ "graphical-session.target" ];
237 PartOf = [ "graphical-session.target" ];
238 After = [ "graphical-session.target" ];
239 Requisite = [ "graphical-session.target" ];
240 };
241 Service = {
242 Type = "notify";
243 NotifyAccess = "all";
244 Environment = [ "DISPLAY=:0" ];
245 ExecStart = ''${lib.getExe pkgs.xwayland-satellite-unstable} ''${DISPLAY}'';
246 ExecStartPre = "${systemctl} --user import-environment DISPLAY";
247 StandardOutput = "journal";
248 };
249 Install = {
250 WantedBy = [ "graphical-session.target" ];
251 };
252 };
253
254 services.swayidle = {
255 events = [
256 { event = "after-resume"; command = "${lib.getExe niri} msg action power-on-monitors"; }
257 ];
258 timeouts = [
259 { timeout = 540;
260 command = "${lib.getExe niri} msg action power-off-monitors";
261 }
262 ];
263 };
264 225
265 systemd.user.sockets.niri-workspace-history = { 226 systemd.user.sockets.niri-workspace-history = {
266 Socket = { 227 Socket = {
@@ -747,7 +708,7 @@ in {
747 708
748 (plain "layer-rule" [ 709 (plain "layer-rule" [
749 (sleaf "match" { namespace = "^notifications$"; }) 710 (sleaf "match" { namespace = "^notifications$"; })
750 (sleaf "match" { namespace = "^waybar$"; }) 711 (sleaf "match" { namespace = "^bar$"; })
751 (sleaf "match" { namespace = "^launcher$"; }) 712 (sleaf "match" { namespace = "^launcher$"; })
752 (sleaf "block-out-from" "screencast") 713 (sleaf "block-out-from" "screencast")
753 ]) 714 ])
@@ -939,66 +900,74 @@ in {
939 "Mod+Right".action = set-column-width "+10%"; 900 "Mod+Right".action = set-column-width "+10%";
940 901
941 "Mod+Shift+Z" = { 902 "Mod+Shift+Z" = {
942 action = spawn (lib.getExe niri) "msg" "action" "power-off-monitors"; 903 action = power-off-monitors;
943 allow-when-locked = true; 904 allow-when-locked = true;
944 }; 905 };
945 "Mod+Shift+L".action = spawn loginctl "lock-session";
946 "Mod+Shift+E".action = quit; 906 "Mod+Shift+E".action = quit;
947 "Mod+Shift+Minus" = { 907
948 action = spawn systemctl "suspend"; 908 # "Mod+Semicolon".action = spawn makoctl "dismiss" "--group";
909 # "Mod+Shift+Semicolon".action = spawn makoctl "dismiss" "--all";
910 # "Mod+Period".action = spawn makoctl "menu" "--" (lib.getExe config.programs.fuzzel.package) "--dmenu";
911 # "Mod+Comma".action = spawn makoctl "restore";
912
913 "Mod+Control+W".action = with-empty-unnamed-workspace-action "{\"Action\":{\"FocusWorkspace\":{\"reference\":{\"Id\": $workspace_id}}}}";
914 "Mod+Control+Shift+W".action = with-empty-unnamed-workspace-action "{\"Action\":{\"MoveColumnToWorkspace\":{\"reference\":{\"Id\": $workspace_id}, \"focus\": true}}}";
915
916 "Mod+X".action = set-dynamic-cast-window;
917 "Mod+Shift+X".action = set-dynamic-cast-monitor;
918 "Mod+Control+Shift+X".action = clear-dynamic-cast-target;
919
920 "Mod+D".action = with-urgent-window-action "{\"Action\":{\"FocusWindow\":{\"id\": .id}}}";
921 "Mod+Shift+D".action = with-focused-window-action "{\"Action\":{\"UnsetUrgent\":{\"id\": .id}}}";
922
923 "Mod+K".action = spawn (lib.getExe' pkgs.worktime "worktime-ui");
924 "Mod+Shift+K".action = spawn (lib.getExe' pkgs.worktime "worktime-stop");
925 }))
926 (lib.mapAttrsToList (name: cfg: node name [(lib.removeAttrs cfg ["action"])] [cfg.action]) (let
927 shell = obj: leaf "send-unix" [
928 { path = ''''${XDG_RUNTIME_DIR}/shell.sock''; }
929 (builtins.toJSON obj + "\n")
930 ];
931 in {
932 "XF86AudioRaiseVolume" = {
949 allow-when-locked = true; 933 allow-when-locked = true;
934 action = shell { Volume.volume = "up"; };
950 }; 935 };
951 "Mod+Shift+Control+Minus" = { 936 "XF86AudioLowerVolume" = {
952 action = spawn systemctl "hibernate";
953 allow-when-locked = true; 937 allow-when-locked = true;
938 action = shell { Volume.volume = "down"; };
954 }; 939 };
955 "Mod+Shift+P" = { 940 "XF86AudioMute" = {
956 action = spawn (lib.getExe pkgs.playerctl) "-a" "pause";
957 allow-when-locked = true; 941 allow-when-locked = true;
942 action = shell { Volume.muted = "toggle"; };
958 }; 943 };
959 944 "XF86AudioMicMute" = {
960 "XF86MonBrightnessUp" = {
961 action = spawn swayosd-client "--brightness" "raise";
962 allow-when-locked = true; 945 allow-when-locked = true;
946 action = shell { Volume."mic-muted" = "toggle"; };
963 }; 947 };
964 "XF86MonBrightnessDown" = { 948 "XF86MonBrightnessUp" = {
965 action = spawn swayosd-client "--brightness" "lower"; 949 action = shell { Brightness = "up"; };
966 allow-when-locked = true; 950 allow-when-locked = true;
967 }; 951 };
968 "XF86AudioRaiseVolume" = { 952 "XF86MonBrightnessDown" = {
969 action = spawn swayosd-client "--output-volume" "raise"; 953 action = shell { Brightness = "down"; };
970 allow-when-locked = true; 954 allow-when-locked = true;
971 }; 955 };
972 "XF86AudioLowerVolume" = { 956 "Mod+Shift+L".action = shell { LockSession = {}; };
973 action = spawn swayosd-client "--output-volume" "lower"; 957 "Mod+Shift+Minus" = {
958 action = shell { Suspend = {}; };
974 allow-when-locked = true; 959 allow-when-locked = true;
975 }; 960 };
976 "XF86AudioMute" = { 961 "Mod+Shift+Control+Minus" = {
977 action = spawn swayosd-client "--output-volume" "mute-toggle"; 962 action = shell { Hibernate = {}; };
978 allow-when-locked = true; 963 allow-when-locked = true;
979 }; 964 };
980 "XF86AudioMicMute" = { 965 "Mod+Shift+P" = {
981 action = spawn swayosd-client "--input-volume" "mute-toggle"; 966 action = shell { Mpris = { PauseAll = {}; }; };
982 allow-when-locked = true; 967 allow-when-locked = true;
983 }; 968 };
984 969 "Mod+Semicolon".action = shell { Notifications = { DismissGroup = {}; }; };
985 "Mod+Semicolon".action = spawn makoctl "dismiss" "--group"; 970 "Mod+Shift+Semicolon".action = shell { Notifications = { DismissAll = {}; }; };
986 "Mod+Shift+Semicolon".action = spawn makoctl "dismiss" "--all";
987 "Mod+Period".action = spawn makoctl "menu" "--" (lib.getExe config.programs.fuzzel.package) "--dmenu";
988 "Mod+Comma".action = spawn makoctl "restore";
989
990 "Mod+Control+W".action = with-empty-unnamed-workspace-action "{\"Action\":{\"FocusWorkspace\":{\"reference\":{\"Id\": $workspace_id}}}}";
991 "Mod+Control+Shift+W".action = with-empty-unnamed-workspace-action "{\"Action\":{\"MoveColumnToWorkspace\":{\"reference\":{\"Id\": $workspace_id}, \"focus\": true}}}";
992
993 "Mod+X".action = set-dynamic-cast-window;
994 "Mod+Shift+X".action = set-dynamic-cast-monitor;
995 "Mod+Control+Shift+X".action = clear-dynamic-cast-target;
996
997 "Mod+D".action = with-urgent-window-action "{\"Action\":{\"FocusWindow\":{\"id\": .id}}}";
998 "Mod+Shift+D".action = with-focused-window-action "{\"Action\":{\"UnsetUrgent\":{\"id\": .id}}}";
999
1000 "Mod+K".action = spawn (lib.getExe' pkgs.worktime "worktime-ui");
1001 "Mod+Shift+K".action = spawn (lib.getExe' pkgs.worktime "worktime-stop");
1002 })) 971 }))
1003 (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) 972 (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)
1004 (map ({ name, moveKey, ...}: if moveKey != null then bind moveKey { action = kdl.magic-leaf "move-column-to-workspace" name; } else null) cfg.scratchspaces) 973 (map ({ name, moveKey, ...}: if moveKey != null then bind moveKey { action = kdl.magic-leaf "move-column-to-workspace" name; } else null) cfg.scratchspaces)