neodotfiles/user/.local/bin/rs_wall

29 lines
1.1 KiB
Text
Raw Normal View History

2023-10-21 13:44:39 +00:00
#!/usr/bin/env bash
# ***This script was made by Clay Gomera (Drake)***
# - Description: A simple wallpaper changer script for rofi/dmenu/wofi
# - Dependencies: {rofi||dmenu||wofi}, fd, swaybg
## WALLPAPER DIRECTORY ##
walldir="$XDG_PICTURES_DIR/Wallpapers" # wallpapers folder, change it to yours
## SELECT PICTURE ##
cd "$walldir" || exit 1
2023-10-26 19:56:17 +00:00
wallpaper=$(fd -p "$walldir" | $RUNNER -l 5 -i -p "[󰋩 Wallpaper Selector]  ")
2023-10-21 13:44:39 +00:00
if [ -n "$wallpaper" ]; then
2023-10-25 11:20:57 +00:00
if [[ "$wallpaper" == *.jpg ]]; then
rm -f "$HOME/.config/sway/wallpaper/"*
cp "$wallpaper" "$HOME/.config/sway/wallpaper/background.jpg"
cp "$wallpaper" "$HOME/.config/sway/wallpaper/locked.jpg"
swaymsg output \* bg "$HOME/.config/sway/wallpaper/background.jpg" fill
elif [[ "$wallpaper" == *.png ]]; then
rm -f "$HOME/.config/sway/wallpaper/"*
cp "$wallpaper" "$HOME/.config/sway/wallpaper/background.png"
cp "$wallpaper" "$HOME/.config/sway/wallpaper/locked.png"
swaymsg output \* bg "$HOME/.config/sway/wallpaper/background.png" fill
fi
2023-10-21 13:44:39 +00:00
else
2023-10-25 11:20:57 +00:00
exit 1
2023-10-21 13:44:39 +00:00
fi
exit 0