diff --git a/home/programs/graphical/wms/hyprland/config/exec.nix b/home/programs/graphical/wms/hyprland/config/exec.nix index 72a61a8..b2e7126 100644 --- a/home/programs/graphical/wms/hyprland/config/exec.nix +++ b/home/programs/graphical/wms/hyprland/config/exec.nix @@ -1,8 +1,8 @@ {pkgs, ...}: { wayland.windowManager.hyprland.settings = { exec-once = [ - "${pkgs.systemd}/bin/systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" - "${pkgs.systemd}/bin/dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=$XDG_CURRENT_DESKTOP" + "${pkgs.systemd}/bin/systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP GTK_THEME QT_QPA_PLATFORMTHEME QT_STYLE_OVERRIDE" + "${pkgs.systemd}/bin/dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP GTK_THEME QT_QPA_PLATFORMTHEME QT_STYLE_OVERRIDE" ]; }; } diff --git a/system/roles/workstation/display/login/greetd.nix b/system/roles/workstation/display/login/greetd.nix index c366e87..21690d5 100644 --- a/system/roles/workstation/display/login/greetd.nix +++ b/system/roles/workstation/display/login/greetd.nix @@ -15,10 +15,20 @@ tuiGreetTheme = "'border=magenta;text=cyan;prompt=green;time=red;action=white;button=yellow;container=black;input=gray'"; sessionData = config.services.displayManager.sessionData.desktops; - sessionPaths = concatStringsSep ":" [ - "${sessionData}/share/xsessions" - "${sessionData}/share/wayland-sessions" - ]; + + # 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 = { user = "greeter"; @@ -29,8 +39,11 @@ "--remember-user-session" "--asterisks" "--greeting ${greetingMsg}" - "--sessions '${sessionPaths}'" "--theme ${tuiGreetTheme}" + "--sessions '${sessionData}/share/wayland-sessions'" + "--xsessions '${sessionData}/share/xsessions'" + "--session-wrapper ${sessionWrapperScript}/bin/tuigreet-session-wrapper" + "--xsession-wrapper ${sessionWrapperScript}/bin/tuigreet-session-wrapper startx /usr/bin/env \"$@\"" ]; }; in { @@ -52,7 +65,7 @@ in { # See: https://github.com/apognu/tuigreet/issues/68#issuecomment-1586359960 systemd.services.greetd.serviceConfig = { Type = "idle"; - StandardInputs = "tty"; + StandardInput = "tty"; StandardOutput = "tty"; StandardError = "journal"; TTYReset = true;