wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit 6480796f1e6d50ffc78123bebcf4e1ec0d8330d4
parent 88fba913be788f8ce3979873b4f56f9ddfc58acc
Author: Kris Maglione <jg@suckless.org>
Date:   Sat, 10 Feb 2007 22:04:13 -0500

Add rehash action to update the programs list and cleanup wmiirc a bit


Diffstat:
rc/rehash | 8++++++++
rc/wmiirc | 94++++++++++++++++++++++++++++++++++++++++++++-----------------------------------
2 files changed, 60 insertions(+), 42 deletions(-)

diff --git a/rc/rehash b/rc/rehash @@ -0,0 +1,8 @@ +#!/bin/sh +proglist() { + ls -lL "$@" 2>/dev/null | awk 'NF>2 && $1 ~ /^[^d].*x/ {print $NF}' | sort | uniq +} + +proglist `echo "$PATH" | sed 'y/:/ /'` >$PROGS_FILE.new + +mv $PROGS_FILE.new $PROGS_FILE diff --git a/rc/wmiirc b/rc/wmiirc @@ -1,28 +1,15 @@ #!/bin/sh # Configure wmii -# FUNCTIONS -xwrite() { - file="$1"; shift - echo -n "$@" | wmiir write "$file" -} - -proglist() { - ls -lL "$@" 2>/dev/null | awk 'NF>2 && $1 ~ /^[^d].*x/ {print $NF}' | sort | uniq -} - -conf_which () { - prog=$1; shift - if [ -n "$prog" ] - then - echo `PATH="$WMII_CONFPATH:$PATH" which $prog` "$@" - fi -} - -tagsmenu() { - tag=`wmiir read /tag/sel/ctl` - wmiir ls /tag | sed "s|/||; /^sel\$/d" | $DMENU -} +# Contents +# Configuration Variables +# WM Configuration +# Column Rules +# Tagging Rules +# Utility Functions +# Tag Bar Setup +# List of Bound Keys +# Event Processing Loop # CONFIGURATION VARIABLES MODKEY=Mod1 @@ -67,17 +54,58 @@ wmiir write /tagrules <<EOF /.*/ -> 1 EOF +# FUNCTIONS +xwrite() { + file="$1"; shift + echo -n "$@" | wmiir write "$file" +} + +proglist() { + ls -lL "$@" 2>/dev/null | awk 'NF>2 && $1 ~ /^[^d].*x/ {print $NF}' | sort | uniq +} + +conf_which () { + prog=$1; shift + if [ -n "$prog" ]; then + echo `PATH="$WMII_CONFPATH:$PATH" which $prog` "$@" + fi +} + +tagsmenu() { + tag=`wmiir read /tag/sel/ctl` + wmiir ls /tag | sed "s|/||; /^sel\$/d" | $DMENU +} + + # MISC PROGS_FILE="$WMII_NS_DIR/.dmenu.proglist" ACTIONS_DIRS=`echo "$WMII_CONFPATH" | tr : ' '` `conf_which status` & -xsetroot -solid $WMII_BACKGROUND -proglist `echo "$PATH" | tr : ' '` >$PROGS_FILE & +xsetroot -solid $WMII_BACKGROUND & +proglist `echo "$PATH" | sed 'y/:/ /'` >$PROGS_FILE & # Stop any running instances of wmiirc echo Start wmiirc | wmiir write /event || exit 1 +# SETUP TAG BAR +wmiir ls /lbar | +while read bar +do + wmiir remove "/lbar/$bar" +done + +seltag="`wmiir read /tag/sel/ctl 2>/dev/null`" +wmiir ls /tag | sed -e 's|/||; /^sel$/d' | +while read tag +do + if [ "X$tag" = "X$seltag" ]; then + echo "$WMII_FOCUSCOLORS" "$tag" | wmiir create "/lbar/$tag" + else + echo "$WMII_NORMCOLORS" "$tag" | wmiir create "/lbar/$tag" + fi +done + # BOUND KEYS wmiir write /keys <<EOF $MODKEY-$LEFT @@ -121,24 +149,6 @@ $MODKEY-Shift-8 $MODKEY-Shift-9 EOF -# SETUP TAG BAR -wmiir ls /lbar | -while read bar -do - wmiir remove "/lbar/$bar" -done - -seltag="`wmiir read /tag/sel/ctl 2>/dev/null`" -wmiir ls /tag | sed -e 's|/||; /^sel$/d' | -while read tag -do - if [ "X$tag" = "X$seltag" ]; then - echo "$WMII_FOCUSCOLORS" "$tag" | wmiir create "/lbar/$tag" - else - echo "$WMII_NORMCOLORS" "$tag" | wmiir create "/lbar/$tag" - fi -done - # EVENT LOOP wmiir read /event 2>/dev/null | while read event