From 5ca60114560f24617d0a82ef230bc11484617800 Mon Sep 17 00:00:00 2001 From: Matt Singleton Date: Sun, 2 Apr 2023 20:16:45 -0500 Subject: each program in a sway package --- sway-de/sway/.local/bin/dnf-needs-restarting | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 sway-de/sway/.local/bin/dnf-needs-restarting (limited to 'sway-de/sway/.local/bin') diff --git a/sway-de/sway/.local/bin/dnf-needs-restarting b/sway-de/sway/.local/bin/dnf-needs-restarting new file mode 100755 index 0000000..a080649 --- /dev/null +++ b/sway-de/sway/.local/bin/dnf-needs-restarting @@ -0,0 +1,26 @@ +#!/bin/bash + +set -eo pipefail + +if command -v dnf > /dev/null; then + DNFCMD="dnf" +fi +if command -v jq > /dev/null; then + JQCMD="jq" +fi +if [ -z "$DNFCMD" ] || [ -z "$JQCMD" ]; 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" -- cgit v1.2.3