Hyprland-dotfiles/scripts/wallpaper.sh

38 lines
990 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")
2023-09-18 16:13:15 -04:00
sleep 1
2023-04-11 04:27:01 -04:00
# Send notification
2023-09-20 07:56:57 -04:00
notify-send "Colors and Wallpaper updated" "with image $newwall"
2023-04-11 04:27:01 -04:00
echo "Done."
2023-04-03 10:20:44 -04:00
fi