wmii

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

commit de936d8c1720725be4c91c5ae0bb1bcbe6858905
parent 5be1f230b8ec601e74b018e27e398f5d16579e70
Author: Kris Maglione <jg@suckless.org>
Date:   Mon, 28 Sep 2009 20:09:38 -0400

Update docs; install wmii.pdf.

Diffstat:
.hgignore | 2+-
Makefile | 1+
config.mk | 1+
doc/wmii.pdf | 0
doc/wmii.tex | 204++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
man/wmii.1 | 16++++++++++++++--
man/wmii.man1 | 6+++++-
mk/common.mk | 2+-
mk/hdr.mk | 10+++++++++-
mk/wmii.mk | 1+
10 files changed, 236 insertions(+), 7 deletions(-)

diff --git a/.hgignore b/.hgignore @@ -1,7 +1,7 @@ syntax: regexp (^|/)\.((.*\.)?sw.|depend|hgignore)$ (^|/)(tags|mkfile)$ -\.([oa]|out|o_pic|so|orig|bak|pyc|pyo)$ +\.([oa]|out|o_pic|so|orig|bak|pyc|pyo|rej)$ ^cmd/(stfo|osd|wiwarp)(/|$) syntax: glob config.local.mk diff --git a/Makefile b/Makefile @@ -6,6 +6,7 @@ PDIRS = \ libwmii_hack \ rc \ alternative_wmiircs \ + doc \ man DIRS = \ diff --git a/config.mk b/config.mk @@ -4,6 +4,7 @@ PREFIX = /usr/local BIN = $(PREFIX)/bin MAN = $(PREFIX)/share/man + DOC = $(PREFIX)/share/doc/wmii ETC = $(PREFIX)/etc LIBDIR = $(PREFIX)/lib INCLUDE = $(PREFIX)/include diff --git a/doc/wmii.pdf b/doc/wmii.pdf Binary files differ. diff --git a/doc/wmii.tex b/doc/wmii.tex @@ -1057,6 +1057,11 @@ The root filesystem contains the following: ‹Command›. ‹Command› is split according to rc quoting rules, and no expansion occurs. If the command fails to execute, \wmii\ will respawn. + \item[spawn ‹Command›] Spawns ‹Command› as it would spawn + |wmiirc| at startup. If ‹Command› is a single argument + and doesn't begin with |/| or |./|,\hskip 1ex|$WMII_CONFPATH| is + searched for the executable. Otherwise, the whole + argument is passed to the shell for evaluation. \end{description} \item[props] The client's window class (the X11 |WM_CLASS| property) and title string, separated by colons. This file @@ -1108,7 +1113,7 @@ And we need a few more key bindings to select our views: wmiir xwrite /ctl view ${2##*-};; \end{code} -\section{Tying it All Together} +\section{Tieing it All Together} \begin{code} #!/bin/sh @@ -1121,6 +1126,203 @@ And we need a few more key bindings to select our views: «Event Loop» \end{code} +\section{The End Result} + +For clarity, here is the end result: + +\begin{code} + #!/bin/sh + # «Click Menu Initialization» + clickmenu() { + if res=$(wmii9menu -- “$@”); then eval “$res”; fi + } + # «Command Execution Initialization» + terminal() { wmiir setsid xterm “$@” } + proglist() { + IFS=: set -- $1 + find -L $@ -maxdepth 1 -perm /111 | sed ‘s,.*/,,’ | sort | uniq + unset IFS + } + + # «Configuration» + # «Theme Definitions» + normcolors=‘#000000 #c1c48b #81654f’ + focuscolors=‘#000000 #81654f #000000’ + background=‘#333333’ + font=‘drift,-*-fixed-*-*-*-*-9-*-*-*-*-*-*-*’ + + xsetroot -solid $background + wmiir write /ctl <<! + border 2 + focuscolors $focuscolors + normcolors $normcolors + font $font + grabmod Mod4 + ! + + # «Bind Keys» + { + cat <<! + Mod4-space + Mod4-d + Mod4-s + Mod4-m + Mod4-a + Mod4-p + Mod4-t + Mod4-Return + Mod4-Shift-space + Mod4-f + Mod4-Shift-c + Mod4-Shift-t + Mod4-h + Mod4-j + Mod4-k + Mod4-l + Mod4-Shift-h + Mod4-Shift-j + Mod4-Shift-k + Mod4-Shift-l + ! + for i in 1 2 3 4 5 6 7 8 9 0; do + echo Mod4-$i + echo Mod4-Shift-$i + done + } | wmiir write /keys + + # «Event Loop» + # Broadcast a custom event + wmiir xwrite /event Start wmiirc + + # Turn off globbing + set -f + # Open /event for reading + wmiir read /event | + # Read the events line by line + while read line; do + # Split the line into words, store in $@ + set -- $line + event=$1; shift + line = "$(echo $line | sed ‘s/^[^ ]* //’ | tr -d ‘\n’)" + + # Process the event + case $event in + Start) # Quit when a new instance starts + [ $1 = wmiirc ] && exit;; + + # «Event Handlers» + # «View Button Events» + CreateTag) # CreateTag ‹Tag Name› + echo $normcolors $1 | wmiir create /lbar/$1;; + DestroyTag) # DestroyTag ‹Tag Name› + wmiir rm /lbar/$1;; + FocusTag) # FocusTag ‹Tag Name› + wmiir xwrite /lbar/$1 $focuscolors $1;; + UnfocusTag) # UnfocusTag ‹Tag Name› + wmiir xwrite /lbar/$* $normcolors $1;; + + # «Urgency Events» + # The urgency events are ‘Client’ events when the program + # owning the window sets its urgency state. They're ‘Manager’ + # events when wmii or the wmii user sets the state. + UrgentTag) # UrgentTag ‹‘Client’ or ‘Manager’› ‹Tag Name› + wmiir xwrite /lbar/$2 *$2;; + NotUrgentTag) # NotUrgentTag ‹‘Client’ or ‘Manager’› ‹Tag Name› + wmiir xwrite /lbar/$2 $2;; + + # «Unresponsive Clients» + UnresponsiveClient) # UnresponsiveClient ‹Client ID› + { + # Use wihack to make the xmessage a transient window of + # the problem client. This will force it to open in the + # floaing layer of whatever views the client is attached to + resp=$(wihack -transient $1 \ + xmessage -nearmouse -buttons Kill,Wait -print \ + “The following client is not responding.” \ + “What would you like to do?$(echo)” \ + $(wmiir read /client/$1/label)) + [ $resp = Kill ] && wmiir xwrite /client/$1/ctl slay + } &;; + + # «Notice Events» + Notice) + wmiir xwrite /rbar/!notice $line + kill $xpid 2>/dev/null # Let's hope this isn't reused... + { sleep 5; wmiir xwrite /rbar/!notice ‘ ’; } & + xpid = $!;; + + # «Key Events» + Key) # Key ‹Key Name› + case $1 in + # «Motion Keys» + Mod4-h) wmiir xwrite /tag/sel/ctl select left;; + Mod4-l) wmiir xwrite /tag/sel/ctl select right;; + Mod4-k) wmiir xwrite /tag/sel/ctl select up;; + Mod4-j) wmiir xwrite /tag/sel/ctl select down;; + Mod4-space) wmiir xwrite /tag/sel/ctl select toggle;; + + # «Client Movement Keys» + Mod4-Shift-h) wmiir xwrite /tag/sel/ctl send sel left;; + Mod4-Shift-l) wmiir xwrite /tag/sel/ctl send sel right;; + Mod4-Shift-k) wmiir xwrite /tag/sel/ctl send sel up;; + Mod4-Shift-j) wmiir xwrite /tag/sel/ctl send sel down;; + Mod4-Shift-space) wmiir xwrite /tag/sel/ctl send sel toggle;; + + # «Column Mode Keys» + Mod4-d) wmiir xwrite /tag/sel/ctl colmode sel -stack-max;; + Mod4-s) wmiir xwrite /tag/sel/ctl colmode sel stack-max;; + Mod4-m) wmiir xwrite /tag/sel/ctl colmode sel stack+max;; + + # «Client Command Keys» + Mod4-Shift-c) wmiir xwrite /client/sel/ctl kill;; + Mod4-f) wmiir xwrite /client/sel/ctl Fullscreen toggle;; + + # «Command Execution Keys» + Mod4-Return) terminal & ;; + Mod4-p) eval exec wmiir setsid "$(proglist $PATH | wimenu)" &;; + Mod4-a) { + set -- $(proglist $WMII_CONFPATH | wimenu) + prog = $( (PATH=$WMII_CONFPATH which $1) ); shift + eval exec $prog “$@” + } &;; + + # «Tag Selection Keys» + Mod4-Shift-t) + # Prompt the user for a tag + tags=$(wmiir ls /tag | sed ‘s,/,,; /sel/d’ | wimenu) + # Write it to the filesystem. + wmiir xwrite /ctl view $tag;; + Mod4-[0-9]) + wmiir xwrite /ctl view ${2##*-};; + + # «Tagging Keys» + Mod4-Shift-t) + # Get the selected client's id + c=$(wmiir read /client/sel/tag | sed 1q) + # Prompt the user for new tags + tags=$(wmiir ls /tag | sed ‘s,/,,; /sel/d’ | wimenu) + # Write them to the client + wmiir xwrite /client/$c/tags $tag;; + Mod4-Shift-[0-9]) + wmiir xwrite /client/sel/tags ${2##*-};; + + esac;; + + # «Client Menu Events» + ClientMouseDown) # ClientMouseDown ‹Client ID› ‹Button› + [ $2 = 3 ] && clickmenu \ + “Delete:xwrite /client/$1/ctl kill” \ + “Kill:xwrite /client/$1/ctl slay” \ + “Fullscreen:/client/$1/ctl Fullscreen on” + + # «Tag Menu Events» + LeftBarMouseDown) # LeftBarMouseDown ‹Button› ‹Bar Name› + [ $1 = 3 ] && clickmenu \ + “Delete:delete_view $2” + esac + done +\end{code} + \backmatter \printindex diff --git a/man/wmii.1 b/man/wmii.1 @@ -359,6 +359,15 @@ Quit \fBwmii\fR exec \fI<prog>\fR Replace \fBwmii\fR with \fI<prog>\fR +.RS +: spawn \fI<prog>\fR +.RS +Spawn a new program, as if by the \fI\-r\fR flag. +.RE +.RE +.P + : +: .SS The /client/ Hierarchy .P @@ -525,10 +534,10 @@ them. /tmp/ns.\fB$USER\fR.\fB${DISPLAY\fR%.0\fB}\fR/wmii The wmii socket file which provides a 9P service. .TP -/home/kris/wmiiinst/etc/wmii\-3.5 +/home/kris/wmiiinst/etc/wmii-hg Global action directory. .TP -\fB$HOME\fR/.wmii\-3.5 +\fB$HOME\fR/.wmii-hg User\-specific action directory. Actions are first searched here. @@ -550,6 +559,9 @@ Socket file of Used by wmiir(1). dmenu(1), wmiir(1) .P +/home/kris/wmiiinst/share/doc/wmii/wmii.pdf + +.P \fI[1]\fR http://www.suckless.org/wiki/wmii/tips/9p_tips diff --git a/man/wmii.man1 b/man/wmii.man1 @@ -10,7 +10,7 @@ wmii - Window Manager Improved Improved = SYNOPSIS = -wmii [-a <address>] [-c <wmiirc>] + +wmii [-a <address>] [-r <wmiirc>] + wmii -v = DESCRIPTION = @@ -300,6 +300,8 @@ follows. Quit `wmii` : exec <prog> Replace `wmii` with <prog> + : spawn <prog> + Spawn a new program, as if by the _-r_ flag. : : @@ -451,5 +453,7 @@ thus can be used in actions: = SEE ALSO = dmenu(1), wmiir(1) +@DOCDIR@/wmii.pdf + [1] http://www.suckless.org/wiki/wmii/tips/9p_tips diff --git a/mk/common.mk b/mk/common.mk @@ -4,7 +4,7 @@ install: all MANDIRS=$(MAN)/man1 mkdirs: - for i in $(BIN) $(ETC) $(LIBDIR) $(MANDIRS) $(INCLUDE); do \ + for i in $(BIN) $(ETC) $(DOC) $(LIBDIR) $(MANDIRS) $(INCLUDE); do \ test -d $(DESTDIR)$$i || echo MKDIR $$i; \ mkdir -pm 0755 $(DESTDIR)$$i; \ done diff --git a/mk/hdr.mk b/mk/hdr.mk @@ -29,7 +29,7 @@ BINSH := $(shell \ BINSH != echo /bin/sh .SILENT: -.SUFFIXES: .out .o .o_pic .c .sh .rc .$(SOEXT) .awk .1 .man1 .depend .install .uninstall .clean +.SUFFIXES: .out .o .o_pic .c .pdf .sh .rc .$(SOEXT) .awk .1 .man1 .depend .install .uninstall .clean all: .c.depend: @@ -87,6 +87,14 @@ all: echo UNINSTALL $$($(CLEANNAME) $(BASE)$<) rm -f $(DESTDIR)$(INCLUDE)/$< +.pdf.install: + echo INSTALL $$($(CLEANNAME) $(BASE)$<) + cp -f $< $(DESTDIR)$(DOC)/$< + chmod 0644 $(DESTDIR)$(DOC)/$< +.pdf.uninstall: + echo UNINSTALL $$($(CLEANNAME) $(BASE)$<) + rm -f $(DESTDIR)$(DOC)/$< + .1.install: set -e; \ man=1; \ diff --git a/mk/wmii.mk b/mk/wmii.mk @@ -11,6 +11,7 @@ CFLAGS += '-DVERSION=\"$(VERSION)\"' '-DCOPYRIGHT=\"$(COPYRIGHT)\"' \ FILTER = sed "s|@CONFPREFIX@|$(ETC)|g; \ s|@CONFVERSION@|$(CONFVERSION)|g; \ s|@P9PATHS@|$(P9PATHS)|g; \ + s|@DOCDIR@|$(DOC)|g; \ s|@LIBDIR@|$(LIBDIR)|g; \ s|@BINSH@|$(BINSH)|g; \ s|@AWKPATH@|$(AWKPATH)|g"