neodotfiles/config/rofi/scripts/rs_wall
2024-09-27 23:08:07 -04:00

50 lines
1.2 KiB
Bash
Executable file

#!/usr/bin/env bash
# rs_wall - A simple screenshot menu script for rofi/dmenu/wofi
# Author: Clay Gomera (Drake)
# Dependencies: rofi, hyprpaper
############################
# Configuration Parameters #
############################
walldir="$XDG_PICTURES_DIR/Wallpapers" # wallpapers folder, change it to yours
########################
# Function Definitions #
########################
# Check for missing dependencies
CheckDependencies() {
local missing_deps=()
for dep in hyprpaper rofi; do
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
wallpaper=$(fd -p "$walldir" | $RUNNER -only-match -i -p "󰋩 Wallpaper Selector")
if [ -n "$wallpaper" ]; then
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
else
exit 0
fi
exit 0