Hyprland-dotfiles/scripts/wallpaper-swww.sh

50 lines
1.8 KiB
Bash
Raw Normal View History

2023-08-21 05:38:06 -04:00
#!/bin/bash
# __ __ _ _
# \ \ / /_ _| | |_ __ __ _ _ __ ___ _ __
# \ \ /\ / / _` | | | '_ \ / _` | '_ \ / _ \ '__|
# \ V V / (_| | | | |_) | (_| | |_) | __/ |
# \_/\_/ \__,_|_|_| .__/ \__,_| .__/ \___|_|
# |_| |_|
#
# by Stephan Raabe (2023)
# -----------------------------------------------------
# -----------------------------------------------------
# Select wallpaper
# -----------------------------------------------------
selected=$(ls -1 ~/wallpaper | grep "jpg" | rofi -dmenu -p "Wallpapers")
if [ "$selected" ]; then
echo "Changing theme..."
# -----------------------------------------------------
# Update wallpaper with pywal
# -----------------------------------------------------
wal -q -i ~/wallpaper/$selected
# -----------------------------------------------------
# Get new theme
# -----------------------------------------------------
source "$HOME/.cache/wal/colors.sh"
# -----------------------------------------------------
# Copy color file to waybar folder
# -----------------------------------------------------
cp ~/.cache/wal/colors-waybar.css ~/dotfiles/waybar/
newwall=$(echo $wallpaper | sed "s|$HOME/wallpaper/||g")
# -----------------------------------------------------
# Set the new wallpaper
# -----------------------------------------------------
swww img $wallpaper --transition-step 20 --transition-fps=20
~/dotfiles/waybar/reload.sh
# -----------------------------------------------------
# Send notification
# -----------------------------------------------------
notify-send "Theme and Wallpaper updated" "With image $newwall"
echo "Done."
fi