neodotfiles/user/.local/bin/rs_wall
2023-10-26 15:56:17 -04:00

28 lines
1.1 KiB
Bash
Executable file

#!/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
wallpaper=$(fd -p "$walldir" | $RUNNER -l 5 -i -p "[󰋩 Wallpaper Selector]  ")
if [ -n "$wallpaper" ]; then
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
else
exit 1
fi
exit 0