summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuleyman Farajli <suleyman@farajli.net>2025-10-28 14:24:27 +0400
committerSuleyman Farajli <suleyman@farajli.net>2025-10-28 14:24:27 +0400
commita88661eb6c00f87926c210123ef050c483c72921 (patch)
tree968956529af6920194e50f8d185c415f632e65b8
parent0c8e14a53412b9fb9a01684f49ca0bf148d593e5 (diff)
feat(swall): create symlink pointed to the current wallpaper
-rwxr-xr-xscripts/gui/swall11
1 files changed, 8 insertions, 3 deletions
diff --git a/scripts/gui/swall b/scripts/gui/swall
index b180381..6b56057 100755
--- a/scripts/gui/swall
+++ b/scripts/gui/swall
@@ -10,7 +10,9 @@ options:
-c Remove the current wallpaper
-h Print this message and exit
-NOTE: default directory is ~/.config/wallpapers
+NOTE: default directory is ~/.local/share/wallpapers
+A symlink at ~/.config/wallpapers/current is created pointing to the selected wallpaper.
+
EOF
exit 0
@@ -24,7 +26,7 @@ elif [ "${#}" != 1 ] && [ "${#}" != 2 ]; then
invalid_use
fi
-while getopts "hcd:" option; do
+while getopts "hcld:" option; do
case "${option}" in
c) run --reload-compositor "xwallpaper --clear" ;;
@@ -58,4 +60,7 @@ fi
[ -z "${image}" ] && err "No image file found"
-run "xwallpaper --zoom ${image}" "${image}"
+SYMLINK="${XDG_CONFIG_HOME:-$HOME/.config}/wallpaper/current"
+mkdir -p "$(dirname "${SYMLINK}")" && \
+ ln -sf "${image}" "${SYMLINK}" && \
+ run "xwallpaper --zoom ${image}" "${image}"