diff options
| author | schererleander <leander@schererleander.de> | 2025-04-29 16:59:25 +0200 |
|---|---|---|
| committer | schererleander <leander@schererleander.de> | 2025-04-29 16:59:25 +0200 |
| commit | db88d50e8924cba8b424c0ea7546b81baccd9c5c (patch) | |
| tree | 44b2b1082c587b47fb1f08d620ee707ddd4adf27 /modules/home-manager/sway.nix | |
| parent | 539b3e2836e4e7177e65b3df10a4bfe68f9f4d23 (diff) | |
initial commit
Diffstat (limited to 'modules/home-manager/sway.nix')
| -rw-r--r-- | modules/home-manager/sway.nix | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/modules/home-manager/sway.nix b/modules/home-manager/sway.nix new file mode 100644 index 0000000..77f1138 --- /dev/null +++ b/modules/home-manager/sway.nix @@ -0,0 +1,104 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.sway; +in { + options.sway.enable = lib.mkEnableOption "Enable sway and setup"; + config = lib.mkIf cfg.enable { + home.packages = with pkgs; [ + wmenu + swaybg + wl-clipboard + playerctl + ]; + + xdg = { + portal = { + enable = true; + extraPortals = with pkgs; [ + xdg-desktop-portal-wlr + xdg-desktop-portal-gtk + ]; + }; + }; + + wayland.windowManager.sway = { + enable = true; + config = { + input = { + "*" = { + xkb_layout = "de"; + }; + }; + output = { + DP-1 = { + resolution = "1920x1080@240Hz"; + bg = "/etc/nixos/jaison-lin-2WHTac8jVA8-unsplash.jpg fill"; + }; + }; + gaps = { + inner = 15; + }; + window = { + titlebar = false; + border = 0; + }; + keybindings = let + mod = "Mod4"; + in + lib.mkOptionDefault { + "${mod}+Return" = "exec ${pkgs.foot}/bin/foot"; + "${mod}+q" = "kill"; + "${mod}+d" = "exec exec ${pkgs.wmenu}/bin/wmenu-run -b -N 000000"; + "${mod}+Shift+e" = "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'"; + "${mod}+Tab" = "workspace back_and_forth"; + "${mod}+1" = "workspace number 1"; + "${mod}+2" = "workspace number 2"; + "${mod}+3" = "workspace number 3"; + "${mod}+4" = "workspace number 4"; + "${mod}+5" = "workspace number 5"; + "${mod}+6" = "workspace number 6"; + "${mod}+7" = "workspace number 7"; + "${mod}+8" = "workspace number 8"; + "${mod}+9" = "workspace number 9"; + "${mod}+0" = "workspace number 10"; + + "${mod}+Shift+1" = "move container to workspace number 1"; + "${mod}+Shift+2" = "move container to workspace number 2"; + "${mod}+Shift+3" = "move container to workspace number 3"; + "${mod}+Shift+4" = "move container to workspace number 4"; + "${mod}+Shift+5" = "move container to workspace number 5"; + "${mod}+Shift+6" = "move container to workspace number 6"; + "${mod}+Shift+7" = "move container to workspace number 7"; + "${mod}+Shift+8" = "move container to workspace number 8"; + "${mod}+Shift+9" = "move container to workspace number 9"; + "${mod}+Shift+0" = "move container to workspace number 10"; + + "${mod}+b" = "splith"; + "${mod}+v" = "splitv"; + "${mod}+f" = "fullscreen"; + "${mod}+Shift+space" = "floating toggle"; + + "XF86AudioPlay" = "exec playerctl play-pause"; + "XF86AudioPrev" = "exec playerctl previous"; + "XF86AudioNext" = "exec playerctl next"; + + "XF86AudioRaiseVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_DEVICE@ +5%"; + "XF86AudioLowerVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_DEVICE@ -5%"; + "XF86AudioMute" = "exec wpctl set-mute @DEFAULT_AUDIO_DEVICE@ toggle"; + }; + defaultWorkspace = "workspace number 1"; + bars = [{ + "command" = "${pkgs.waybar}/bin/waybar"; + }]; + }; + checkConfig = false; + wrapperFeatures.base = true; + wrapperFeatures.gtk = true; + }; + + home.sessionVariables = { + XDG_CURRENT_DESKTOP = "wayland"; + }; + }; +} |
