~freed00m/dotfiles

dotfiles/.config/systemd/user/sway-wallpaper-change.sh -rwxr-xr-x 401 bytes
4d7e0e24Antonin Dach Mon Dec 5 10:58:40 PM CET 2022 3 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh
#
#  Author (c)  Antonín Dach <dach@protonmail.com>
#
# This file will select random wallpaper from single directory

set -e

DIRNAME=$(xdg-user-dir PICTURES)/Wallpapers
TMPDIR="/tmp/sway"
TMPPIC="$TMPDIR/wall"

mkdir -p "$TMPDIR"

PIC=$(find "$DIRNAME" -type f | shuf -n 1 --random-source=/dev/urandom)
ln -s -f "$PIC" "$TMPPIC"

swaymsg -r -q output "*" bg /tmp/sway/wall fit > /dev/null