hyprland-dotfiles/scripts/wallpaper.sh

38 lines
989 B
Bash
Raw Normal View History

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