aboutsummaryrefslogtreecommitdiff
path: root/i3blocks
diff options
context:
space:
mode:
Diffstat (limited to 'i3blocks')
-rwxr-xr-xi3blocks/i3flags.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/i3blocks/i3flags.sh b/i3blocks/i3flags.sh
new file mode 100755
index 0000000..8d18ca0
--- /dev/null
+++ b/i3blocks/i3flags.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+# i3Flags.sh
+#
+# Usage: i3Flags.sh [COMMAND]...
+#
+# Outputs a line for each of a list of programs, showing if it is executing.
+# pgrep -x is used for the name matching, so command names must be exact.
+# Uses a default list of programs if none is provided.
+
+#case $BLOCK_BUTTON in
+# 1) # Left click
+# 2) # Middle click
+# 3) # Right click
+#esac
+
+if [ -z "$1" ]; then
+ programs="picom dunst"
+else
+ programs="$*"
+fi
+flags=""
+
+for program in $programs; do
+ if [ -n "$(pgrep -x "$program")" ]; then
+ flag="$(echo "${program:0:1}" | awk '{print toupper($1)}')"
+ flags="${flags}${flag}"
+ else
+ flags="${flags}-"
+ fi
+done
+
+echo "$flags"