fix(wallpaper): repaint monitors hotplugged after login

awww-daemon paints only the outputs present when `awww img` last ran and does
not repaint a monitor connected later, so it comes up on the daemon's black
fill — which a transparent foot then shows instead of the wallpaper. Add
`wallpaper-hotplug`: it watches Hyprland's event socket and re-runs `setbg`
(which pushes to all outputs) on each `monitoradded`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-21 09:33:15 +02:00
parent f533bbeb05
commit e4a8b07117
2 changed files with 19 additions and 0 deletions
+17
View File
@@ -17,6 +17,22 @@ let
[ -n "$1" ] && ln -sf "$(readlink -f "$1")" "$bgloc"
${pkgs.awww}/bin/awww img "$bgloc"
'';
# awww-daemon paints only the outputs present when `awww img` last ran and does
# not repaint a monitor hotplugged afterwards — it comes up on the fill color
# (black), and a transparent foot on it then shows that black, not the
# wallpaper. Watch Hyprland's event socket and re-push the wallpaper (setbg
# with no arg → all current outputs) on each monitor-add. Hyprland emits both
# `monitoradded` and `monitoraddedv2`; match only the former so setbg fires
# once. Runs as a Hyprland exec-once (see home.nix).
wallpaperHotplug = pkgs.writeShellScriptBin "wallpaper-hotplug" ''
sock="''${XDG_RUNTIME_DIR}/hypr/''${HYPRLAND_INSTANCE_SIGNATURE}/.socket2.sock"
${pkgs.socat}/bin/socat -u UNIX-CONNECT:"$sock" - | while IFS= read -r line; do
case "$line" in
"monitoradded>>"*) setbg ;;
esac
done
'';
in
{
programs.mpv = {
@@ -50,6 +66,7 @@ in
home.packages = with pkgs; [
setbg
wallpaperHotplug # re-push wallpaper to a hotplugged monitor (see comment above)
awww # wayland wallpaper daemon (setbg backend)
wl-clipboard # wl-copy, for the yank binds
imagemagick # `magick`: rotate/flip binds