neodotfiles/user/.config/suckless/dmenu/scripts/dmenu_wall

44 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
# - Dependencies: dmenu, fd, feh
## MAIN VARIABLES AND COMMANDS ##
walldir="Pictures/Wallpapers"
cd "$walldir" || exit
## SELECT PICTURE FUNCTION ##
selectpic() {
wallpaper=$(fd -p "$walldir" | dmenu -i -l 10 -nb \#1d2021 -nf \#fbf1c7 -sb \#cc241d -sf \#fbf1c7 -p "select a wallpaper:")
if [ "$wallpaper" ]; then
chosenwall=$wallpaper
else
exit 0
fi
}
selectpic
## WALLPAPER SETTING OPTIONS ##
option1="fill"
option2="center"
option3="tile"
option4="max"
option5="scale"
options="$option1\n$option2\n$option3\n$option4\n$option5"
## MAIN ACTION ##
action=$(echo -e "$options" | dmenu -i -l 5 -nb \#1d2021 -nf \#fbf1c7 -sb \#cc241d -sf \#fbf1c7 -p "chose the format:")
case "$action" in
$option1*)
feh --bg-fill "$chosenwall";;
$option2*)
feh --bg-center "$chosenwall";;
$option3*)
feh --bg-tile "$chosenwall";;
$option4*)
feh --bg-max "$chosenwall";;
$option5*)
feh --bg-scale "$chosenwall";;
esac
exit 0