neodotfiles/new-config/.config/rofi/scripts/rofi_wall

54 lines
1.5 KiB
Text
Raw Normal View History

2023-02-25 16:12:09 +00:00
#!/usr/bin/env bash
# ***This script was made by Clay Gomera (Drake)***
# - Description: A simple wallpaper changer script
2023-03-31 13:35:01 +00:00
# - Dependencies: rofi, fd, swaybg
2023-02-25 16:12:09 +00:00
2023-03-31 13:35:01 +00:00
## MENU PROMPT ##
menu="rofi -dmenu -i -p"
2023-02-25 16:12:09 +00:00
2023-03-31 13:35:01 +00:00
## WALLPAPER DIRECTORY ##
walldir="$HOME/Pictures/Wallpapers" # wallpapers folder, change it to yours
2023-02-25 16:12:09 +00:00
## WALLPAPER SETTING OPTIONS ##
option1="󰉦 Fill"
option2="󱇃 Center"
option3="󰝤 Tile"
option4="󰻵 Fit"
2023-03-31 13:35:01 +00:00
options="$option1\n$option2\n$option3\n$option4"
## SELECT PICTURE ##
cd "$walldir" || exit 1
wallpaper=$(fd -p "$walldir" | $menu " 󰋩 Wallpaper Selector ")
if [ "$wallpaper" ]; then
chosenwall=$wallpaper
else
exit 0
fi
2023-02-25 16:12:09 +00:00
## MAIN ACTION ##
2023-03-31 13:35:01 +00:00
action=$(echo -e "$options" | $menu " 󱇣 Chose the format ")
2023-02-25 16:12:09 +00:00
case "$action" in
$option1*)
pkill swaybg
swaybg -m fill -i "$chosenwall" &
2023-03-31 13:35:01 +00:00
echo -e "#!/bin/sh\nswaybg -m fill -i $walldir/$chosenwall" > "$HOME/.wbg"
2023-02-25 16:12:09 +00:00
chmod +x "$HOME/.wbg";;
$option2*)
pkill swaybg
swaybg -m center -i "$chosenwall" &
2023-03-31 13:35:01 +00:00
echo -e "#!/bin/sh\nswaybg -m center -i $walldir/$chosenwall" > "$HOME/.wbg"
2023-02-25 16:12:09 +00:00
chmod +x "$HOME/.wbg";;
$option3*)
pkill swaybg
swaybg -m tile -i "$chosenwall" &
2023-03-31 13:35:01 +00:00
echo -e "#!/bin/sh\nswaybg -m tile -i $walldir/$chosenwall" > "$HOME/.wbg"
2023-02-25 16:12:09 +00:00
chmod +x "$HOME/.wbg";;
$option4*)
pkill swaybg
swaybg -m fit -i "$chosenwall" &
2023-03-31 13:35:01 +00:00
echo -e "#!/bin/sh\nswaybg -m fit -i $walldir/$chosenwall" > "$HOME/.wbg"
2023-02-25 16:12:09 +00:00
chmod +x "$HOME/.wbg";;
esac
exit 0