summaryrefslogtreecommitdiff
path: root/walls/awww.sh
blob: 64f4edd3afb14ebe2b16f83ff21cb4a342521e81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash

XDG_PICTURES_DIR="${XDG_PICTURES_DIR:-$HOME/Pictures}"
XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
WALLPAPERS="$XDG_PICTURES_DIR/wallpapers/"
awwwarg="--transition-type any --transition-duration 0.85 --transition-fps 160 --transition-bezier 1,0.33,0.3,1"

# colors
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'

DELAY=1800

while true; do
    (while ! awww query; do awww-daemon; done) &
    wallpappath=$(find "$WALLPAPERS" | shuf -n 1)
    if ! [ $current_bg ]; then
        echo -e "${RED}current.bg not set, setting it to $wallpappath${NC}"
        echo $wallpappath > $XDG_CACHE_HOME/current.bg
        echo -e "${GREEN}Regenerating wallpappath${NC}"
        wallpappath=$(find "$WALLPAPERS" | shuf -n 1)
    fi
	current_bg="$(cat $XDG_CACHE_HOME/current.bg)"

    # wallust run --skip-sequences $(cat $XDG_CACHE_HOME/current.bg)
    # wallust run --backend kmeans --skip-sequences $(cat $XDG_CACHE_HOME/current.bg) & # using cache now
    awww img $current_bg $awwwarg
    wallust run --backend full --skip-sequences $(cat $XDG_CACHE_HOME/current.bg)
    # (sleep 0.1; pgrep -f wallust && wallust run --backend kmeans --skip-sequences $(cat $XDG_CACHE_HOME/current.bg)) &

	# tell hypr* where is bg
	echo "\$bg = $current_bg" > "$XDG_CONFIG_HOME/hypr/bg.conf"

	# reload hyprland
	hyprctl reload config-only &

	# reload hx
	pkill -USR1 hx
	pkill -USR1 kitty

    swaync-client --reload-css

	# gdbus call --session --dest com.mitchellh.ghostty --object-path /com/mitchellh/ghostty --method org.gtk.Actions.Activate reload-config [] [] &
	# kitten @ action load_config_file
	# kitty @ set-colors --all --configured ~/.config/kitty/colors.conf
	killall -SIGUSR1 kitty

    echo $wallpappath > $XDG_CACHE_HOME/current.bg
    # update hyprlock
    killall -SIGUSR2 hyprlock
 
	pywalfox update

	fcitx5-remote -r

    nice -n 20 wallust run --backend full --skip-templates --skip-sequences $wallpappath

    if awww query; then
        sleep $DELAY
    else
        echo -e "${RED}awww not running, skipping sleep - END${NC}"
        awww-daemon &
    fi
done