neodotfiles/source/dmenu/scripts/dmenu_wall
2024-08-13 09:07:56 -04:00

48 lines
1.1 KiB
Bash
Executable file

#!/usr/bin/env bash
# *** Script by Clay Gomera (Drake) ***
# Description: A dmenu script to set the wallpaper on X using feh
# Dependencies: dmenu, fd, feh
# Directory containing wallpapers
walldir="$XDG_PICTURES_DIR/Wallpapers"
# Change to wallpaper directory or exit if it fails
cd "$walldir" || exit
# Define wallpaper options for feh
option1="Fill"
option2="Center"
option3="Tile"
option4="Max"
option5="Scale"
options="$option1\n$option2\n$option3\n$option4\n$option5"
# Prompt user to select a wallpaper
wallpaper=$(fd -p ./ | dmenu -i -p "󰋩 Select a wallpaper")
if [ -z "$wallpaper" ]; then
exit 0
fi
# Store the selected wallpaper
chosenwall="$wallpaper"
# Prompt user to select a wallpaper format
action=$(echo -e "$options" | dmenu -i -p " Choose 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