From 6174f3650cf42aaf008012e828d5a1f8e2ce037f Mon Sep 17 00:00:00 2001 From: Leander Scherer Date: Thu, 8 Jan 2026 02:48:11 +0100 Subject: refactor(modules): separate nixos/home-manager modules, use standard option conventions --- modules/hosts/desktop/sway/default.nix | 119 +++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 modules/hosts/desktop/sway/default.nix (limited to 'modules/hosts/desktop/sway/default.nix') diff --git a/modules/hosts/desktop/sway/default.nix b/modules/hosts/desktop/sway/default.nix new file mode 100644 index 0000000..c149c21 --- /dev/null +++ b/modules/hosts/desktop/sway/default.nix @@ -0,0 +1,119 @@ +{ + config, + username, + lib, + pkgs, + ... +}: + +let + inherit (lib) mkEnableOption mkIf mkOptionDefault; + mod = config.home-manager.users.${username}.wayland.windowManager.sway.config.modifier; + cfg = config.nx.desktop.sway; +in +{ + imports = [ + ./swayidle.nix + ./swaylock.nix + ]; + + options.nx.desktop.sway.enable = mkEnableOption "Enable sway and setup"; + config = mkIf cfg.enable { + home-manager.users.${username} = { + home.packages = with pkgs; [ + wmenu + swaybg + sway-contrib.grimshot + wl-clipboard + xdg-utils + ]; + + wayland.windowManager.sway = { + enable = true; + systemd = { + enable = true; + xdgAutostart = true; + }; + config = { + input = { + "*" = { + xkb_layout = "de"; + }; + }; + + output = { + DP-1 = { + resolution = "1920x1080@240Hz"; + bg = "/etc/nixos/images/pond.jpg fill"; + }; + }; + + gaps = { + inner = 15; + }; + + window = { + titlebar = false; + border = 0; + }; + + modifier = "Mod4"; + + keybindings = mkOptionDefault { + "${mod}+q" = "kill"; + "${mod}+Shift+s" = "exec grimshot savecopy area"; + "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"; + }; + + menu = "${pkgs.wmenu}/bin/wmenu-run -b -N 000000E6"; + terminal = "${pkgs.foot}/bin/foot"; + defaultWorkspace = "workspace number 1"; + + bars = [ + { + "command" = "${pkgs.waybar}/bin/waybar"; + } + ]; + }; + checkConfig = false; + wrapperFeatures.base = true; + wrapperFeatures.gtk = true; + }; + + home.sessionVariables = { + XDG_CURRENT_DESKTOP = "sway"; + XDG_SCREENSHOTS_DIR = "~/Pictures/Screenshots/"; + }; + + gtk = { + enable = true; + theme = { + name = "Adwaita-dark"; + package = pkgs.gnome-themes-extra; + }; + gtk3.extraConfig = { + Settings = '' + gtk-application-prefer-dark-theme=1 + ''; + }; + gtk4.extraConfig = { + Settings = '' + gtk-application-prefer-dark-theme=1 + ''; + }; + }; + + home.pointerCursor = { + gtk.enable = true; + name = "Adwaita"; + package = pkgs.adwaita-icon-theme; + size = 24; + }; + }; + }; +} -- cgit v1.3.1