#!/bin/bash wallpapers_dir=~/.local/share/wallpapers finder="rofi-dmenu Wallpaper" cd "$wallpapers_dir" if [ "$1" == "-s" ] ; then selection=$(find -L -type f -printf '%P\n' | $finder) if [ -n "$selection" ] ; then # didnt exit, overwrite wallpaper ln -sf "$wallpapers_dir/$selection" "$HOME/.wallpaper" fi fi # fill in wallpaper on each dispaly for display in $(swaymsg -t get_outputs | gojq '.[].name' | tr -d '"') do swaymsg output "$display" bg "$HOME/.wallpaper" fill '#000000' done