danth / stylix

System-wide colorscheming and typography for NixOS
https://stylix.danth.me/
MIT License
1.22k stars 159 forks source link

kde: hm failing to set wallpaper when not in plasma session #340

Open luna-skye opened 7 months ago

luna-skye commented 7 months ago

Using NixOS Unstable + Home Manager, with Plasma 6 installed but mostly running Hyprland, I still rely on a lot of KDE software and am letting stylix auto-enable targets.

When rebuilding a minimal stylix config (just image and polarity) from Hyprland, Home Manager throws an error about not being able to set the Plasma wallpaper and fails to switch to the new hm environment.

Disabling stylix.targets.kde.enable provides a workaround as expected, but at the cost of themes for Qt apps.

Rebuilding from a Plasma session succeeds.

Log

systemctl status info printed when hm fails

× home-manager-skye.service - Home Manager environment for skye
     Loaded: loaded (/etc/systemd/system/home-manager-skye.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Mon 2024-04-15 02:25:47 EDT; 9min ago
   Duration: 35min 11.102s
    Process: 167310 ExecStart=/nix/store/sjl004ksn059xz9yfhj7haap24jv3s09-hm-setup-env /nix/store/swn5kp3grkkinwvy1sfxbxki22kg4h1x-home-manager-generation (code=exited, status=255/EXCEPTION)
   Main PID: 167310 (code=exited, status=255/EXCEPTION)
         IP: 0B in, 0B out
        CPU: 455ms

Apr 15 02:25:47 luna hm-activate-skye[167310]: No change so reusing latest profile generation 247
Apr 15 02:25:47 luna hm-activate-skye[167310]: Creating home file links in /home/skye
Apr 15 02:25:47 luna hm-activate-skye[167310]: Activating onFilesChange
Apr 15 02:25:47 luna hm-activate-skye[167310]: Activating reloadSystemd
Apr 15 02:25:47 luna hm-activate-skye[167310]: Activating stylixLookAndFeel
Apr 15 02:25:47 luna hm-activate-skye[167665]: An error occurred while attempting to set the Plasma wallpaper:
Apr 15 02:25:47 luna hm-activate-skye[167665]: The name is not activatable
Apr 15 02:25:47 luna systemd[1]: home-manager-skye.service: Main process exited, code=exited, status=255/EXCEPTION
Apr 15 02:25:47 luna systemd[1]: home-manager-skye.service: Failed with result 'exit-code'.
Apr 15 02:25:47 luna systemd[1]: Failed to start Home Manager environment for skye.
trueNAHO commented 7 months ago

Related: https://github.com/danth/stylix/issues/254

danth commented 7 months ago

This has been mentioned before, but I can't find the comment to link to it.

This happens because the plasma tools try to connect to a service running in the Plasma session to change the wallpaper.

When Plasma isn't installed, this is not a problem since we detect that the tools aren't there and don't try to run the command.

Possible fixes could be:

rkuklik commented 2 months ago

Hello, it is quite annoying for home-manager to crash on every start, so I would like to remedy this situation. What would you say, @danth, if I added option (an enum) to KDE module to choose either not fail if wallpaper can't be set or shove the activation to a user systemd unit, defaulting to the first?