summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSüleyman Fərəcli <suleyman@farajli.net>2025-06-18 00:39:02 +0400
committerGitHub <noreply@github.com>2025-06-18 00:39:02 +0400
commit1eb90cf48629b8dfc0182cbe38b34c8082f4dc40 (patch)
treecf16ea2a5672cc8e1fc5ba97bdbc1396b485bbe7
parentc583f7d1c796bd4d82572cb3dd0caa52c8b4ecbf (diff)
parent0495f17898e621b5b7199b20d2ee28d2841a5a2a (diff)
Merge pull request #8 from sfarajli/dev
Dev
-rw-r--r--Makefile6
-rw-r--r--config/lf/lfrc1
-rw-r--r--config/x11/xinitrc11
-rwxr-xr-xdep.sh6
-rwxr-xr-xscripts/br18
-rwxr-xr-xscripts/nsend21
-rwxr-xr-xscripts/qw50
-rwxr-xr-xscripts/sdev39
-rwxr-xr-xscripts/shot53
-rwxr-xr-xscripts/slib99
-rwxr-xr-xscripts/slight54
-rwxr-xr-xscripts/svol56
-rwxr-xr-xscripts/swall48
13 files changed, 226 insertions, 236 deletions
diff --git a/Makefile b/Makefile
index 9dbdcf1..869318c 100644
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,7 @@ GITCONFIG = $(HOME)/.gitconfig
COPY = cp -r
LINK = ln -sf
-all: config scripts directory depcheck
+all: config scripts directory check
full: config scripts git directory desktop
@@ -84,7 +84,7 @@ $(DWM) $(ST) $(DMENU) $(SLSTATUS):
tar -xf $<
cd $@; PREFIX=~/.local make install
-depcheck:
+check:
@-./dep.sh
dist: clean
@@ -100,4 +100,4 @@ clean:
$(DMENU) $(DMENU).tar.gz \
$(SLSTATUS) $(SLSTATUS).tar.gz
-.PHONY: all config desktop scripts server arch-linux directory full depcheck
+.PHONY: all config desktop scripts server arch-linux directory full check
diff --git a/config/lf/lfrc b/config/lf/lfrc
index 8f3b2ac..1b50065 100644
--- a/config/lf/lfrc
+++ b/config/lf/lfrc
@@ -40,6 +40,7 @@ set rulerfmt "\033[32;1;7m"
set promptfmt "\033[48;1;234m %w/%f"
+#FIXME: Doesn't overwrite some files
cmd trash ${{
mkdir -p ~/.trash
if [ -z "$fs" ]; then
diff --git a/config/x11/xinitrc b/config/x11/xinitrc
index b90cd9e..3cf201f 100644
--- a/config/x11/xinitrc
+++ b/config/x11/xinitrc
@@ -17,12 +17,13 @@ if [ -d /etc/X11/xinit/xinitrc.d ] ; then
unset f
fi
-setxkbmap -option "caps:ctrl_modifier" # change caps_lock to ctrl
-xset r rate 300 50 # increase cursor speed
-xset s off && xset -dpms # disable screen blackening
-xgamma -gamma 0.8 # change gamma
-swall # set wallpaper
dunst &
picom &
+setxkbmap -option "caps:ctrl_modifier" # change caps_lock to ctrl
slstatus &
+swall # set wallpaper
+xgamma -gamma 0.8 # change gamma
+xset r rate 300 50 # increase cursor speed
+xset s off && xset -dpms # disable screen blackening
+
exec dwm
diff --git a/dep.sh b/dep.sh
index ba57fac..865a5be 100755
--- a/dep.sh
+++ b/dep.sh
@@ -1,7 +1,8 @@
#!/bin/sh
-# Format for entries `program,alternative_program:output_message`
-# `alternative_program` and `message` are optional
+# Check if programs are installed on the system.
+# Format for entries `program,alternative_program:output_message`,
+# `alternative_program` and `message` are optional.
check() {
fail=0
[ "${1}" = "-l" ] && { ISLIB=1; shift;} || ISLIB=0
@@ -39,6 +40,7 @@ check \
picom \
qutebrowser \
scrot \
+ setxkbmap \
startx:"xorg-xinit is missing" \
sxiv,nsxiv \
vim,nvim \
diff --git a/scripts/br b/scripts/br
index fb07592..6802b75 100755
--- a/scripts/br
+++ b/scripts/br
@@ -1,5 +1,7 @@
#!/bin/sh
+. slib
+
help() {
cat << EOF
${0}: Open links from bookmarks through dmenu
@@ -9,13 +11,8 @@ options:
NOTE: bookmarks file is located at ~/.config/sites/bookmarks
EOF
-}
-err() {
- for line in "${@}"; do
- echo "${line}" >&2
- done
- exit 1
+exit 0
}
alias dmenucmd="dmenu -bw 1 -c -g 1 -l 25"
@@ -24,21 +21,22 @@ alias dmenucmd="dmenu -bw 1 -c -g 1 -l 25"
if [ "${#}" -eq 0 ]; then
+ # FIXME: Use XDG_CONFIG
link_file="${HOME}/.config"/sites/bookmarks.txt
- command -v dmenu > /dev/null 2>&1 || err "${0}: dmenu must be installed"
+ check_program "dmenu"
[ -z "${XDG_HOME_CONFIG}" ] || link_file="${XDG_HOME_CONFIG}"/sites/bookmarks.txt
- [ -e "${link_file}" ] || err "${0}: Couldn't find bookmarks file"
+ [ -e "${link_file}" ] || err "Couldn't find bookmarks file"
link=$(< "${link_file}" dmenucmd)
[ -z "${link}" ] || "${browser}" "${link}"
elif [ "${#}" -eq 1 ]; then
- [ "${1}" = "-h" ] && help && exit 0
+ [ "${1}" = "-h" ] && help
"${browser}" "${1}"
else
- err "${0}: Invalid usage" "Try '${0} -h' for help."
+ invalid_use
fi
diff --git a/scripts/nsend b/scripts/nsend
index b8f9a00..7337b4d 100755
--- a/scripts/nsend
+++ b/scripts/nsend
@@ -1,5 +1,7 @@
#!/bin/sh
+. slib
+
help() {
cat << EOF
${0}: Wrapper script to send notifications
@@ -9,29 +11,22 @@ options:
-s [Msg] Send Msg Without Name
-h Print this message and exit
EOF
-}
-err() {
- for line in "${@}"; do
- echo "${line}" >&2
- done
- exit 1
+exit 0
}
-if ! command -v notify-send > /dev/null 2>&1; then
- err "${0}: dunst must be installed"
-fi
+check_program "notify-send" "dunst must be installed"
case "${1}" in
"-s")
- [ ${#} -gt 3 ] && err "${0}: Invalid usage" "Try '${0} -h' for help."
+ [ "${#}" -gt 3 ] && invalid_use
- notify-send "${2}" "${3}" > /dev/null 2>&1 || err "${0}: Failed to send notification"
+ run "notify-send ${2} ${3}"
exit 0
;;
-"-h") help; exit 0 ;;
+"-h") help ;;
-*) err "${0}: Invalid usage" "Try '${0} -h' for help." ;;
+*) invalid_use ;;
esac
diff --git a/scripts/qw b/scripts/qw
index 6732ca8..a0d5181 100755
--- a/scripts/qw
+++ b/scripts/qw
@@ -1,5 +1,7 @@
#!/bin/sh
+. slib
+
help() {
cat << EOF
${0}: Qemu Wrapper, very simple script for abriviating \
@@ -10,53 +12,31 @@ options:
-r [input.iso] run input.iso
-x [input.qcow2] run input.qcow2
EOF
-}
-
-err() {
- for line in "${@}"; do
- echo "${line}" >&2
- done
- exit 1
-}
-
-run() {
- if ! ${1} > /dev/null 2>&1; then
- err "${2}"
- fi
- [ -n "${3}" ] && echo "${3}"
- exit 0
+exit 0
}
-if ! command -v qemu-img > /dev/null 2>&1 || \
- ! command -v qemu-system-x86_64 > /dev/null 2>&1; then
- err "${0}: qemu must be properly installed"
-fi
+check_program "qemu-img"
+check_program "qemu-system-x86_64"
-if [ $# != 2 ] && [ $# != 1 ]; then
- err "${0}: Invalid usage" "Try '${0} -h' for help."
-fi
+[ $# != 2 ] && [ $# != 1 ] && invalid_use
while getopts "cr:x:h" option ;do
case "${option}" in
- c)
- run "qemu-img create -f qcow2 Image.img 10G" \
- "${0}: Failed to create Image.img"
- ;;
+ c) run "qemu-img create -f qcow2 Image.img 10G" ;;
+
+ x) run "qemu-system-x86_64 -drive file=${OPTARG},format=qcow2 -enable-kvm" ;;
+
r)
run "qemu-system-x86_64 -enable-kvm -cdrom ${OPTARG} \
- -boot menu=on -drive file=Image.img -m 4G" \
- "${0}: Failed to run image"
- ;;
- x)
- run "qemu-system-x86_64 -drive file=${OPTARG},format=qcow2 -enable-kvm" \
- "${0}: Failed to run image"
+ -boot menu=on -drive file=Image.img -m 4G"
;;
- h) help; exit 0;;
+ h) help ;;
- *) err "Try '${0} -h' for help." ;;
+ *) invalid_use -h ;;
esac
done
-err "${0}: Invalid usage" "Try '${0} -h' for help."
+# Unreachable
+invalid_use
diff --git a/scripts/sdev b/scripts/sdev
index c53ce93..22c1af5 100755
--- a/scripts/sdev
+++ b/scripts/sdev
@@ -1,5 +1,7 @@
#!/bin/sh
+. slib
+
help() {
cat << EOF
${0}: Disable and Enable devices
@@ -13,18 +15,13 @@ options:
Note: Nondescriptive inputs may disable (or enable) unwanted devices.
EOF
-}
-err() {
- for line in "${@}"; do
- echo "${line}" >&2
- done
- exit 1
+exit 0
}
get_id() {
if ! dev=$(xinput list --name-only | grep -i -m1 "${1}" ); then
- err "${0}: Couldn't get device"
+ err "Couldn't get device"
fi
id="${dev#∼ }"
}
@@ -33,7 +30,7 @@ xenable() {
echo "${id}"
if ! xinput enable "${1}" > /dev/null 2>&1; then
- err "${0}: Failed to enable dev."
+ err "Failed to enable dev."
else
exit 0
fi
@@ -43,22 +40,24 @@ xdisable() {
echo "${id}"
if ! xinput disable "${1}" > /dev/null 2>&1; then
- err "${0}: Failed to disable dev."
+ err "Failed to disable dev."
else
exit 0
fi
}
-if ! command -v xinput > /dev/null 2>&1; then
- err "${0}: xinput must be installed"
-fi
+check_program "xinput"
while getopts "e:d:t:lh" option; do
case "${option}" in
- e) get_id "${OPTARG}"; xenable "${id}" ;;
-
- d) get_id "${OPTARG}"; xdisable "${id}" ;;
-
+ e)
+ get_id "${OPTARG}"
+ xenable "${id}"
+ ;;
+ d)
+ get_id "${OPTARG}"
+ xdisable "${id}"
+ ;;
t)
get_id "${OPTARG}"
@@ -67,16 +66,16 @@ while getopts "e:d:t:lh" option; do
;;
l)
if ! xinput list 2>/dev/null; then
- err "${0}: Listing Failed"
+ err "Listing Failed"
else
exit 0
fi
;;
- h) help; exit ;;
+ h) help ;;
- *) err "Try '${0} -h' for help." ;;
+ *) invalid_use -h ;;
esac
done
-err "${0}: Invalid usage" "Try '${0} -h' for help."
+invalid_use
diff --git a/scripts/shot b/scripts/shot
index 67ad849..4a58dd2 100755
--- a/scripts/shot
+++ b/scripts/shot
@@ -1,5 +1,7 @@
#!/bin/sh
+. slib
+
help() {
cat << EOF
${0}: Wrapper script to take screenshots
@@ -9,30 +11,13 @@ options:
-s Select the area with the cursor
-h Print this message and exit
-NOTE: save directory is ~/pic/screenshots
+NOTE: save directory is ~/pics/screenshots
EOF
-}
-
-err() {
- for line in "$@"; do
- echo "${line}" >&2
- done
- exit 1
+exit 0
}
-run() {
- if ! ${1} > /dev/null 2>&1; then
- err "${2}"
- fi
-
- [ -n "${3}" ] && echo "${3}"
- exit 0
-}
-
-if ! command -v scrot > /dev/null 2>&1; then
- err "${0}: scrot must be installed"
-fi
+check_program "scrot"
default_dir="${HOME}"/pics/screenshots
@@ -43,34 +28,30 @@ while getopts "d:sh" option; do
s) s_flg="1" ;;
- h) help; exit 0 ;;
+ h) help ;;
- *) err "Try '${0} -h' for help" ;;
+ *) invalid_use -h ;;
esac
done
shift $((OPTIND - 1))
-[ ${#} != 0 ] && err "${0}: Invalid usage" "Try '${0} -h' for help."
+[ ${#} != 0 ] && invalid_use
-if [ -z "${input}" ]; then
- outfile="${default_dir}"/%b%d::%H%M%S.png
-else
- if [ -d "${input}" ]; then
- outfile="${input}"/%b%d::%H%M%S.png
- else
- outfile="${input}"
- fi
-fi
+[ -z "${input}" ] && input="${default_dir}"
+
+outfile="${input}"
+
+[ -d "${input}" ] && outfile="${input}/$(date '+%b%d::%H%M%S')"
if [ ! -e "$(dirname "${outfile}")" ]; then
- mkdir -pv "$(dirname "${outfile}")" > /dev/null 2>&1 \
- || err "${0}: Failed to create directory"
+ mkdir -p "$(dirname "${outfile}")" > /dev/null 2>&1 \
+ || err "Failed to create directory"
fi
if [ "${s_flg}" = "1" ]; then
- run "scrot -zs ${outfile}" "Failed to screenshot"
+ run "scrot -zs ${outfile}" "${outfile}"
else
- run "scrot -z ${outfile}" "Failed to screenshot"
+ run "scrot -z ${outfile}" "${outfile}"
fi
diff --git a/scripts/slib b/scripts/slib
new file mode 100755
index 0000000..30e32ca
--- /dev/null
+++ b/scripts/slib
@@ -0,0 +1,99 @@
+#!/bin/sh
+
+# Avoid using full paths instead only use the program names.
+argv0=$(basename "${0}")
+
+# @FUNCTION: err
+# @USAGE: [-x] <message> ...
+# @DESCRIPTION:
+# Print given messages to stderr line by line and exit with status 1.
+#
+# If "-x" is specified, suppress the program prefix (`program: `)
+# from the output. Otherwise, the first line is prefixed with "program: ".
+#
+# This function is intended for fatal errors; it always exits the script.
+# @EXAMPLE:
+# err "Invalid usage" "Try '${argv0} -h' for help."
+
+
+err() {
+ if [ "${1}" != "-x" ]; then
+ printf "%s: " "${argv0}"
+ else
+ shift
+ fi
+
+ for line in "${@}"; do
+ echo "${line}" >&2
+ done
+ exit 1
+}
+
+# @FUNCTION: invalid_use
+# USAGE: [-h]
+# @DESCRIPTION:
+# Output a usage error message. If `-h` is not specified output:
+# "<program>: Invalid usage "
+# "Try 'program -h' for help."
+# else output only:
+# "Try 'program -h' for help."
+
+invalid_use() {
+ [ "${1}" = "-h" ] && err -x "Try '${argv0} -h' for help."
+ err "Invalid usage" "Try '${argv0} -h' for help."
+}
+
+# @FUNCTION: check_program
+# USAGE: <command> [error-msg]
+# @DESCRIPTION:
+# Check if command exists on the system.
+# If not, print an error message to stderr and exit with status 1.
+# The default error message is "`command` must be installed"
+# but can optionally be overwritten.
+#
+# @EXAMPLE:
+# Check if pulseaudio is installed.
+#
+# check_program "pactl" "pulseaudio must be installed"
+
+check_program() {
+ command -v "${1}" > /dev/null 2>&1 && return 0
+ [ -n "${2}" ] && err "${2}"
+ err "${1} must be installed"
+}
+
+# @FUNCTION: run
+# USAGE: [--reload-status] <command> [success-msg] [failure-msg]
+# @DESCRIPTION:
+# Run the specified command and output success/failure message if provided.
+# Optionally reload the status bar.
+#
+# Success messages are printed to stdout, failure messages are printed to stderr.
+# To add a failure message a success message must also be present.
+# The output of the command is not suppressed.
+#
+# @EXAMPLE:
+# Run xwallpaper command if success print out ${image}:
+#
+# run "xwallpaper --zoom ${image}" "${image}"
+
+run() {
+ relstat=0
+ if [ "${1}" = "--reload-status" ];then
+ relstat=1
+ shift
+ fi
+
+ if ${1}; then
+ [ -n "${2}" ] && echo "${2}"
+ else
+ [ -n "${3}" ] && err "${3}"
+ exit 1
+ fi
+
+ if [ "${relstat}" -eq 1 ]; then
+ slreload || echo "Warning: Failed to reload slstatus" >&2
+ fi
+
+ exit 0
+}
diff --git a/scripts/slight b/scripts/slight
index 7f1b03a..0f8cba0 100755
--- a/scripts/slight
+++ b/scripts/slight
@@ -1,5 +1,7 @@
#!/bin/sh
+. slib
+
help() {
cat << EOF
${0}: Wrapper script to change backlight
@@ -13,61 +15,35 @@ options:
NOTE: Script interprets values as percentages
EOF
-}
-err() {
- for line in "${@}"; do
- echo "${line}" >&2
- done
- exit 1
+exit 0
}
-run() {
- if ! ${1} > /dev/null 2>&1; then
- err "${2}"
- fi
-
- [ -n "${3}" ] && echo "${3}"
+check_program "brightnessctl"
- slreload || echo "Warning: Failed to reload slstatus" >&2
+[ ${#} != 1 ] && [ ${#} != 2 ] && invalid_use
- exit 0
-}
+while getopts "i:d:s:ph" option; do
+ case "${option}" in
+ i) run --reload-status "brightnessctl set +${OPTARG}%" ;;
-if ! command -v brightnessctl > /dev/null 2>&1; then
- err "${0}: brightnessctl must be installed"
-fi
+ d) run --reload-status "brightnessctl set ${OPTARG}-%" ;;
-if [ ${#} != 1 ] && [ ${#} != 2 ]; then
- err "${0}: Invalid usage" "Try '${0} -h' for help."
-fi
+ s) run --reload-status "brightnessctl set ${OPTARG}%" ;;
-while getopts "i:d:s:ph" option; do
- case "${option}" in
- i)
- run "brightnessctl set +${OPTARG}%" \
- "${0}: Failed to increase brightness"
- ;;
- d)
- run "brightnessctl set ${OPTARG}-%" \
- "${0}: Failed to decrease brightness"
- ;;
- s)
- run "brightnessctl set ${OPTARG}%" \
- "${0}: Failed to set brightness"
- ;;
p)
- if ! echo $(( (`brightnessctl g` * 100) / `brightnessctl m` )); then
+ if ! echo $(( ($(brightnessctl g) * 100) / $(brightnessctl m) )); then
err "Failed to get current brightness"
else
exit 0
fi
;;
- h) help; exit 0 ;;
+ h) help ;;
- *) err "Try '${0} -h' for help." ;;
+ *) invalid_use -h ;;
esac
done
-err "${0}: Invalid usage" "Try '${0} -h' for help."
+# Unreachable
+invalid_use
diff --git a/scripts/svol b/scripts/svol
index 25024e7..f0765bb 100755
--- a/scripts/svol
+++ b/scripts/svol
@@ -1,5 +1,7 @@
#!/bin/sh
+. slib
+
help() {
cat << EOF
${0}: Wrapper script to change volume
@@ -12,53 +14,24 @@ options:
-t Toggle between mute and unmute
-h Print this message and exit
EOF
-}
-err() {
- for line in "${@}"; do
- echo "${line}" >&2
- done
- exit 1
+exit 0
}
-run() {
- if ! ${1} > /dev/null 2>&1; then
- err "${2}"
- fi
+check_program "pactl" "pulseaudio must be installed"
- [ -n "${3}" ] && echo "${3}"
+[ $# != 1 ] && [ $# != 2 ] && invalid_use
- slreload || echo "Warning: Failed to reload slstatus" >&2
+while getopts "i:d:s:pth" option; do
+ case "${option}" in
+ i) run --reload-status "pactl set-sink-volume @DEFAULT_SINK@ +${OPTARG}%" ;;
- exit 0
-}
+ d) run --reload-status "pactl set-sink-volume @DEFAULT_SINK@ -${OPTARG}%" ;;
-if ! command -v pactl > /dev/null 2>&1; then
- err "${0}: pulseaudio must be installed"
-fi
+ s) run --reload-status "pactl set-sink-volume @DEFAULT_SINK@ ${OPTARG}%" ;;
-if [ $# != 1 ] && [ $# != 2 ]; then
- err "${0}: Invalid usage" "Try '$0 -h' for help."
-fi
+ t) run --reload-status "pactl set-sink-mute @DEFAULT_SINK@ toggle" ;;
-while getopts "i:d:s:pth" option; do
- case "${option}" in
- i)
- run "pactl set-sink-volume @DEFAULT_SINK@ +${OPTARG}%" \
- "${0}: Failed to increase volume"
- ;;
- d)
- run "pactl set-sink-volume @DEFAULT_SINK@ -${OPTARG}%" \
- "${0}: Failed to decrease volume"
- ;;
- s)
- run "pactl set-sink-volume @DEFAULT_SINK@ ${OPTARG}%" \
- "${0}: Failed to set volume"
- ;;
- t)
- run "pactl set-sink-mute @DEFAULT_SINK@ toggle" \
- "${0}: Failed to toggle volume"
- ;;
p)
if ! pactl get-sink-volume @DEFAULT_SINK@ \
| sed -e 's,.* \([0-9][0-9]*\)%.*,\1,' | head -n1 2>/dev/null; then
@@ -67,11 +40,12 @@ while getopts "i:d:s:pth" option; do
exit 0
fi
;;
- h) help; exit 0 ;;
+ h) help ;;
- *) err "Try '${0} -h' for help" ;;
+ *) invalid_use -h ;;
esac
done
-err "${0}: Invalid usage" "Try '$0 -h' for help."
+# Unreachable
+invalid_use
diff --git a/scripts/swall b/scripts/swall
index bc288b8..34c4bc8 100755
--- a/scripts/swall
+++ b/scripts/swall
@@ -1,5 +1,7 @@
#!/bin/sh
+. slib
+
help() {
cat << EOF
${0}: Wrapper script to set wallpapers
@@ -11,53 +13,35 @@ options:
NOTE: default directory is ~/.config/wallpapers
EOF
-}
-err() {
- for line in "${@}"; do
- echo "${line}" >&2
- done
- exit 1
+exit 0
}
-run() {
- if ! ${1} > /dev/null 2>&1; then
- err "${2}"
- fi
-
- [ -n "${3}" ] && echo "${3}"
- exit 0
-}
+check_program "xwallpaper"
-if ! command -v xwallpaper > /dev/null 2>&1; then
- err "${0}: xwallpaper must be installed"
-fi
-
-if [ ${#} = 0 ]; then
+if [ "${#}" = 0 ]; then
+ #FIXME: use XDG_CONFIG
input="${HOME}/.config/wallpapers"
-elif [ ${#} != 1 ] && [ $# != 2 ]; then
- err "${0}: Invalid usage" \
- "Try '$0 -h' for help."
+elif [ "${#}" != 1 ] && [ "${#}" != 2 ]; then
+ invalid_use
fi
while getopts "hcd:" option; do
case "${option}" in
- c)
- run "xwallpaper --clear" \
- "${0}: Failed to clear wallpaper"
- ;;
+ c) run "xwallpaper --clear" ;;
+
d) input="${OPTARG}" ;;
- h) help; exit 0 ;;
+ h) help ;;
- *) err "Try '${0} -h' for help" ;;
+ *) invalid_use -h ;;
esac
done
shift $((OPTIND - 1))
-[ ${#} != 0 ] && err "${0}: Invalid usage" "Try '${0} -h' for help."
+[ "${#}" != 0 ] && invalid_use
if [ -n "${input}" ]; then
case $(file -L -b --mime-type "${input}") in
@@ -65,7 +49,7 @@ if [ -n "${input}" ]; then
inode/directory) waldir="${input}" ;;
- *) err "${0}: Couldn't read given file" ;;
+ *) err "Couldn't read given file" ;;
esac
fi
@@ -74,6 +58,6 @@ if [ -n "${waldir}" ]; then
| shuf -n 1 )
fi
-[ -z "${image}" ] && err "${0}: No image file found"
+[ -z "${image}" ] && err "No image file found"
-run "xwallpaper --zoom ${image}" "${0}: Failed to set wallpaper" "${image}"
+run "xwallpaper --zoom ${image}" "${image}"