mirror of
https://github.com/wizbright/waybox.git
synced 2025-10-28 05:40:18 -04:00
Update for the new socket location of hyprpaper 0.7
This commit is contained in:
parent
3f0814fd56
commit
2643966144
1 changed files with 12 additions and 7 deletions
|
|
@ -37,21 +37,26 @@ get_random_wallpaper()
|
|||
}
|
||||
|
||||
load_wallpaper() {
|
||||
if (which hyprpaper && which socat && which wayland-info) >/dev/null 2>&1; then
|
||||
uses_wayland_info=0
|
||||
if (which hyprpaper && which socat && (test "$uses_wayland_info" = "0" || which wayland-info)) >/dev/null 2>&1; then
|
||||
hyprpaper &
|
||||
HYPRPAPER_SOCKET=/tmp/hypr/.hyprpaper.sock
|
||||
HYPRPAPER_SOCKET="${XDG_RUNTIME_DIR:-"/run/user/$(id -u)"}"/hypr/.hyprpaper.sock
|
||||
# Change the wallpaper every hour
|
||||
while test -S $HYPRPAPER_SOCKET; do
|
||||
#current_output=$(wayland-info -i wl_output | \
|
||||
# grep 'name:' | tail -n 1 | cut -d : -f 2 | tr -d ' ')
|
||||
while test -S "$HYPRPAPER_SOCKET"; do
|
||||
if test "$uses_wayland_info" != "0";
|
||||
then
|
||||
current_output=$(wayland-info -i wl_output | \
|
||||
grep 'name:' | tail -n 1 | cut -d : -f 2 | tr -d ' ')
|
||||
fi
|
||||
random_wallpaper="$(get_random_wallpaper)"
|
||||
for cmd in "preload $random_wallpaper" \
|
||||
"wallpaper $current_output,$random_wallpaper" \
|
||||
'unload all';
|
||||
do
|
||||
printf "$cmd" | socat UNIX-CONNECT:$HYPRPAPER_SOCKET -
|
||||
printf "$cmd" | socat UNIX-CONNECT:"$HYPRPAPER_SOCKET" -
|
||||
done
|
||||
[ $? -eq 0 ] && sleep 60m
|
||||
[ $? -ne 0 ] && rm -f $HYPRPAPER_SOCKET
|
||||
sleep 60m
|
||||
done
|
||||
elif which swaybg >/dev/null 2>&1; then
|
||||
get_random_wallpaper | xargs swaybg -c '#303030' -m fill -i &
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue