wal+autorandr: update wallpaper on config change

This commit is contained in:
Jez Cope 2023-06-06 08:58:34 +01:00
parent a62ad9d59f
commit ab45407c9b
1 changed files with 7 additions and 3 deletions

View File

@ -5,6 +5,9 @@ with lib;
let
cfg = config.programs.wal;
walCmd = pkgs.pywal + /bin/wal;
updateCmd = ''
${walCmd} -i ${cfg.background} --backend ${cfg.backend} -e -s -t
'';
shellSequences = "~/.cache/wal/sequences";
shellActivate = ''
@ -43,9 +46,8 @@ in {
activation = {
# Must be before onFilesChange because that's when other configs are reloaded
updateWalScheme =
lib.hm.dag.entryBetween [ "onFilesChange" ] [ "writeBoundary" ] ''
${walCmd} -i ${cfg.background} --backend ${cfg.backend} -e -s -t
'';
lib.hm.dag.entryBetween [ "onFilesChange" ] [ "writeBoundary" ]
updateCmd;
};
};
@ -55,5 +57,7 @@ in {
wayland.windowManager.sway = mkIf cfg.sway.enable {
config.output."*".bg = "${cfg.background} ${cfg.sway.bgMode}";
};
programs.autorandr.hooks.postswitch = { "update-wallpaper" = updateCmd; };
};
}