Add function to run command and notify on completion
authorSiraaj Khandkar <siraaj@khandkar.net>
Wed, 15 May 2019 15:23:16 +0000 (11:23 -0400)
committerSiraaj Khandkar <siraaj@khandkar.net>
Wed, 15 May 2019 15:23:16 +0000 (11:23 -0400)
home/lib/login_functions.sh

index 1cc5f7f..862e908 100644 (file)
@@ -166,3 +166,16 @@ bt_devs() {
     | awk '{print $2}' \
     | xargs bluetoothctl -- info
 }
+
+run() {
+    stderr="$(mktemp)"
+    $@ 2> >(tee "$stderr")
+    code="$?"
+    urgency=''
+    case "$code" in
+        0) urgency='normal';;
+        *) urgency='critical'
+    esac
+    notify-send -u "$urgency" "Job done: $code" "$(cat $stderr)"
+    rm "$stderr"
+}
This page took 0.030195 seconds and 4 git commands to generate.