programs.i3status-rust: reload on config change (#4466)

Adds automatic reloading of i3status-rust on config change.
This is done via sending SIGUSR2, which is now supported since [v0.20.0](https://github.com/greshake/i3status-rust/blob/master/NEWS.md#new-blocks-and-features-21)

The previous method of attempting to restart i3 in its entirety didn't work at least on my system, and is now overkill anyways.
This commit is contained in:
Florian Peter 2023-09-18 14:25:42 +01:00 committed by GitHub
parent d9b88b4352
commit e63a6b3479
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -246,11 +246,8 @@ in {
xdg.configFile = mapAttrs' (cfgFileSuffix: cfgBar: xdg.configFile = mapAttrs' (cfgFileSuffix: cfgBar:
nameValuePair ("i3status-rust/config-${cfgFileSuffix}.toml") ({ nameValuePair ("i3status-rust/config-${cfgFileSuffix}.toml") ({
onChange = mkIf config.xsession.windowManager.i3.enable '' onChange = ''
i3Socket="''${XDG_RUNTIME_DIR:-/run/user/$UID}/i3/ipc-socket.*" ${pkgs.procps}/bin/pkill -u $USER -USR2 i3status-rs || true
if [[ -S $i3Socket ]]; then
${config.xsession.windowManager.i3.package}/bin/i3-msg -s $i3Socket restart >/dev/null
fi
''; '';
source = settingsFormat.generate ("config-${cfgFileSuffix}.toml") ({ source = settingsFormat.generate ("config-${cfgFileSuffix}.toml") ({