From c2744ea1ebc110114a8d1816c98d8274d8f8a914 Mon Sep 17 00:00:00 2001 From: Erwin Boskma Date: Tue, 26 Mar 2024 15:06:20 +0100 Subject: [PATCH] sway: Make package configurable --- home-manager/modules/sway/default.nix | 23 ++++++++++++++++++----- machines/loki/configuration.nix | 22 +++++++++++++++++++++- machines/mimir/configuration.nix | 19 +++++++++++++++++++ modules/desktop/default.nix | 20 -------------------- modules/greetd/default.nix | 2 +- users/erwin/home.nix | 1 + 6 files changed, 60 insertions(+), 27 deletions(-) diff --git a/home-manager/modules/sway/default.nix b/home-manager/modules/sway/default.nix index 6e242b2..f80c1be 100644 --- a/home-manager/modules/sway/default.nix +++ b/home-manager/modules/sway/default.nix @@ -19,6 +19,7 @@ in options.eboskma.programs.sway = { enable = mkEnableOption "sway"; wayvnc = mkEnableOption "wayvnc"; + package = mkPackageOption pkgs "sway" { }; lock-wallpaper = mkOption { description = "Wallpaper to use for the lockscreen"; @@ -85,6 +86,8 @@ in config = mkIf cfg.enable { wayland.windowManager.sway = { enable = true; + package = cfg.package; + config = { modifier = mod; @@ -160,7 +163,7 @@ in gaps = { inner = 10; - outer = 5; + # outer = 5; smartBorders = "on"; }; @@ -244,8 +247,8 @@ in "${mod}+c" = mkIf config.eboskma.programs.emacs.enable "exec ${config.programs.emacs.package}/bin/emacsclient -c"; - "${mod}+Print" = "exec ${pkgs.grim}/bin/grim -o $(${pkgs.sway}/bin/swaymsg -t get_outputs | ${pkgs.jaq}/bin/jaq -r '.[] | select(.focused) | .name')"; - "${mod}+Shift+Print" = ''exec ${pkgs.grim}/bin/grim -o $(${pkgs.sway}/bin/swaymsg -t get_outputs | ${pkgs.jaq}/bin/jaq -r '.[] | select(.focused) | .name') - | ${pkgs.wl-clipboard}/bin/wl-copy -t "image/png" -f''; + "${mod}+Print" = "exec ${pkgs.grim}/bin/grim -o $(${cfg.package}/bin/swaymsg -t get_outputs | ${pkgs.jaq}/bin/jaq -r '.[] | select(.focused) | .name')"; + "${mod}+Shift+Print" = ''exec ${pkgs.grim}/bin/grim -o $(${cfg.package}/bin/swaymsg -t get_outputs | ${pkgs.jaq}/bin/jaq -r '.[] | select(.focused) | .name') - | ${pkgs.wl-clipboard}/bin/wl-copy -t "image/png" -f''; "${mod}+Shift+Ctrl+Print" = ''exec ${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" - | ${pkgs.wl-clipboard}/bin/wl-copy -t "image/png" -f''; "${mod}+Shift+Alt+Print" = ''exec ${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)"''; @@ -288,6 +291,16 @@ in for_window [shell="xwayland"] title_format "%title [XWayland]" for_window [app_id="^.*iwgtk$"] floating enable + blur enable + blur_xray disable + + shadows enable + + default_dim_inactive 0.2 + + corner_radius 10 + + include /etc/sway/config.d/* ''; # exec --no-startup-id ${pkgs.swaynotificationcenter}/bin/swaync @@ -345,8 +358,8 @@ in } { timeout = 1200; - command = "${pkgs.sway}/bin/swaymsg 'output * power off'"; - resumeCommand = "${pkgs.sway}/bin/swaymsg '${resumeMessages}'"; + command = "${cfg.package}/bin/swaymsg 'output * power off'"; + resumeCommand = "${cfg.package}/bin/swaymsg '${resumeMessages}'"; } ]; }; diff --git a/machines/loki/configuration.nix b/machines/loki/configuration.nix index 63314dd..56bfea7 100644 --- a/machines/loki/configuration.nix +++ b/machines/loki/configuration.nix @@ -121,7 +121,7 @@ kernelParams = [ "amd_pstate.shared_mem=1" ]; extraModulePackages = with config.boot.kernelPackages; [ cpupower - rtl88x2bu + # rtl88x2bu zenpower ]; @@ -226,6 +226,14 @@ enable = true; }; sudo.enable = false; + pam.services.swaylock = { + unixAuth = true; + setLoginUid = true; + enableGnomeKeyring = true; + allowNullPassword = true; + updateWtmp = true; + startSession = true; + }; }; systemd = { @@ -384,6 +392,18 @@ }; programs = { + sway = { + enable = true; + package = pkgs.swayfx; + wrapperFeatures = { + gtk = true; + base = true; + }; + extraPackages = with pkgs; [ + swaylock + swayidle + ]; + }; gnome-disks.enable = true; # ssh.startAgent = true; diff --git a/machines/mimir/configuration.nix b/machines/mimir/configuration.nix index 7ab812a..27d8aa6 100644 --- a/machines/mimir/configuration.nix +++ b/machines/mimir/configuration.nix @@ -230,6 +230,14 @@ apparmor = { enable = true; }; + pam.services.swaylock = { + unixAuth = true; + setLoginUid = true; + enableGnomeKeyring = true; + allowNullPassword = true; + updateWtmp = true; + startSession = true; + }; }; systemd.network = { @@ -308,6 +316,17 @@ # programs.ssh.startAgent = true; programs = { + sway = { + enable = true; + wrapperFeatures = { + gtk = true; + base = true; + }; + extraPackages = with pkgs; [ + swaylock + swayidle + ]; + }; gnome-disks.enable = true; nix-ld = { enable = true; diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index 8e11c2f..38c21d8 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -25,18 +25,6 @@ in fuse.userAllowOther = true; seahorse.enable = true; - - sway = mkIf cfg.wayland { - enable = true; - wrapperFeatures = { - gtk = true; - base = true; - }; - extraPackages = with pkgs; [ - swaylock - swayidle - ]; - }; }; xdg = { @@ -61,14 +49,6 @@ in }; security = { - pam.services.swaylock = { - unixAuth = true; - setLoginUid = true; - enableGnomeKeyring = true; - allowNullPassword = true; - updateWtmp = true; - startSession = true; - }; pki.certificates = [ (builtins.readFile ./horus-ca.pem) ]; wrappers = { fusermount.source = "${pkgs.fuse}/bin/fusermount"; diff --git a/modules/greetd/default.nix b/modules/greetd/default.nix index 06e4ec9..6b2f895 100644 --- a/modules/greetd/default.nix +++ b/modules/greetd/default.nix @@ -12,7 +12,7 @@ let style = builtins.readFile ./greetd.css; swaySession = pkgs.writeShellScript "sway-session" '' - ${pkgs.sway}/bin/sway --unsupported-gpu + ${config.programs.sway.package}/bin/sway --unsupported-gpu ''; steam-gamescope = diff --git a/users/erwin/home.nix b/users/erwin/home.nix index 36f25be..9d3811d 100644 --- a/users/erwin/home.nix +++ b/users/erwin/home.nix @@ -118,6 +118,7 @@ in starship.enable = true; sway = { enable = true; + package = pkgs.swayfx; lock-wallpaper = "${homeCfg.home.homeDirectory}/.wallpapers/river-2560.png"; output = { "DP-2" = {