Hyprland-dotfiles/scripts/wallpaper.sh

37 lines
977 B
Bash
Raw Normal View History

2023-03-24 10:31:45 -04:00
#!/bin/bash
# __ __ _ _
# \ \ / /_ _| | |_ __ __ _ _ __ ___ _ __
# \ \ /\ / / _` | | | '_ \ / _` | '_ \ / _ \ '__|
# \ V V / (_| | | | |_) | (_| | |_) | __/ |
# \_/\_/ \__,_|_|_| .__/ \__,_| .__/ \___|_|
# |_| |_|
#
# by Stephan Raabe (2023)
# -----------------------------------------------------
# Select wallpaper
2023-04-11 09:42:44 -04:00
selected=$(ls -1 ~/wallpaper | grep "jpg" | rofi -dmenu -p "Wallpapers")
2023-03-24 10:31:45 -04:00
2023-04-03 10:20:44 -04:00
if [ "$selected" ]; then
2023-04-11 04:27:01 -04:00
echo "Changing theme..."
2023-04-03 10:20:44 -04:00
# Update wallpaper with pywal
wal -q -i ~/wallpaper/$selected
2023-03-24 10:31:45 -04:00
2023-04-03 10:20:44 -04:00
# Wait for 1 sec
sleep 1
2023-03-24 10:31:45 -04:00
2023-04-03 10:20:44 -04:00
# Reload qtile to color bar
qtile cmd-obj -o cmd -f reload_config
2023-04-11 04:27:01 -04:00
# Get new theme
source "$HOME/.cache/wal/colors.sh"
newwall=$(echo $wallpaper | sed "s|$HOME/wallpaper/||g")
# Send notification
notify-send "Theme and Wallpaper updated" "With image $newwall"
echo "Done."
2023-04-03 10:20:44 -04:00
fi