Hyprland-dotfiles/scripts/wallpaper-swww.sh

51 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/
2023-08-30 08:45:03 -04:00
cp $wallpaper ~/.cache/current_wallpaper.jpg
2023-08-21 05:38:06 -04:00
newwall=$(echo $wallpaper | sed "s|$HOME/wallpaper/||g")
# -----------------------------------------------------
# Set the new wallpaper
# -----------------------------------------------------
swww img $wallpaper --transition-step 20 --transition-fps=20
2023-08-28 07:33:53 -04:00
~/dotfiles/waybar/launch.sh
2023-08-21 05:38:06 -04:00
# -----------------------------------------------------
# Send notification
# -----------------------------------------------------
notify-send "Theme and Wallpaper updated" "With image $newwall"
echo "Done."
fi