greetd: Run session command from user's shell

This commit is contained in:
ItsDrike 2024-06-27 15:42:00 +02:00
parent 03d4c5e69a
commit a39d39ec1e
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0

View file

@ -16,6 +16,20 @@
sessionData = config.services.displayManager.sessionData.desktops; sessionData = config.services.displayManager.sessionData.desktops;
# Run the session / application using the appropriate shell configured for this user.
# This will make sure all of the environment variables are set before the WM session
# is started. This is very important, as without it, variables for things like qt theme
# will not be set, and applications executed by the WM will not be themed properly.
sessionWrapperScript = pkgs.writeShellScriptBin "tuigreet-session-wrapper" ''
set -euo pipefail
script_name="$0"
shell="$(getent passwd itsdrike | awk -F: '{print $NF}')"
command=("$@")
exec "$shell" -c 'exec "$@"' "$script_name" "''${command[@]}"
'';
defaultSession = { defaultSession = {
user = "greeter"; user = "greeter";
command = concatStringsSep " " [ command = concatStringsSep " " [
@ -28,6 +42,8 @@
"--theme ${tuiGreetTheme}" "--theme ${tuiGreetTheme}"
"--sessions '${sessionData}/share/wayland-sessions'" "--sessions '${sessionData}/share/wayland-sessions'"
"--xsessions '${sessionData}/share/xsessions'" "--xsessions '${sessionData}/share/xsessions'"
"--session-wrapper ${sessionWrapperScript}/bin/tuigreet-session-wrapper"
"--xsession-wrapper ${sessionWrapperScript}/bin/tuigreet-session-wrapper startx /usr/bin/env \"$@\""
]; ];
}; };
in { in {