Hyprland-dotfiles/scripts/wallpaper.sh

38 lines
990 B
Bash
Raw Normal View History

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