diff options
author | Matt Singleton <matt@xcolour.net> | 2024-06-11 20:51:49 -0500 |
---|---|---|
committer | Matt Singleton <matt@xcolour.net> | 2024-06-11 20:51:49 -0500 |
commit | 38a4e8e941ee07a15b0aa5d388a69df061585ec9 (patch) | |
tree | f342100836608bcde976804bc4d7e927f21574da /stow/sway/.local/bin/dnf-needs-restarting | |
parent | c8dea64ee21c16b35c2a8b4982806984daba3273 (diff) |
separate sway-de folder causes problems with overlapping stow responsibilities
Diffstat (limited to 'stow/sway/.local/bin/dnf-needs-restarting')
-rwxr-xr-x | stow/sway/.local/bin/dnf-needs-restarting | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/stow/sway/.local/bin/dnf-needs-restarting b/stow/sway/.local/bin/dnf-needs-restarting new file mode 100755 index 0000000..7fc6542 --- /dev/null +++ b/stow/sway/.local/bin/dnf-needs-restarting @@ -0,0 +1,26 @@ +#!/bin/bash + +set -euo pipefail + +if command -v dnf > /dev/null; then + DNFCMD="dnf" +fi +if command -v jq > /dev/null; then + JQCMD="jq" +fi +if [ -z "${DNFCMD+x}" ] || [ -z "${JQCMD+x}" ]; then + echo "{\"tooltip\": \"requires 'jq' and 'dnf'\", \"text\": \"\"}" + exit 1 +fi + +set -u + +if ! output="$($DNFCMD needs-restarting -r)"; then + icon="" +else + icon="" +fi + +# this is a literal expression for `jq` +# shellcheck disable=SC2016 +$JQCMD --unbuffered -n -c '{tooltip: $ARGS.positional[0], text: $ARGS.positional[1]}' --args "$output" "$icon" |