neodotfiles/config/rofi/scripts/rs_wall

51 lines
1.2 KiB
Text
Raw Normal View History

2024-06-23 22:50:38 +00:00
#!/usr/bin/env bash
# rs_wall - A simple screenshot menu script for rofi/dmenu/wofi
# Author: Clay Gomera (Drake)
2024-09-28 03:08:07 +00:00
# Dependencies: rofi, hyprpaper
2024-06-23 22:50:38 +00:00
############################
# Configuration Parameters #
############################
walldir="$XDG_PICTURES_DIR/Wallpapers" # wallpapers folder, change it to yours
########################
# Function Definitions #
########################
# Check for missing dependencies
CheckDependencies() {
local missing_deps=()
2024-09-28 03:08:07 +00:00
for dep in hyprpaper rofi; do
2024-06-23 22:50:38 +00:00
if ! command -v "$dep" &> /dev/null; then
missing_deps+=("$dep")
fi
done
if [ ${#missing_deps[@]} -ne 0 ]; then
echo "Missing dependencies: ${missing_deps[*]}"
exit 1
fi
}
####################
# Main Script Flow #
####################
# Check for dependencies
CheckDependencies
cd "$walldir" || exit 1
2024-07-26 17:43:09 +00:00
wallpaper=$(fd -p "$walldir" | $RUNNER -only-match -i -p "󰋩 Wallpaper Selector")
2024-06-23 22:50:38 +00:00
if [ -n "$wallpaper" ]; then
2024-07-26 17:43:09 +00:00
cp "$wallpaper" "$HOME/.config/hypr/wall/wall.png"
cp "$wallpaper" "$HOME/.config/hypr/wall/lock.png"
pidof hyprpaper && pkill hyprpaper
sleep 0.5
hyprpaper &
disown
2024-06-23 22:50:38 +00:00
else
exit 0
fi
exit 0