wmii

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

commit 215ac62fd7275839feac880ee1a07030236193a6
parent 506c7a883536363ac768009a128f1e4789bae899
Author: Georg Neis <gn@wmii.de>
Date:   Sat, 25 Feb 2006 19:12:09 +0100

move rc scripts to extra/p9p/, set shebang to /usr/local/plan9/bin/rc, remove 9PREFIX
don't expect anything to work, files are missing now


Diffstat:
Makefile | 4++--
config.mk | 1-
extra/p9p/extern | 15+++++++++++++++
extra/p9p/status | 30++++++++++++++++++++++++++++++
extra/p9p/welcome | 66++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
extra/p9p/wmiirc | 154+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
rc/extern | 15---------------
rc/status | 30------------------------------
rc/welcome | 66------------------------------------------------------------------
rc/wmiirc | 154-------------------------------------------------------------------------------
10 files changed, 267 insertions(+), 268 deletions(-)

diff --git a/Makefile b/Makefile @@ -37,14 +37,14 @@ clean: install: all @mkdir -p ${DESTDIR}${PREFIX}/bin @cp -f ${BIN} ${DESTDIR}${PREFIX}/bin - @sed 's|CONFPREFIX|${CONFPREFIX}|; s|9PREFIX|${9PREFIX}|' <cmd/wm/wmii >${DESTDIR}${PREFIX}/bin/wmii + @sed 's|CONFPREFIX|${CONFPREFIX}|' <cmd/wm/wmii >${DESTDIR}${PREFIX}/bin/wmii @for i in ${BIN}; do \ chmod 755 ${DESTDIR}${PREFIX}/bin/`basename $$i`; \ done @echo installed executable files to ${DESTDIR}${PREFIX}/bin @mkdir -p ${DESTDIR}${CONFPREFIX}/wmii-3 @cd rc; for i in *; do \ - sed 's|CONFPREFIX|${CONFPREFIX}|; s|9PREFIX|${9PREFIX}|' <$$i >${DESTDIR}${CONFPREFIX}/wmii-3/$$i; \ + sed 's|CONFPREFIX|${CONFPREFIX}|' <$$i >${DESTDIR}${CONFPREFIX}/wmii-3/$$i; \ chmod 755 ${DESTDIR}${CONFPREFIX}/wmii-3/$$i; \ done @echo installed rc scripts to ${DESTDIR}${CONFPREFIX}/wmii-3 diff --git a/config.mk b/config.mk @@ -4,7 +4,6 @@ PREFIX = /usr/local CONFPREFIX = ${PREFIX}/etc MANPREFIX = ${PREFIX}/share/man -9PREFIX = ${PREFIX}/9 X11INC = /usr/X11R6/include X11LIB = /usr/X11R6/lib diff --git a/extra/p9p/extern b/extra/p9p/extern @@ -0,0 +1,15 @@ +#!/usr/local/plan9/bin/rc +# clean the environment and execute the given command + +path=$old_path +old_path=() +apid=() +cmd=() +home=() +ifs=() +pid=() +prompt=() +rcname=() +status=() + +exec $* diff --git a/extra/p9p/status b/extra/p9p/status @@ -0,0 +1,30 @@ +#!/usr/local/plan9/bin/rc +# periodically print date and load average to the bar + +PIDFILE=/tmp/ns.$USER.$DISPLAY/statuspid + +if(test -r $PIDFILE) { + kill -2 `{cat $PIDFILE} >[2]/dev/null +} +if (~ $1 stop) exit +echo $pid >$PIDFILE + +xwrite /bar/new/colors $WMII_NORMCOLORS +lab=`{wmiir read /bar|maxlab} + +# install signal handler for artificial sigexit: +fn sigint { + if(test -f $PIDFILE && ~ `{cat $PIDFILE} $pid) + rm -f $PIDFILE + wmiir remove /bar/$lab + exit +} + +fn statustext { + # if you need a formatted date, use awk + echo `{date} `{uptime | sed 's/.*://; s/,//g'} +} + +while(text=`{statustext} xwrite /bar/$lab/data $"text){ + sleep 2 +} diff --git a/extra/p9p/welcome b/extra/p9p/welcome @@ -0,0 +1,66 @@ +#!/usr/local/plan9/bin/rc +# display a welcome message that contains the wmii tutorial + +xmessage -file - <<END +Welcome to wmii, the non-wimp environment of the WMI Project. + +This is a small step by step tutorial, intended to make you a little bit +familiar with wmii. + +NOTE: Some characters in shortcuts have a special meaning. S is the Shift +key, C is the Ctrl key, M is the Meta key (usually Alt), and the hyphen means +that you have to press the surrounding keys at the same time. + +Let's go! + +- Start two xterms by pressing M-t twice. +- Switch between the three windows: M-j, M-k + You can also use M-Tab instead of M-j. If you prefer the mouse, then + just click the desired window. +- Create a new page: M-C-y + IMPORTANT: this text will then no longer be visible. In order to continue + reading you'll now often have to go back to the first page. Use M-h + or M-l for cycling through the existing pages. The digit in the left + corner at the bottom indicates which page you're on. You can directly + select a specific page as well: M-S-1, etc. Make sure that you are on the + second page before performing the next steps. +- Apply the float layout to the current page: M-S-f + Watch the leftmost bar label: the 't', which stood for 'tiled', has now + turned into an 'f', for 'float'. +- Open the programs menu: M-C-p + Type 'xclock' and press Enter. +- Resize the xclock window: left-click on the border and, while holding the + button down, move the cursor around. +- Move the xclock window: left-click on the title bar and, while holding + the button down, move the cursor around. +- Open the actions menu: M-C-a + Remove the current page by selecting the rmpage action. The xclock window + will be automatically detached and we'll land on the first page. +- Attach the xclock window again: M-a +- Select one of the terminals and close it: M-C-c + Close xclock as well. +- Swap the remaining terminal with the left master tile by moving the terminal + window somewhere to the left. Afterwards, swap them once again, but this + time by pressing M-Enter. +- Working with mouse efficiently: + selecting a window: just click the desired window + move a window : press M+Button1Press and move the window + resize a window (only with non managed): press M+Button3Press and resize it + (this can also be done by clicking the titlebar of the window/borders respectively) +- We'll now have a look at the internal filesystem used by wmii. Executing + wmiir read / + in the shell of the terminal will list all the files in the root directory. + Files ending with a slash are directories. As you can see, / contains a + "normal" file and four directories. These directories correspond to the + four main components of wmii: wmiiwm, wmiibar, wmiikeys, and wmiimenu. If you + are curious, you can now dig deeper into the directory trees. For instance, + wmiir read /bar/1/b1press + will show you which command gets executed when you left-click on the page + label in the bar. + +We hope that these steps gave you an idea of how wmii works. You can reread +them at any time by pressing M-C-a and selecting 'welcome'. + +You should now take a look at the wmii(1) man page. An FAQ is available on +<http://wmii.de>. +END diff --git a/extra/p9p/wmiirc b/extra/p9p/wmiirc @@ -0,0 +1,154 @@ +#!/usr/local/plan9/bin/rc +# configure wmii + +PIDFILE=/tmp/ns.$USER.$DISPLAY/wmiircpid + +fn xwrite { + echo -n $2 | wmiir write $1 +} +fn maxlab { + awk '/[0-9]+$/ {if($10>max) max=$10} END{print max}' +} + +if(test -r $PIDFILE) { + kill -2 `{cat $PIDFILE} >[2]/dev/null +} +echo $pid >$PIDFILE + +# install signal handler for artificial sigexit: +fn sigint { + if(test -f $PIDFILE && ~ `{cat $PIDFILE} $pid) + rm -f $PIDFILE + exit +} + +CLIENT_BORDER=3 +MODKEY=Alt +WMII_FONT='fixed' +WMII_NORMCOLORS='#222222 #eeeeee #666666' +WMII_SELCOLORS='#ffffff #285577 #4c7899' + + +# WM CONFIGURATION +xwrite /def/border $CLIENT_BORDER +xwrite /def/inc 0 +xwrite /def/snap 20 +xwrite /def/font $WMII_FONT +xwrite /def/selcolors $WMII_SELCOLORS +xwrite /def/normcolors $WMII_NORMCOLORS + +# BAR CONFIGURATION +for(i in `{seq 1 `{wmiir read /bar|maxlab}}) + wmiir remove /bar/1 >/dev/null >[2=1] +xwrite /bar/new/colors $WMII_NORMCOLORS +xwrite /bar/new/colors $WMII_SELCOLORS +xwrite /bar/1/data 1 +xwrite /bar/expand 2 + +# MENU CONFIGURATION +nl=' +' +fn items { + ls -lpQ $* | awk '!/^d/ && $1 ~ /x/ {print $NF}' | sort | uniq +} +items $old_path >/tmp/ns.$USER.$DISPLAY/p.menu & + +# MISC +xsetroot -solid '#0b1014' +status & + +# KEYS CONFIGURATION +for(i in \ + $MODKEY-Control-^(c w,y q,y p a y) \ + $MODKEY-^(t d a n m Return) \ + $MODKEY-^(h l j k Tab ) \ + $MODKEY-Shift-^(a h l p Return) \ + $MODKEY-Shift-^`{seq 1 9} \ + $MODKEY-Control-^`{seq 1 9}) + echo -n | wmiir create /keys/$i + +# EVENT LOOP +wmiir read /event | +while(event=`{read}) { + if(~ $event(1) PN) + xwrite /bar/1/data $event(2) + if(~ $event(1) CN) { + buf=`{echo $"event | sed 's/^CN //'} + xwrite /bar/2/data $"buf + } + if(~ $event(1) CF) { + buf=`{echo $event| awk '{print "warp "$2+6" "$3+6}'} + xwrite /ctl $"buf + } + if(~ $event(1) LB) { # label button press + switch($event(3)) { # button + case 1 + if(~ $event(2) 1) { # label + xwrite /ctl pager + } + if not { + xwrite /ctl 'select prev' + } + case 3 + xwrite /ctl 'select next' + case 4 + xwrite /ctl 'select next' + case 5 + xwrite /ctl 'select prev' + } + } + if(~ $event(1) K) { # key press + switch($event(2)) { + case $MODKEY-Control-c + xwrite /sel/sel/sel/ctl kill + case $MODKEY-Control-w,y + wmiirc & + case $MODKEY-Control-q,y + xwrite /ctl quit + case $MODKEY-Control-p + { + cmd=`{cat /tmp/ns.$USER.$DISPLAY/p.menu | wmiimenu} + if(! ~ $#cmd 0) + extern $cmd + } & + case $MODKEY-Control-a + { + cmd=`{items CONFPREFIX/wmii-3 $HOME/.wmii-3 | wmiimenu} + if(! ~ $#cmd 0) + $cmd + } & + case $MODKEY-t + extern xterm -rv & + case $MODKEY-n + wmiir read /sel/new >/dev/null >[2=1] + case $MODKEY-m + xwrite /sel/sel/sel/ctl max + case $MODKEY-Return + xwrite /sel/sel/sel/ctl 'sendtoarea prev' + case $MODKEY-Shift-Return + xwrite /sel/sel/sel/ctl 'sendtoarea next' + case $MODKEY-Control-y + wmiir read /new >/dev/null >[2=1] + case $MODKEY-h + xwrite /sel/ctl 'select prev' + case $MODKEY-l + xwrite /sel/ctl 'select next' + case $MODKEY-Tab + xwrite /sel/sel/ctl 'select next' + case $MODKEY-j + xwrite /sel/sel/ctl 'select next' + case $MODKEY-k + xwrite /sel/sel/ctl 'select prev' + case $MODKEY-Shift-h + xwrite /ctl 'select prev' + case $MODKEY-Shift-l + xwrite /ctl 'select next' + case $MODKEY-Shift-p + xwrite /ctl pager + case $MODKEY-Shift-[1-9] + xwrite /ctl 'select '^`{echo $event|awk -F- '{print $3}'} + case $MODKEY-Control-[1-9] + xwrite /sel/sel/sel/ctl 'sendtopage '^`{echo $event|awk -F- '{print $3}'} + } + } +} diff --git a/rc/extern b/rc/extern @@ -1,15 +0,0 @@ -#!9PREFIX/bin/rc -# clean the environment and execute the given command - -path=$old_path -old_path=() -apid=() -cmd=() -home=() -ifs=() -pid=() -prompt=() -rcname=() -status=() - -exec $* diff --git a/rc/status b/rc/status @@ -1,30 +0,0 @@ -#!9PREFIX/bin/rc -# periodically print date and load average to the bar - -PIDFILE=/tmp/ns.$USER.$DISPLAY/statuspid - -if(test -r $PIDFILE) { - kill -2 `{cat $PIDFILE} >[2]/dev/null -} -if (~ $1 stop) exit -echo $pid >$PIDFILE - -xwrite /bar/new/colors $WMII_NORMCOLORS -lab=`{wmiir read /bar|maxlab} - -# install signal handler for artificial sigexit: -fn sigint { - if(test -f $PIDFILE && ~ `{cat $PIDFILE} $pid) - rm -f $PIDFILE - wmiir remove /bar/$lab - exit -} - -fn statustext { - # if you need a formatted date, use awk - echo `{date} `{uptime | sed 's/.*://; s/,//g'} -} - -while(text=`{statustext} xwrite /bar/$lab/data $"text){ - sleep 2 -} diff --git a/rc/welcome b/rc/welcome @@ -1,66 +0,0 @@ -#!9PREFIX/bin/rc -# display a welcome message that contains the wmii tutorial - -xmessage -file - <<END -Welcome to wmii, the non-wimp environment of the WMI Project. - -This is a small step by step tutorial, intended to make you a little bit -familiar with wmii. - -NOTE: Some characters in shortcuts have a special meaning. S is the Shift -key, C is the Ctrl key, M is the Meta key (usually Alt), and the hyphen means -that you have to press the surrounding keys at the same time. - -Let's go! - -- Start two xterms by pressing M-t twice. -- Switch between the three windows: M-j, M-k - You can also use M-Tab instead of M-j. If you prefer the mouse, then - just click the desired window. -- Create a new page: M-C-y - IMPORTANT: this text will then no longer be visible. In order to continue - reading you'll now often have to go back to the first page. Use M-h - or M-l for cycling through the existing pages. The digit in the left - corner at the bottom indicates which page you're on. You can directly - select a specific page as well: M-S-1, etc. Make sure that you are on the - second page before performing the next steps. -- Apply the float layout to the current page: M-S-f - Watch the leftmost bar label: the 't', which stood for 'tiled', has now - turned into an 'f', for 'float'. -- Open the programs menu: M-C-p - Type 'xclock' and press Enter. -- Resize the xclock window: left-click on the border and, while holding the - button down, move the cursor around. -- Move the xclock window: left-click on the title bar and, while holding - the button down, move the cursor around. -- Open the actions menu: M-C-a - Remove the current page by selecting the rmpage action. The xclock window - will be automatically detached and we'll land on the first page. -- Attach the xclock window again: M-a -- Select one of the terminals and close it: M-C-c - Close xclock as well. -- Swap the remaining terminal with the left master tile by moving the terminal - window somewhere to the left. Afterwards, swap them once again, but this - time by pressing M-Enter. -- Working with mouse efficiently: - selecting a window: just click the desired window - move a window : press M+Button1Press and move the window - resize a window (only with non managed): press M+Button3Press and resize it - (this can also be done by clicking the titlebar of the window/borders respectively) -- We'll now have a look at the internal filesystem used by wmii. Executing - wmiir read / - in the shell of the terminal will list all the files in the root directory. - Files ending with a slash are directories. As you can see, / contains a - "normal" file and four directories. These directories correspond to the - four main components of wmii: wmiiwm, wmiibar, wmiikeys, and wmiimenu. If you - are curious, you can now dig deeper into the directory trees. For instance, - wmiir read /bar/1/b1press - will show you which command gets executed when you left-click on the page - label in the bar. - -We hope that these steps gave you an idea of how wmii works. You can reread -them at any time by pressing M-C-a and selecting 'welcome'. - -You should now take a look at the wmii(1) man page. An FAQ is available on -<http://wmii.de>. -END diff --git a/rc/wmiirc b/rc/wmiirc @@ -1,154 +0,0 @@ -#!9PREFIX/bin/rc -# configure wmii - -PIDFILE=/tmp/ns.$USER.$DISPLAY/wmiircpid - -fn xwrite { - echo -n $2 | wmiir write $1 -} -fn maxlab { - awk '/[0-9]+$/ {if($10>max) max=$10} END{print max}' -} - -if(test -r $PIDFILE) { - kill -2 `{cat $PIDFILE} >[2]/dev/null -} -echo $pid >$PIDFILE - -# install signal handler for artificial sigexit: -fn sigint { - if(test -f $PIDFILE && ~ `{cat $PIDFILE} $pid) - rm -f $PIDFILE - exit -} - -CLIENT_BORDER=3 -MODKEY=Alt -WMII_FONT='fixed' -WMII_NORMCOLORS='#222222 #eeeeee #666666' -WMII_SELCOLORS='#ffffff #285577 #4c7899' - - -# WM CONFIGURATION -xwrite /def/border $CLIENT_BORDER -xwrite /def/inc 0 -xwrite /def/snap 20 -xwrite /def/font $WMII_FONT -xwrite /def/selcolors $WMII_SELCOLORS -xwrite /def/normcolors $WMII_NORMCOLORS - -# BAR CONFIGURATION -for(i in `{seq 1 `{wmiir read /bar|maxlab}}) - wmiir remove /bar/1 >/dev/null >[2=1] -xwrite /bar/new/colors $WMII_NORMCOLORS -xwrite /bar/new/colors $WMII_SELCOLORS -xwrite /bar/1/data 1 -xwrite /bar/expand 2 - -# MENU CONFIGURATION -nl=' -' -fn items { - ls -lpQ $* | awk '!/^d/ && $1 ~ /x/ {print $NF}' | sort | uniq -} -items $old_path >/tmp/ns.$USER.$DISPLAY/p.menu & - -# MISC -xsetroot -solid '#0b1014' -status & - -# KEYS CONFIGURATION -for(i in \ - $MODKEY-Control-^(c w,y q,y p a y) \ - $MODKEY-^(t d a n m Return) \ - $MODKEY-^(h l j k Tab ) \ - $MODKEY-Shift-^(a h l p Return) \ - $MODKEY-Shift-^`{seq 1 9} \ - $MODKEY-Control-^`{seq 1 9}) - echo -n | wmiir create /keys/$i - -# EVENT LOOP -wmiir read /event | -while(event=`{read}) { - if(~ $event(1) PN) - xwrite /bar/1/data $event(2) - if(~ $event(1) CN) { - buf=`{echo $"event | sed 's/^CN //'} - xwrite /bar/2/data $"buf - } - if(~ $event(1) CF) { - buf=`{echo $event| awk '{print "warp "$2+6" "$3+6}'} - xwrite /ctl $"buf - } - if(~ $event(1) LB) { # label button press - switch($event(3)) { # button - case 1 - if(~ $event(2) 1) { # label - xwrite /ctl pager - } - if not { - xwrite /ctl 'select prev' - } - case 3 - xwrite /ctl 'select next' - case 4 - xwrite /ctl 'select next' - case 5 - xwrite /ctl 'select prev' - } - } - if(~ $event(1) K) { # key press - switch($event(2)) { - case $MODKEY-Control-c - xwrite /sel/sel/sel/ctl kill - case $MODKEY-Control-w,y - wmiirc & - case $MODKEY-Control-q,y - xwrite /ctl quit - case $MODKEY-Control-p - { - cmd=`{cat /tmp/ns.$USER.$DISPLAY/p.menu | wmiimenu} - if(! ~ $#cmd 0) - extern $cmd - } & - case $MODKEY-Control-a - { - cmd=`{items CONFPREFIX/wmii-3 $HOME/.wmii-3 | wmiimenu} - if(! ~ $#cmd 0) - $cmd - } & - case $MODKEY-t - extern xterm -rv & - case $MODKEY-n - wmiir read /sel/new >/dev/null >[2=1] - case $MODKEY-m - xwrite /sel/sel/sel/ctl max - case $MODKEY-Return - xwrite /sel/sel/sel/ctl 'sendtoarea prev' - case $MODKEY-Shift-Return - xwrite /sel/sel/sel/ctl 'sendtoarea next' - case $MODKEY-Control-y - wmiir read /new >/dev/null >[2=1] - case $MODKEY-h - xwrite /sel/ctl 'select prev' - case $MODKEY-l - xwrite /sel/ctl 'select next' - case $MODKEY-Tab - xwrite /sel/sel/ctl 'select next' - case $MODKEY-j - xwrite /sel/sel/ctl 'select next' - case $MODKEY-k - xwrite /sel/sel/ctl 'select prev' - case $MODKEY-Shift-h - xwrite /ctl 'select prev' - case $MODKEY-Shift-l - xwrite /ctl 'select next' - case $MODKEY-Shift-p - xwrite /ctl pager - case $MODKEY-Shift-[1-9] - xwrite /ctl 'select '^`{echo $event|awk -F- '{print $3}'} - case $MODKEY-Control-[1-9] - xwrite /sel/sel/sel/ctl 'sendtopage '^`{echo $event|awk -F- '{print $3}'} - } - } -}