#!/bin/sh . $HOME/.config/rootwm/rwm_var NAMES=$(cat $HOME/.config/rootwm/names) # disponible names FLAG=$1 # input FW=$(pfw) # focused window id AMW=$(lsw) # all maped windows usage() { echo "usage: rwm_groups.sh [ -a, -r, -t ] -a) add -A) add all -d) delete -D) delete all -t) togle" } case $FLAG in -a) # create atom in focused window atomx WM_GROUP=$($XMENU < $NAMES) $FW ;; -A) # create atom in all maped windows atomx WM_GROUP=$($XMENU < $NAMES) $AMW ;; -d) # delete atom from focused window atomx -d WM_GROUP $FW ;; -D) # delete atom from all maped windows atomx -d WM_GROUP $AMW ;; -t) # togle groups groups=$(atomx WM_GROUP $(lsw -a) | sort -u) # groups if [ -n "$groups" ]; then # check if any grpup exist gtarget=$(printf "$groups" | $XMENU) # group target utarget=$(for wid in $(lsw -u); do # unmaped targets printf '%s\n' "$wid $(atomx WM_GROUP $wid)" | grep $gtarget done) mtarget=$(for wid in $(lsw); do # maped targets if [ -n "$(atomx WM_GROUP $wid)" ]; then printf '%s\n' "$wid $(atomx WM_GROUP $wid)" | grep -v $gtarget fi done) mapw -m $utarget & mapw -u $mtarget # map utargets and unmap mtargets fi ;; *) usage # self-explained ;; esac