From c24305602751113b7a0d1a24017a7652d7d8859d Mon Sep 17 00:00:00 2001 From: Jakob Lechner Date: Sat, 21 Jun 2025 22:32:14 +0200 Subject: [PATCH] Use greetd to start sway --- modules/sway.nix | 29 ++++++++++++++++++++++++++--- users/jalr/modules/neo.nix | 16 +++++++++++++--- users/jalr/modules/sway/default.nix | 9 --------- 3 files changed, 39 insertions(+), 15 deletions(-) diff --git a/modules/sway.nix b/modules/sway.nix index 5dda16f..286fa6e 100644 --- a/modules/sway.nix +++ b/modules/sway.nix @@ -11,6 +11,29 @@ lib.mkIf (config.jalr.gui.enable && config.jalr.gui.desktop == "sway") { }; }; + services.greetd = { + enable = true; + settings = + let + command = pkgs.writeShellScript "sway-init" '' + systemctl --user import-environment PATH + systemctl --user restart xdg-desktop-portal.service + exec ${pkgs.sway}/bin/sway + ''; + user = "jalr"; + in + { + default_session = { + inherit command; + inherit user; + }; + initial_session = { + inherit command; + inherit user; + }; + }; + }; + hardware.graphics.enable = true; security.polkit.enable = true; @@ -26,9 +49,9 @@ lib.mkIf (config.jalr.gui.enable && config.jalr.gui.desktop == "sway") { icons.enable = true; portal = { enable = true; - extraPortals = with pkgs; [ - xdg-desktop-portal-wlr - xdg-desktop-portal-gtk + wlr.enable = true; + extraPortals = [ + pkgs.xdg-desktop-portal-gtk ]; xdgOpenUsePortal = true; }; diff --git a/users/jalr/modules/neo.nix b/users/jalr/modules/neo.nix index 9acef59..4d668d0 100644 --- a/users/jalr/modules/neo.nix +++ b/users/jalr/modules/neo.nix @@ -1,7 +1,17 @@ +let + xkb_layout = "de,de"; + xkb_variant = "neo,"; + xkb_options = "grp:win_space_toggle"; +in { home.sessionVariables = { - XKB_DEFAULT_LAYOUT = "de,de"; - XKB_DEFAULT_VARIANT = "neo,"; - XKB_DEFAULT_OPTIONS = "grp:win_space_toggle"; + XKB_DEFAULT_LAYOUT = xkb_layout; + XKB_DEFAULT_VARIANT = xkb_variant; + XKB_DEFAULT_OPTIONS = xkb_options; + }; + wayland.windowManager.sway.config.input."type:keyboard" = { + inherit xkb_layout; + inherit xkb_variant; + inherit xkb_options; }; } diff --git a/users/jalr/modules/sway/default.nix b/users/jalr/modules/sway/default.nix index 846c1ae..2ca9a9d 100644 --- a/users/jalr/modules/sway/default.nix +++ b/users/jalr/modules/sway/default.nix @@ -88,15 +88,6 @@ in _JAVA_AWT_WM_NONREPARENTING = "1"; }; - programs.fish.loginShellInit = '' - if [ -z $WAYLAND_DISPLAY ] && [ (tty) = /dev/tty1 ] - export XDG_SESSION_TYPE="wayland" # otherwise set to tty - set -e __HM_SESS_VARS_SOURCED - set -e __NIXOS_SET_ENVIRONMENT_DONE - exec systemd-cat -t sway dbus-run-session sway - end - ''; - wayland.windowManager.sway = { enable = true;