Add function to run command and notify on completion
[khome.git] / 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.024416 seconds and 4 git commands to generate.