summaryrefslogtreecommitdiff
path: root/bmenu
blob: b31d3baa0d1b7d8b6128ebe09d4ce5854d26225f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash

set -e

backgrounds_dir=/home/$USER/.config/backgrounds
dmenu_config=$(bash ~/.config/dmenu.conf)

number_of_files=$(ls $backgrounds_dir | wc -l)

# Use dmenu to prompt the user to select a file
selected_file=$(ls $backgrounds_dir | sort | $dmenu_config -i -l $number_of_files -p "Select a wallpaper:")

# If the user selected a file, set it as the wallpaper
if [ -n "$selected_file" ]; then
    feh --bg-fill --no-fehbg "${backgrounds_dir}/${selected_file}"
    echo "feh --bg-fill --no-fehbg '${backgrounds_dir}/${selected_file}'"
fi