summaryrefslogtreecommitdiff
path: root/dot-config/rofi/scripts/rofi_wallpaper
blob: b0be100040cea4ccea64af57c52e0bc9877fa3b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bash

#CM_LAUNCHER=rofi
DIR="$HOME/.config/rofi"
RASI="$DIR/wallpaper.rasi"
mesg="Please Select a Wallpaper"

# Define the directory to list files from
directory="$HOME/Pictures/wallpapers"

# Use `ls` to list the files in the directory
files=$(ls $directory)

# Use rofi to display the list of files
chosen=$(echo $files | tr " " "\n" | rofi -dmenu -theme ${RASI} -separator-style plain)

# Check if a file was selected
if [ -n "$chosen" ]; then
    # Run a command with the selected file as an argument
    feh $chosen
fi