diff options
author | InigoGutierrez <inigogf.95@gmail.com> | 2019-11-19 20:56:58 +0100 |
---|---|---|
committer | InigoGutierrez <inigogf.95@gmail.com> | 2019-11-19 20:56:58 +0100 |
commit | d5a7835096e5217ed527a0682aa4e793b1775c94 (patch) | |
tree | 82bf483f486513c278077f1c86d20369fe18c610 | |
parent | 76d2ca339eb49eaaaff9bd6bcd0050f35e855365 (diff) | |
download | scripts-d5a7835096e5217ed527a0682aa4e793b1775c94.tar.gz scripts-d5a7835096e5217ed527a0682aa4e793b1775c94.zip |
Created i3blocks script to show running status of arbitrary processes.
-rwxr-xr-x | i3blocks/i3flags.sh | 33 |
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" |