updated the scripts in extra/p9p so they're at least in line with the release

This commit is contained in:
Anthony Martin 2006-04-29 00:09:16 -07:00
parent 2f7eb817c2
commit f27511b0ae
3 changed files with 108 additions and 125 deletions

2
extra/p9p/quit Normal file
View File

@ -0,0 +1,2 @@
#!/usr/local/plan9/bin/rc
echo -n quit | wmiir write /ctl

View File

@ -1,23 +1,10 @@
#!/usr/local/plan9/bin/rc #!/usr/local/plan9/bin/rc
# periodically print date and load average to the bar # periodically print date and load average to the bar
PIDFILE=/tmp/ns.$USER.$DISPLAY/`{basename $0}^'pid'
if(test -r $PIDFILE)
kill `{cat $PIDFILE}
echo $pid >$PIDFILE
wmiir remove /bar/status 2>/dev/null && sleep 2
wmiir create /bar/status wmiir create /bar/status
xwrite /bar/status/colors $WMII_NORMCOLORS xwrite /bar/status/colors $WMII_NORMCOLORS
# install signal handler for artificial sigexit:
fn sigint {
if(test -f $PIDFILE && ~ `{cat $PIDFILE} $pid)
rm -f $PIDFILE
echo $PIDFILE sigint
wmiir remove /bar/status
exit
}
while(text=`{date | sed 's/GMT .*//'} xwrite /bar/status/data $"text){ while(text=`{date | sed 's/GMT .*//'} xwrite /bar/status/data $"text){
sleep 2 sleep 1
} & }
echo $apid > $PIDFILE

212
extra/p9p/wmiirc Executable file → Normal file
View File

@ -1,70 +1,58 @@
#!/usr/local/plan9/bin/rc #!/usr/local/plan9/bin/rc
# configure wmii # configure wmii
fn xwrite {a=$1; shift; echo -n $* | wmiir write $a} fn xwrite {a=$1; shift; echo -n $* | wmiir write $a}
MODKEY=Alt fn proglist {ls -lpL $* | awk '!/^d/ && $1 ~ /x/ {print $NF}'| sort -u}
MODKEY=Mod1
UP=k
DOWN=j
LEFT=h
RIGHT=l
WMII_FONT='fixed' WMII_FONT='fixed'
WMII_NORMCOLORS='#222222 #eeeeee #666666'
WMII_SELCOLORS='#ffffff #285577 #4c7899' WMII_SELCOLORS='#ffffff #285577 #4c7899'
WMII_NORMCOLORS='#222222 #eeeeee #666666'
# dark background
#WMII_NORMCOLORS='#e0e0e0 #0a0a0a #202020'
# WM CONFIGURATION # WM CONFIGURATION
xwrite /def/border 3 xwrite /def/border 2
xwrite /def/snap 20
xwrite /def/font $WMII_FONT xwrite /def/font $WMII_FONT
xwrite /def/selcolors $WMII_SELCOLORS xwrite /def/selcolors $WMII_SELCOLORS
xwrite /def/normcolors $WMII_NORMCOLORS xwrite /def/normcolors $WMII_NORMCOLORS
xwrite /ws/tag 1
# TAGGING RULES # TAGGING RULES
wmiir write /def/rules <<END wmiir write /def/rules <<END
/XMMS:.*/ -> ~0 /XMMS.*/ -> ~
/Gimp.*:.*/ -> ~3 /Gimp.*/ -> ~
/MPlayer.*/ -> ~
/.*/ -> !
/.*/ -> 1
END END
# BAR CONFIGURATION
wmiir create /bar/spare
xwrite /bar/spare/colors $WMII_SELCOLORS
xwrite /bar/expand spare
# MENU CONFIGURATION
fn items {ls -lpL $* | awk '!/^d/ && $1 ~ /x/ {print $NF}'| sort | uniq}
items `{echo $OLD_PATH | sed 's/:/ /g'} >/tmp/ns.$USER.$DISPLAY/p.menu &
# MISC # MISC
xsetroot -solid '#0b1014' xsetroot -solid '#333333'
status & status &
PROGS_FILE=/tmp/.wmiimenu.$USER.progs
proglist `{echo $PATH | tr : ' '} >$PROGS_FILE &
# KEYS CONFIGURATION # SHORTCUTS
xwrite /def/grabmod $MODKEY
wmiir write /def/keys <<END wmiir write /def/keys <<END
$MODKEY-Control-c $MODKEY-$LEFT
$MODKEY-Control-w,y $MODKEY-$RIGHT
$MODKEY-Control-q,y $MODKEY-$DOWN
$MODKEY-Control-p $MODKEY-$UP
$MODKEY-Control-a
$MODKEY-Shift-Return
$MODKEY-Shift-space
$MODKEY-Shift-0
$MODKEY-Shift-1
$MODKEY-Shift-2
$MODKEY-Shift-3
$MODKEY-Shift-4
$MODKEY-Shift-5
$MODKEY-Shift-6
$MODKEY-Shift-7
$MODKEY-Shift-8
$MODKEY-Shift-9
$MODKEY-t
$MODKEY-Return
$MODKEY-space $MODKEY-space
$MODKEY-h $MODKEY-d
$MODKEY-l $MODKEY-f
$MODKEY-j
$MODKEY-k
$MODKEY-Tab
$MODKEY-m
$MODKEY-s $MODKEY-s
$MODKEY-e $MODKEY-m
$MODKEY-n $MODKEY-a
$MODKEY-p
$MODKEY-t
$MODKEY-0 $MODKEY-0
$MODKEY-1 $MODKEY-1
$MODKEY-2 $MODKEY-2
@ -75,81 +63,87 @@ $MODKEY-6
$MODKEY-7 $MODKEY-7
$MODKEY-8 $MODKEY-8
$MODKEY-9 $MODKEY-9
$MODKEY-Return
$MODKEY-Shift-$LEFT
$MODKEY-Shift-$RIGHT
$MODKEY-Shift-space
$MODKEY-Shift-c
$MODKEY-Shift-t
$MODKEY-Shift-0
$MODKEY-Shift-1
$MODKEY-Shift-2
$MODKEY-Shift-3
$MODKEY-Shift-4
$MODKEY-Shift-5
$MODKEY-Shift-6
$MODKEY-Shift-7
$MODKEY-Shift-8
$MODKEY-Shift-9
$MODKEY-Control-$LEFT
$MODKEY-Control-$RIGHT
$MODKEY-Control-$DOWN
$MODKEY-Control-$UP
END END
# EVENT LOOP # EVENT LOOP
oldt='' wmiir read /event |
wmiir read /event|
while(e=`{read}) { while(e=`{read}) {
switch($e(1)) { switch($e(1)) {
case NewTag case Start
t=$e(2) if(~ $e(2) wmiirc)
wmiir create /bar/$t exit
if(~ $t $olt) case BarClick
xwrite /bar/$"t/colors $WMII_NORMCOLORS xwrite /ctl view $e(2)
if not
xwrite /bar/$"t/colors $WMII_SELCOLORS
xwrite /bar/$"t/data $e(2)
case RemoveTag
wmiir remove /bar/$e(2)
case FocusTag
t=$e(2)
if (! ~ $#oldt 0)
xwrite /bar/$oldt/colors $WMII_SELCOLORS
xwrite /bar/$t/data $e(2)
xwrite /bar/$t/colors $WMII_NORMCOLORS
oldt=$e(2)
case LabelClick
xwrite /ctl select $e(2)
case Key case Key
switch($e(2)) { switch($e(2)) {
case $MODKEY-Control-c case $MODKEY-$LEFT
xwrite /ws/sel/sel/ctl kill xwrite /view/ctl select prev
case $MODKEY-Control-w,y case $MODKEY-$RIGHT
exec wmiirc xwrite /view/ctl select next
case $MODKEY-Control-q,y case $MODKEY-$DOWN
xwrite /ctl quit xwrite /view/sel/ctl select next
case $MODKEY-Control-p case $MODKEY-$UP
extern `{wmiimenu < /tmp/ns.$USER.$DISPLAY/p.menu}& xwrite /view/sel/ctl select prev
case $MODKEY-Control-a
`{items /usr/local/etc/wmii-3 $HOME/.wmii-3 | wmiimenu}&
case $MODKEY-t
extern xterm&
case $MODKEY-m
xwrite /ws/sel/mode max
case $MODKEY-s
xwrite /ws/sel/mode stack
case $MODKEY-e
xwrite /ws/sel/mode equal
case $MODKEY-n
xwrite /ws/sel/sel/ctl sendto new
case $MODKEY-Return
xwrite /ws/sel/sel/ctl sendto prev
case $MODKEY-Shift-Return
xwrite /ws/sel/sel/ctl sendto next
case $MODKEY-space case $MODKEY-space
xwrite /ws/sel/sel/ctl sendto 0 xwrite /view/ctl select toggle
case $MODKEY-Shift-space case $MODKEY-d
xwrite /ws/sel/sel/ctl sendto 1 xwrite /view/sel/mode default
case $MODKEY-h case $MODKEY-s
xwrite /ws/ctl select prev xwrite /view/sel/mode stack
case $MODKEY-l case $MODKEY-m
xwrite /ws/ctl select next xwrite /view/sel/mode max
case $MODKEY-Tab case $MODKEY-f
xwrite /ws/sel/ctl select next xwrite /view/0/sel/geom 0 0 east south
case $MODKEY-j case $MODKEY-a
xwrite /ws/sel/ctl select next PATH=$HOME/.wmii-3:CONFPREFIX/wmii-3:$PATH `{proglist CONFPREFIX/wmii-3 $HOME/.wmii-3 | wmiimenu} &
case $MODKEY-k case $MODKEY-p
xwrite /ws/sel/ctl select prev `{wmiimenu <$PROGS_FILE}&
case $MODKEY-t
xwrite /ctl view `{wmiir read /tags | wmiimenu} &
case $MODKEY-[0-9] case $MODKEY-[0-9]
xwrite /ctl `{echo $e | awk -F- '{print "select "$2}'} xwrite /ctl view `{echo $e(2) | sed 's/.*-//'}
case $MODKEY-Return
case $MODKEY-Shift-Return xterm &
xwrite /ws/sel/sel/ctl sendto next case $MODKEY-Shift-$LEFT
xwrite /view/sel/sel/ctl sendto prev
case $MODKEY-Shift-$RIGHT
xwrite /view/sel/sel/ctl sendto next
case $MODKEY-Shift-space case $MODKEY-Shift-space
xwrite /ws/sel/sel/ctl sendto 1 xwrite /view/sel/sel/ctl sendto toggle
case $MODKEY-Shift-c
xwrite /view/sel/sel/ctl kill
case $MODKEY-Shift-t
xwrite /view/sel/sel/tags `{wmiir read /tags | wmiimenu} &
case $MODKEY-Shift-[0-9] case $MODKEY-Shift-[0-9]
xwrite /ws/sel/sel/tags ' '`{echo $e | awk -F- '{print $3}'} xwrite /view/sel/sel/tags `{echo $e(2) | sed 's/.*-//'}
case $MODKEY-Control-$LEFT
xwrite /view/sel/sel/ctl swap prev
case $MODKEY-Control-$RIGHT
xwrite /view/sel/sel/ctl swap next
case $MODKEY-Control-$DOWN
xwrite /view/sel/sel/ctl swap down
case $MODKEY-Control-$UP
xwrite /view/sel/sel/ctl swap up
} }
} }
} & } &