Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kde: fix plasma cli tools in activation #547

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rkuklik
Copy link

@rkuklik rkuklik commented Sep 7, 2024

KDE theming uses CLI tools which require D-Bus and Plasma session. Instead of breaking home-manager activation, this PR allows it to fail and introduces optional systemd unit to run after login.

Fixes #422, #350 and #340

Please note that the service (if enabled) is suboptimal, as it will continually restart even if not in KDE session. I am not good enough with systemd to fix this with confidence in my solution. Should be a non-issue though, given that it has to be explicitly enabled. Restarting is mandatory (in my opinion), because first activation fails with The name is not activable when loading wallpaper by id stylix and I don't want to resort to hacks like sleep 5s && set-wallpaper.

modules/kde/hm.nix Outdated Show resolved Hide resolved
@rkuklik
Copy link
Author

rkuklik commented Sep 9, 2024

@danth is there anything to change or is this fit for merge?

@rkuklik
Copy link
Author

rkuklik commented Sep 13, 2024

Hello @trueNAHO, I looked at other PRs and saw you were quite active. Is there anything more to do? I saw the push for decoupling wallpaper from other settings, but I would rather fix this before going into more refactoring.

@trueNAHO
Copy link
Collaborator

Is there anything more to do?

Unfortunately, I am unfamiliar with the KDE internals and what exactly is required on the Nix level. Consider waiting on @danth's review or pinging anyone who last touched the KDE module.

I saw the push for decoupling wallpaper from other settings

What push are you referring to?

but I would rather fix this before going into more refactoring.

I agree that it would be good to merge this PR prior to further refactoring.

@rkuklik
Copy link
Author

rkuklik commented Sep 16, 2024

I saw the push for decoupling wallpaper from other settings

What push are you referring to?

Roadmap in #534 lists support for multiple and/or optional wallpaper as goals for future.
I didn't mean push in the PR sense.

@rkuklik
Copy link
Author

rkuklik commented Sep 25, 2024

@danth is there anything I should change?

@hiibolt
Copy link

hiibolt commented Oct 12, 2024

@rkuklik This unfortunately does not always work. On my system, waiting for plasma-plasmashell.service was not sufficient.

Besides the improper timing, the service does however work wonderfully, amazing work~

I'm new to systemd and NixOS in general, but one such service that worked to wait on for me was my user's home-manager-<user> service. It likely is not optimal however.

hiibolt@abcd203

@rkuklik
Copy link
Author

rkuklik commented Oct 12, 2024

Thank you for review. For me, home-manager-<user> didn't work, as it starts before user even logs in. No idea what to target though.

@lordkekz
Copy link

lordkekz commented Oct 13, 2024

Hm, I just realized that waiting for home-manager-<user>.service is not going to work anyway, since not everyone runs (or can run) home-manager activation using the home-manager NixOS module.
When calling home-manager switch ... you won't have a corresponding service unit to wait on.

Maybe you can run this using some KDE Plasma mechanic, like autostart? Create a "hidden" .desktop file and have it run the missing stylix bits?
Or maybe there's some other plasma thing I just don't know about that can be used for this.

@hiibolt
Copy link

hiibolt commented Oct 13, 2024

Hm, I just realized that waiting for home-manager-<user>.service is not going to work anyway, since not everyone runs (or can run) home-manager activation using the home-manager NixOS module. When calling home-manager switch ... you won't have a corresponding service unit to wait on.

Maybe you can run this using some KDE Plasma mechanic, like autostart? Create a "hidden" .desktop file and have it run the missing stylix bits? Or maybe there's some other plasma thing I just don't know about that can be used for this.

Agreed, I do not think what worked on my system works on all systems by any means.

I am new to NixOS and Linux in general, but is there a way to programmatically start the service on the condition that the background services fails?

theobori added a commit to theobori/nixos-configuration that referenced this pull request Nov 1, 2024
Disabled stylix for KDE Plasma 6, see danth/stylix#547
Updated the documentation
@lordkekz
Copy link

Maybe you can run this using some KDE Plasma mechanic, like autostart? Create a "hidden" .desktop file and have it run the missing stylix bits? Or maybe there's some other plasma thing I just don't know about that can be used for this.

I finally got around to implement this, using what Plasma calls an "AutostartScript". It's basically a desktop entry in the autostart directory which has a special tag X-KDE-AutostartScript that tells Plasma to start it early. The X-KDE-AutostartScript is probably not required, since I noticed that plasma-manager is doing something similar without it.

I hope that this should work for all scenarios since it doesn't depend on the activation method.
I have tested it on NixOS 24.11 beta (with Plasma 6.2.3).

@rkuklik @hiibolt Would you be willing to try out my change and see if it works for your setups too?
Here's my change lordkekz@88fb769 (I rebased onto the current master btw)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kde: home-manager failing to set Plasma wallpaper, not connected to D-Bus server
4 participants