summaryrefslogtreecommitdiff
path: root/home/wayland/pkgs/wayland-scripts/src/bin/cwall
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2026-02-08 17:31:41 +0530
committersinanmohd <sinan@sinanmohd.com>2026-02-08 17:37:39 +0530
commit142a0ef7616c870e06850d266137a9799e09f8ea (patch)
treed0e1d4d86322b73df95961407fc1e489d199926a /home/wayland/pkgs/wayland-scripts/src/bin/cwall
parent50c4cb1db0323624f60a9aa8408ba5576d5eee64 (diff)
chore(home/wayland/pkgs/wayland-scripts): refactor
Diffstat (limited to 'home/wayland/pkgs/wayland-scripts/src/bin/cwall')
-rwxr-xr-xhome/wayland/pkgs/wayland-scripts/src/bin/cwall26
1 files changed, 12 insertions, 14 deletions
diff --git a/home/wayland/pkgs/wayland-scripts/src/bin/cwall b/home/wayland/pkgs/wayland-scripts/src/bin/cwall
index 6268390..7bdb13c 100755
--- a/home/wayland/pkgs/wayland-scripts/src/bin/cwall
+++ b/home/wayland/pkgs/wayland-scripts/src/bin/cwall
@@ -5,27 +5,26 @@ bgdesk="$bgroot/desktop"
bglock="$bgroot/lockscreen"
walldir="$HOME/pix/wall"
-die()
-{
- command -v notify-send > /dev/null &&
- notify-send " cwall" "$1"
+info() {
+ notify-send " cwall" "$1"
+ printf "\033[32;1m%b\033[0m\n" "$1"
+}
+die() {
+ notify-send " cwall" "err: $1"
printf "\033[31;1merr: %b\033[0m\n" "$1" 1>&2
exit "${2:-1}"
}
-usage()
-{
- echo 'Usage: cwall [wallpaper.img|directory]'
+usage() {
+ info 'Usage: cwall [wallpaper.img|directory]'
}
-mimetype()
-{
+mimetype() {
file --brief --dereference --mime-type "$1"
}
-randimg()
-{
+randimg() {
# usage: randbg dir
: "${1:?}"
maxattempts=10
@@ -60,8 +59,7 @@ randimg()
done
}
-updatewall()
-{
+updatewall() {
: "${1:?}"
rm -f "$bgdesk" "$bglock"
@@ -98,7 +96,7 @@ case "$(mimetype "$input")" in
die "no image file in $input"
fi
- updatewall "$img"
+ updatewall "$img" && info "Wallpaper updated to $img"
;;
*)
die "invalid input $input"