From d5a7835096e5217ed527a0682aa4e793b1775c94 Mon Sep 17 00:00:00 2001 From: InigoGutierrez Date: Tue, 19 Nov 2019 20:56:58 +0100 Subject: Created i3blocks script to show running status of arbitrary processes. --- i3blocks/i3flags.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 i3blocks/i3flags.sh 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" -- cgit v1.2.1