nix-community/plasma-manager

suggestion: add option to restart `plasma-plasmashell` after applying the module

Closed this issue · 5 comments

To address the point

What's not well supported (at the moment)
Real-time updates of configuration without having to log out and back in

I added the following snippet to my config module that wraps plasma-manager to imperatively reload the new plasmashell config, it reloads the panels and wallpaper without closing any of the running apps, so I think adding it as an off by default option won't harm anyone.

{
  home.activation.restartPlasmaShell =
    config.lib.dag.entryAfter ["reloadSystemd"]
    ''/run/current-system/sw/bin/systemctl restart --user plasma-plasmashell'';
}

If you're okay with adding this to the module I can create a PR for it, we can also decide on some checks to do before first to avoid unnecessary restarts.

This can be suggested in the README instead of adding it as an option as well.

I'm not sure this will work in cases where the activation is activated when plasma is not running (the activation would fail I think, but I haven't yet tested). Making some changes to the activation it's probably a way to fix this though. I'm also pretty sure that there's still quite a lot of plasma settings which would still need to log out and in again to take effect, but it would be better than nothing. I think adding to the README is better to start with unless I am wrong about these two things, but I at the very least am open to adding a mention of it there :)

From my testing, it doesn't really work that well. For example, when using a panel with "fit" instead of fill, it gets stretched after the activation for some reason, and it is not really updating the panels.

I pretty much only add plasmoids or change minor plasmoid config in my panels (which are generated through a text template of ~/.config/plasma-org.kde.plasma.desktop-appletsrc, not plasma-manager), and this has served me well for this use case but looks like it's pretty limited for general usage. Sorry for wasting your time with this.

and @magnouvean for this

I'm not sure this will work in cases where the activation is activated when plasma is not running

it can be if systemctl --user is-active plasma-plasmashell; then systemctl --user restart plasma-plasmashell; fi instead, i think this'll be more robust.

It shouldn't work with plasma-manager, since it updates the panels with a plasma script. It could work if the script ran in the activation, but I don't know if it is the best idea

Yeah I think I have tried running the desktop-scripts on activation, but that was a great challenge. It wasn't as simple as just running the scripts because it seems like activation scripts are in some way isolated from the rest of the system, so it didn't have access to stuff like dbus and the scripts wouldn't run (though it might be possible to get access in some way, since there is a dbus module for home-manager).
The suggestions from @janw4ld with the updated command would probably solve the issue with the activation crashing when plasma is not running though, but I think that since it doesn't work all that well with plasma-manager as a whole that it doesn't fit that well in the README. It's a good suggestion nonetheless and there's a good chance that it works well enough for some use-cases :). Closing this for now