dotfiles/bin/wallpaper.sh

26 lines
641 B
Bash
Executable File

#!/bin/bash
# Built for sway with optional dependancy on swaybg for ease of setting
wallpapers_dir=~/.local/share/wallpapers
finder="rofi-dmenu Wallpaper"
cur_wallpaper="$HOME/.wallpaper"
# selection mode
if [ "$1" == "-s" ] ; then
cd "$wallpapers_dir"
selection=$(find -L -type f -printf '%P\n' | $finder)
if [ -n "$selection" ] ; then
# didnt exit, overwrite wallpaper
ln -sf "$wallpapers_dir/$selection" "$cur_wallpaper"
fi
fi
# check that available wallpaper exists
if [ ! -f "$cur_wallpaper" ] ; then
echo "No wallpaper found" && exit 1
fi
swaymsg output "*" bg "$cur_wallpaper" fill '#000000'