From 8bf7a0d8b613fd487a73cbc7dbdae12b88d8f466 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Fri, 26 Apr 2024 13:17:22 -0400 Subject: [PATCH] sway: update random wallpaper script to assign different wallpapers per-monitor --- homeManagerModules/desktop/sway/randomWallpaper.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/homeManagerModules/desktop/sway/randomWallpaper.nix b/homeManagerModules/desktop/sway/randomWallpaper.nix index 2bfa2964..01a567ee 100644 --- a/homeManagerModules/desktop/sway/randomWallpaper.nix +++ b/homeManagerModules/desktop/sway/randomWallpaper.nix @@ -10,8 +10,11 @@ if [ -d "$directory" ]; then while true; do kill `pidof swaybg` - random_background=$(ls $directory/*.{png,jpg} | shuf -n 1) - ${pkgs.swaybg}/bin/swaybg -i $random_background & + monitor=`${config.wayland.windowManager.sway.package}/bin/swaymsg -t get_outputs -p | grep Output | awk '{print $2}'` + for m in ''${monitor[@]}; do + random_background=$(ls $directory/*.{png,jpg} | shuf -n 1) + ${pkgs.swaybg}/bin/swaybg -o $m -i $random_background & + done sleep 900 done fi