neodotfiles/new-config/.config/rofi/scripts/rofi_wall
Clay Gomera 9f8ac8a84e updated
2023-02-25 12:12:09 -04:00

53 lines
1.6 KiB
Bash
Executable file

#!/usr/bin/env bash
# ***This script was made by Clay Gomera (Drake)***
# - Description: A simple wallpaper changer script
# - Dependencies: rofi, fd, feh
## MAIN VARIABLES AND COMMANDS ##
walldir="$HOME/Pictures/Wallpapers" # wallpapers folder, change it to yours, make sure that it ends with a /
cd "$walldir" || exit
## SELECT PICTURE FUNCTION ##
selectpic() {
wallpaper=$(fd -p "$walldir" | rofi -dmenu -i -p " 󰋩 Wallpaper Selector ")
if [ "$wallpaper" ]; then
chosenwall=$wallpaper
else
exit 0
fi
}
selectpic
## WALLPAPER SETTING OPTIONS ##
option1="󰉦 Fill"
option2="󱇃 Center"
option3="󰝤 Tile"
option4="󰻵 Fit"
options="$option1\n$option2\n$option3\n$option4\n$option5"
## MAIN ACTION ##
action=$(echo -e "$options" | rofi -dmenu -i -p " 󱇣 Chose the format ")
case "$action" in
$option1*)
pkill swaybg
swaybg -m fill -i "$chosenwall" &
echo -e "#!/bin/sh\nswaybg -m fill -i" $walldir/$chosenwall > "$HOME/.wbg"
chmod +x "$HOME/.wbg";;
$option2*)
pkill swaybg
swaybg -m center -i "$chosenwall" &
echo -e "#!/bin/sh\nswaybg -m center -i" $walldir/$chosenwall > "$HOME/.wbg"
chmod +x "$HOME/.wbg";;
$option3*)
pkill swaybg
swaybg -m tile -i "$chosenwall" &
echo -e "#!/bin/sh\nswaybg -m tile -i" $walldir/$chosenwall > "$HOME/.wbg"
chmod +x "$HOME/.wbg";;
$option4*)
pkill swaybg
swaybg -m fit -i "$chosenwall" &
echo -e "#!/bin/sh\nswaybg -m fit -i" $walldir/$chosenwall > "$HOME/.wbg"
chmod +x "$HOME/.wbg";;
esac
exit 0