From 142a0ef7616c870e06850d266137a9799e09f8ea Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Sun, 8 Feb 2026 17:31:41 +0530 Subject: chore(home/wayland/pkgs/wayland-scripts): refactor --- home/wayland/pkgs/wayland-scripts/src/bin/cwall | 26 ++++++++++++------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'home/wayland/pkgs/wayland-scripts/src/bin/cwall') 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" -- cgit v1.2.3