neodotfiles/source/dmenu/scripts/dmenu_wall

49 lines
1.1 KiB
Text
Raw Normal View History

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