diff --git a/users/myuser/graphical/sway.nix b/users/myuser/graphical/sway.nix index e770430..4b97942 100644 --- a/users/myuser/graphical/sway.nix +++ b/users/myuser/graphical/sway.nix @@ -1,12 +1,19 @@ { - pkgs, + lib, + config, nixosConfig, + pkgs, ... -}: { - imports = [ - ./kitty.nix - ]; +}: let + inherit + (lib) + mapAttrs' + nameValuePair + ; + bindWithModifier = mapAttrs' (k: nameValuePair (cfg.modifier + "+" + k)); + cfg = config.wayland.windowManager.sway.config; +in { wayland.windowManager.sway = { enable = true; config = @@ -14,13 +21,94 @@ modifier = "Mod4"; terminal = "kitty"; + # Excuse me, le füque focus.followMouse = false; + focus.mouseWarping = false; + + # TODO menu = "rofi -show run"; + + keybindings = + { + "XF86AudioRaiseVolume" = "exec --no-startup-id wpctl set-sink-volume @DEFAULT_SINK@ +5%"; + "XF86AudioLowerVolume" = "exec --no-startup-id wpctl set-sink-volume @DEFAULT_SINK@ -5%"; + "XF86AudioMute" = "exec --no-startup-id wpctl set-sink-mute @DEFAULT_SINK@ toggle"; + "XF86AudioMicMute" = "exec --no-startup-id wpctl set-source-mute @DEFAULT_SOURCE@ toggle"; + + #"Print" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot copy area"; + #"${mod}+Print" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot save area"; + } + # // optionalAttrs useBacklight { + # "XF86MonBrightnessUp" = "exec ${pkgs.light}/bin/light -A 5"; + # "XF86MonBrightnessDown" = "exec ${pkgs.light}/bin/light -U 5"; + # } + // { + "Menu" = "exec ${cfg.menu}"; + } + # General mappings that start with $modifier+... + // bindWithModifier { + "t" = "exec ${cfg.terminal}"; + "asciicircum" = "exec ${cfg.menu}"; + "b" = "exec firefox"; + + "Shift+r" = "reload"; + "q" = "kill"; + + "Left" = "focus left"; + "Right" = "focus right"; + "Up" = "focus up"; + "Down" = "focus down"; + + "Shift+Left" = "move left"; + "Shift+Right" = "move right"; + "Shift+Up" = "move up"; + "Shift+Down" = "move down"; + + "s" = "splith"; + "v" = "splitv"; + "f" = "floating toggle"; + "Return" = "fullscreen toggle"; + "Space" = "focus mode_toggle"; + # "a" = "focus parent"; + # "s" = "layout stacking"; + # "w" = "layout tabbed"; + # "e" = "layout toggle split"; + + "Shift+Ctrl+q" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'"; + "r" = "mode resize"; + + "1" = "workspace number 1"; + "2" = "workspace number 2"; + "3" = "workspace number 3"; + "4" = "workspace number 4"; + "5" = "workspace number 5"; + "6" = "workspace number 6"; + "7" = "workspace number 7"; + "8" = "workspace number 8"; + "9" = "workspace number 9"; + "Comma" = "workspace prev"; + "Period" = "workspace next"; + + "Shift+1" = "move container to workspace number 1"; + "Shift+2" = "move container to workspace number 2"; + "Shift+3" = "move container to workspace number 3"; + "Shift+4" = "move container to workspace number 4"; + "Shift+5" = "move container to workspace number 5"; + "Shift+6" = "move container to workspace number 6"; + "Shift+7" = "move container to workspace number 7"; + "Shift+8" = "move container to workspace number 8"; + "Shift+9" = "move container to workspace number 9"; + "Shift+Comma" = "move container to workspace prev"; + "Shift+Period" = "move container to workspace next"; + }; + window.titlebar = false; + input = { "type:keyboard" = { repeat_delay = "235"; repeat_rate = "60"; xkb_layout = "de"; + xkb_variant = "nodeadkeys"; xkb_numlock = "enabled"; }; "type:pointer" = { @@ -28,6 +116,7 @@ pointer_accel = "0"; }; }; + assigns = { "9" = [ {class = "^steam_app_";} @@ -95,6 +184,13 @@ xdragon ]; + home.pointerCursor = { + gtk.enable = true; + name = "Adwaita-dark"; + package = pkgs.gnome.adwaita-icon-theme; + size = 24; + }; + # Needed to fix cursors in firefox under wayland, see https://github.com/NixOS/nixpkgs/issues/207339#issuecomment-1374497558 gtk = { enable = true;