diff options
| author | Suleyman Farajli <suleyman@farajli.net> | 2025-11-25 22:40:16 +0400 |
|---|---|---|
| committer | Suleyman Farajli <suleyman@farajli.net> | 2025-11-25 22:40:16 +0400 |
| commit | 7c19172f87b6fe35dffd8f9a252c3c10efe13aa2 (patch) | |
| tree | f42dd1ffd3440200977ea4c38950458f57bd534c | |
| parent | af078c55f03e2884b883abb095c623b96fa97ec5 (diff) | |
fix(scripts): fix shellcheck errors and warnings
| -rwxr-xr-x | scripts/cli/slight | 10 | ||||
| -rwxr-xr-x | scripts/cli/svol | 8 | ||||
| -rwxr-xr-x | scripts/daemons/notifd | 2 | ||||
| -rwxr-xr-x | scripts/gui/sdev | 17 | ||||
| -rwxr-xr-x | scripts/gui/shot | 4 | ||||
| -rw-r--r-- | scripts/lib/lib_common.sh | 7 | ||||
| -rw-r--r-- | scripts/lib/lib_handle.sh | 4 |
7 files changed, 25 insertions, 27 deletions
diff --git a/scripts/cli/slight b/scripts/cli/slight index d239d8e..770553a 100755 --- a/scripts/cli/slight +++ b/scripts/cli/slight @@ -21,12 +21,12 @@ exit 0 brightness_handle check_program [ ${#} != 1 ] && [ ${#} != 2 ] && invalid_use -while getopts "i:d:s:ph" option; do +while getopts "i:d:s:tph" option; do case "${option}" in - i) run --reload-status "brightness_handle up ${OPTARG}" ;; - d) run --reload-status "brightness_handle down ${OPTARG}" ;; - s) run --reload-status "brightness_handle set ${OPTARG}" ;; - t) run --reload-status "brightness_handle toggle" ;; + i) run --reload-status brightness_handle up "${OPTARG}" ;; + d) run --reload-status brightness_handle down "${OPTARG}" ;; + s) run --reload-status brightness_handle set "${OPTARG}" ;; + t) run --reload-status brightness_handle toggle ;; p) brightness_handle get-current ;; h) help ;; diff --git a/scripts/cli/svol b/scripts/cli/svol index 64f4a2f..d6f169c 100755 --- a/scripts/cli/svol +++ b/scripts/cli/svol @@ -23,10 +23,10 @@ volume_handle check_program while getopts "i:d:s:pth" option; do case "${option}" in - i) run --reload-status "volume_handle up ${OPTARG}" ;; - d) run --reload-status "volume_handle down ${OPTARG}" ;; - s) run --reload-status "volume_handle set ${OPTARG}" ;; - t) run --reload-status "volume_handle toggle" ;; + i) run --reload-status volume_handle up "${OPTARG}" ;; + d) run --reload-status volume_handle down "${OPTARG}" ;; + s) run --reload-status volume_handle set "${OPTARG}" ;; + t) run --reload-status volume_handle toggle ;; p) volume_handle get-current ;; h) help ;; diff --git a/scripts/daemons/notifd b/scripts/daemons/notifd index 85b851d..3d0e809 100755 --- a/scripts/daemons/notifd +++ b/scripts/daemons/notifd @@ -19,7 +19,7 @@ cancel() { tpid="" } -while read n <&3; do +while read -r n <&3; do [ "${n}" = "-1" ] && { cancel; continue; } case "${n}" in ''|*[!0-9]*) continue ;; esac diff --git a/scripts/gui/sdev b/scripts/gui/sdev index 5c2976f..4ec0ed8 100755 --- a/scripts/gui/sdev +++ b/scripts/gui/sdev @@ -27,22 +27,15 @@ get_id() { while getopts "e:d:t:lh" option; do case "${option}" in - e) - input_device_handle enable "$(get_id ${OPTARG})" - exit $? - ;; - d) - input_device_handle disable "$(get_id ${OPTARG})" - exit $? - ;; + e) run input_device_handle enable "$(get_id "${OPTARG}")" ;; + d) run input_device_handle disable "$(get_id "${OPTARG}")" ;; t) - id=$(get_id ${OPTARG}) + id="$(get_id "${OPTARG}")" if input_device_handle is_enabled "${id}"; then - input_device_handle disable "${id}" + run input_device_handle disable "${id}" else - input_device_handle enable "${id}" + run input_device_handle enable "${id}" fi - exit $? ;; l) input_device_handle list diff --git a/scripts/gui/shot b/scripts/gui/shot index e24e551..e7d2d08 100755 --- a/scripts/gui/shot +++ b/scripts/gui/shot @@ -52,7 +52,9 @@ fi if [ "${mode}" = "select" ]; then run --no-exit --reload-compositor \ - "screenshot_handle ${mode} ${outfile}" && echo "${outfile}" + screenshot_handle "${mode}" "${outfile}" + + [ $? -eq 0 ] && echo "${outfile}" else screenshot_handle "${mode}" "${outfile}" && echo "${outfile}" fi diff --git a/scripts/lib/lib_common.sh b/scripts/lib/lib_common.sh index 629bdc7..9256967 100644 --- a/scripts/lib/lib_common.sh +++ b/scripts/lib/lib_common.sh @@ -109,6 +109,9 @@ run() { [ "${reload_compositor}" -eq 1 ] && compositor_handle stop - eval "${@}" - [ "${no_exit}" -eq 1 ] || exit "${?}" + "${@}" + status=$? + [ "${no_exit}" -ne 0 ] && return "${status}" + + exit "${status}" } diff --git a/scripts/lib/lib_handle.sh b/scripts/lib/lib_handle.sh index 1973144..5405e4a 100644 --- a/scripts/lib/lib_handle.sh +++ b/scripts/lib/lib_handle.sh @@ -80,7 +80,7 @@ input_device_handle() { "list") xinput list ;; "get-id") dev=$(xinput list --name-only | grep -i -m1 "${2}" ) || return 1 - printf "${dev#∼ }" + printf "%s" "${dev#∼ }" ;; "is_enabled") xinput list-props "${2}" | grep -q "Device Enabled.*1$" @@ -150,5 +150,5 @@ menu_handle() { "center") flags="-bw 1 -c -g 1 -l 25" ;; esac shift - dmenu ${flags} + dmenu "${flags}" } |
