wmii

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

commit d9486fa4196f99c02a6c20ce0d049a7e6ef2a8ad
parent c3b818e241b26c78595594c1a48587b2940f4129
Author: Kris Maglione <kris@suckless.org>
Date:   Wed, 16 Jun 2010 18:32:09 -0400

[guide] Some updates to wmii.pdf to track the man pages.

Diffstat:
cmd/menu/Makefile | 1-
cmd/strut/Makefile | 1-
cmd/wmii/Makefile | 1-
cmd/wmii/dat.h | 1-
cmd/wmii/fns.h | 2+-
cmd/wmii/fs.c | 82++++++++++++++++++++++++++++++++++++++++----------------------------------------
cmd/wmii/main.c | 2+-
cmd/wmii/print.c | 6+++---
debian/changelog | 6+++---
doc/wmii.tex | 149++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------
mk/wmii.mk | 3++-
util/link | 2+-
12 files changed, 151 insertions(+), 105 deletions(-)

diff --git a/cmd/menu/Makefile b/cmd/menu/Makefile @@ -16,7 +16,6 @@ PACKAGES += $(X11PACKAGES) LIB = $(LIBS9) $(LIBIXP) LIBS += -lm -CFLAGS += -DIXP_NEEDAPI=86 OBJ = main \ caret \ history \ diff --git a/cmd/strut/Makefile b/cmd/strut/Makefile @@ -11,7 +11,6 @@ PACKAGES += $(X11PACKAGES) LIB = $(LIBS9) LIBS += -lm -CFLAGS += -DIXP_NEEDAPI=86 OBJ = main \ ewmh \ win diff --git a/cmd/wmii/Makefile b/cmd/wmii/Makefile @@ -13,7 +13,6 @@ PACKAGES += $(X11PACKAGES) xext xrandr xrender xinerama LIB = $(LIBIXP) $(LIBS9) LIBS += -lm -CFLAGS += $(INCICONV) -DIXP_NEEDAPI=97 OBJ = area \ bar \ backtrace \ diff --git a/cmd/wmii/dat.h b/cmd/wmii/dat.h @@ -3,7 +3,6 @@ */ #define _XOPEN_SOURCE 600 -#define IXP_P9_STRUCTS #define IXP_NO_P9_ #include <assert.h> #include <regexp9.h> diff --git a/cmd/wmii/fns.h b/cmd/wmii/fns.h @@ -184,7 +184,7 @@ void fs_attach(Ixp9Req*); void fs_clunk(Ixp9Req*); void fs_create(Ixp9Req*); void fs_flush(Ixp9Req*); -void fs_freefid(Fid*); +void fs_freefid(IxpFid*); void fs_open(Ixp9Req*); void fs_read(Ixp9Req*); void fs_remove(Ixp9Req*); diff --git a/cmd/wmii/fs.c b/cmd/wmii/fs.c @@ -195,7 +195,7 @@ dwrite(int flag, void *buf, int n, bool always) { static uint fs_size(IxpFileId*); static void -dostat(Stat *s, IxpFileId *f) { +dostat(IxpStat *s, IxpFileId *f) { s->type = 0; s->dev = 0; s->qid.path = QID(f->tab.type, f->id); @@ -363,7 +363,7 @@ fs_attach(Ixp9Req *r) { r->fid->qid.type = f->tab.qtype; r->fid->qid.path = QID(f->tab.type, 0); r->ofcall.rattach.qid = r->fid->qid; - respond(r, nil); + ixp_respond(r, nil); } void @@ -394,7 +394,7 @@ fs_size(IxpFileId *f) { void fs_stat(Ixp9Req *r) { IxpMsg m; - Stat s; + IxpStat s; int size; char *buf; IxpFileId *f; @@ -402,7 +402,7 @@ fs_stat(Ixp9Req *r) { f = r->fid->aux; if(!ixp_srv_verifyfile(f, lookup_file)) { - respond(r, Enofile); + ixp_respond(r, Enofile); return; } @@ -415,7 +415,7 @@ fs_stat(Ixp9Req *r) { ixp_pstat(&m, &s); r->ofcall.rstat.stat = (uchar*)m.data; - respond(r, nil); + ixp_respond(r, nil); } void @@ -427,7 +427,7 @@ fs_read(Ixp9Req *r) { f = r->fid->aux; if(!ixp_srv_verifyfile(f, lookup_file)) { - respond(r, Enofile); + ixp_respond(r, Enofile); return; } @@ -443,49 +443,49 @@ fs_read(Ixp9Req *r) { switch(f->tab.type) { case FsFprops: ixp_srv_readbuf(r, f->p.client->props, strlen(f->p.client->props)); - respond(r, nil); + ixp_respond(r, nil); return; case FsFColRules: case FsFRules: ixp_srv_readbuf(r, f->p.rule->string, f->p.rule->size); - respond(r, nil); + ixp_respond(r, nil); return; case FsFKeys: ixp_srv_readbuf(r, def.keys, def.keyssz); - respond(r, nil); + ixp_respond(r, nil); return; case FsFCtags: ixp_srv_readbuf(r, f->p.client->tags, strlen(f->p.client->tags)); - respond(r, nil); + ixp_respond(r, nil); return; case FsFClabel: ixp_srv_readbuf(r, f->p.client->name, strlen(f->p.client->name)); - respond(r, nil); + ixp_respond(r, nil); return; case FsFBar: ixp_srv_readbuf(r, f->p.bar->buf, strlen(f->p.bar->buf)); - respond(r, nil); + ixp_respond(r, nil); return; case FsFRctl: buf = readctl_root(); ixp_srv_readbuf(r, buf, strlen(buf)); - respond(r, nil); + ixp_respond(r, nil); return; case FsFCctl: buf = readctl_client(f->p.client); ixp_srv_readbuf(r, buf, strlen(buf)); - respond(r, nil); + ixp_respond(r, nil); return; case FsFTindex: buf = view_index(f->p.view); ixp_srv_readbuf(r, buf, strlen(buf)); - respond(r, nil); + ixp_respond(r, nil); return; case FsFTctl: buf = readctl_view(f->p.view); n = strlen(buf); ixp_srv_readbuf(r, buf, n); - respond(r, nil); + ixp_respond(r, nil); return; } } @@ -502,18 +502,18 @@ fs_write(Ixp9Req *r) { uint i; if(r->ifcall.io.count == 0) { - respond(r, nil); + ixp_respond(r, nil); return; } f = r->fid->aux; if(!ixp_srv_verifyfile(f, lookup_file)) { - respond(r, Enofile); + ixp_respond(r, Enofile); return; } if(waserror()) { - respond(r, ixp_errbuf()); + ixp_respond(r, ixp_errbuf()); return; } @@ -521,11 +521,11 @@ fs_write(Ixp9Req *r) { case FsFColRules: case FsFRules: ixp_srv_writebuf(r, &f->p.rule->string, &f->p.rule->size, 0); - respond(r, nil); + ixp_respond(r, nil); break; case FsFKeys: ixp_srv_writebuf(r, &def.keys, &def.keyssz, 0); - respond(r, nil); + ixp_respond(r, nil); break; case FsFClabel: ixp_srv_data2cstring(r); @@ -535,13 +535,13 @@ fs_write(Ixp9Req *r) { frame_draw(f->p.client->sel); update_class(f->p.client); r->ofcall.io.count = r->ifcall.io.count; - respond(r, nil); + ixp_respond(r, nil); break; case FsFCtags: ixp_srv_data2cstring(r); client_applytags(f->p.client, r->ifcall.io.data); r->ofcall.io.count = r->ifcall.io.count; - respond(r, nil); + ixp_respond(r, nil); break; case FsFBar: i = strlen(f->p.bar->buf); @@ -549,7 +549,7 @@ fs_write(Ixp9Req *r) { ixp_srv_writebuf(r, &p, &i, 279); bar_load(f->p.bar); r->ofcall.io.count = i - r->ifcall.io.offset; - respond(r, nil); + ixp_respond(r, nil); break; case FsFCctl: mf = (MsgFunc)message_client; @@ -563,7 +563,7 @@ fs_write(Ixp9Req *r) { msg: errstr = ixp_srv_writectl(r, mf); r->ofcall.io.count = r->ifcall.io.count; - respond(r, errstr); + ixp_respond(r, errstr); break; case FsFEvent: if(r->ifcall.io.data[r->ifcall.io.count-1] == '\n') @@ -571,7 +571,7 @@ fs_write(Ixp9Req *r) { else event("%.*s\n", (int)r->ifcall.io.count, r->ifcall.io.data); r->ofcall.io.count = r->ifcall.io.count; - respond(r, nil); + ixp_respond(r, nil); break; default: /* This should not be called if the file is not open for writing. */ @@ -588,7 +588,7 @@ fs_open(Ixp9Req *r) { f = r->fid->aux; if(!ixp_srv_verifyfile(f, lookup_file)) { - respond(r, Enofile); + ixp_respond(r, Enofile); return; } @@ -606,9 +606,9 @@ fs_open(Ixp9Req *r) { || (r->ifcall.topen.mode&3) != OREAD && !(f->tab.perm & 0200) || (r->ifcall.topen.mode&3) != OWRITE && !(f->tab.perm & 0400) || (r->ifcall.topen.mode & ~(3|OAPPEND|OTRUNC))) - respond(r, Enoperm); + ixp_respond(r, Enoperm); else - respond(r, nil); + ixp_respond(r, nil); } void @@ -619,24 +619,24 @@ fs_create(Ixp9Req *r) { switch(f->tab.type) { default: - respond(r, Enoperm); + ixp_respond(r, Enoperm); return; case FsDBars: if(!strlen(r->ifcall.tcreate.name)) { - respond(r, Ebadvalue); + ixp_respond(r, Ebadvalue); return; } bar_create(f->p.bar_p, r->ifcall.tcreate.name); f = lookup_file(f, r->ifcall.tcreate.name); if(!f) { - respond(r, Enofile); + ixp_respond(r, Enofile); return; } r->ofcall.ropen.qid.type = f->tab.qtype; r->ofcall.ropen.qid.path = QID(f->tab.type, f->id); f->next = r->fid->aux; r->fid->aux = f; - respond(r, nil); + ixp_respond(r, nil); break; } } @@ -648,20 +648,20 @@ fs_remove(Ixp9Req *r) { f = r->fid->aux; if(!ixp_srv_verifyfile(f, lookup_file)) { - respond(r, Enofile); + ixp_respond(r, Enofile); return; } switch(f->tab.type) { default: - respond(r, Enoperm); + ixp_respond(r, Enoperm); return; case FsFBar: s = f->p.bar->screen; bar_destroy(f->next->p.bar_p, f->p.bar); bar_draw(s); - respond(r, nil); + ixp_respond(r, nil); break; } } @@ -672,7 +672,7 @@ fs_clunk(Ixp9Req *r) { f = r->fid->aux; if(!ixp_srv_verifyfile(f, lookup_file)) { - respond(r, nil); + ixp_respond(r, nil); return; } @@ -694,7 +694,7 @@ fs_clunk(Ixp9Req *r) { update_keys(); break; } - respond(r, nil); + ixp_respond(r, nil); } void @@ -707,12 +707,12 @@ fs_flush(Ixp9Req *r) { if(f->pending) ixp_pending_flush(r); /* else die() ? */ - respond(r->oldreq, Einterrupted); - respond(r, nil); + ixp_respond(r->oldreq, Einterrupted); + ixp_respond(r, nil); } void -fs_freefid(Fid *f) { +fs_freefid(IxpFid *f) { IxpFileId *id, *tid; tid = f->aux; diff --git a/cmd/wmii/main.c b/cmd/wmii/main.c @@ -405,7 +405,7 @@ main(int argc, char *argv[]) { event_debug = debug_event; srv.preselect = event_preselect; - ixp_listen(&srv, sock, &p9srv, serve_9pcon, nil); + ixp_listen(&srv, sock, &p9srv, ixp_serve9conn, nil); ixp_listen(&srv, ConnectionNumber(display), nil, event_fdready, closedisplay); def.border = 1; diff --git a/cmd/wmii/print.c b/cmd/wmii/print.c @@ -34,15 +34,15 @@ static char* fcnames[] = { }; static int -qid(Fmt *f, Qid *q) { +qid(Fmt *f, IxpQid *q) { return fmtprint(f, "(%uhd,%uld,%ullx)", q->type, q->version, q->path); } int Ffmt(Fmt *f) { - Fcall *fcall; + IxpFcall *fcall; - fcall = va_arg(f->args, Fcall*); + fcall = va_arg(f->args, IxpFcall*); fmtprint(f, "% 2d %s\t", fcall->hdr.tag, fcnames[fcall->hdr.type - TVersion]); switch(fcall->hdr.type) { case TVersion: diff --git a/debian/changelog b/debian/changelog @@ -1,5 +1,5 @@ -wmii-hg (hg2608) unstable; urgency=low +wmii-hg (hg2728) unstable; urgency=low - * Closes issue #175. + * Remove long deprecated special treatment of the '!' tag. - -- Kris Maglione <jg@suckless.org> Mon, 17 May 2010 12:35:12 -0400 + -- Kris Maglione <kris@suckless.org> Tue, 15 Jun 2010 15:13:12 -0400 diff --git a/doc/wmii.tex b/doc/wmii.tex @@ -236,19 +236,24 @@ the state they describe. For instance, client. If a client is fullscreen, it contains the line: \begin{code} - Fullscreen on + fullscreen on \end{code} \noindent To change this, you'd update the file with the line -% XXX: Broken /ctl cmd. -|Fullscreen off| or even |Fullscreen| |toggle| to toggle +% XXX: Line broken at /ctl cmd. +|fullscreen off| or even |fullscreen| |toggle| to toggle the client's fullscreen state. The concept of controlling a program via a filesystem derives from Plan 9, where such interfaces are extensive and well -proven. The metaphor has shown itself to be quite intuitive to -Unix users, once the shock of a “virtual” filesystem wears off. -The flexibility of being able to control \wmii\ from myriad +proven\footnote{The concept has also taken hold on most Unixes +in the form of \texttt{/proc} and \texttt{/sys} virtual +filesystems, but tends to be very kernel-centric. On Plan 9, +where the model is more pervasive, there are more virtual +filesystems for user-level applications than for the kernel.}. +The metaphor has shown itself to be quite intuitive to Unix +users, once the shock of a “virtual” filesystem wears off. The +flexibility of being able to control \wmii\ from myriad programming languages, including the standard Unix shell and even from the command line, is well worth the shock. @@ -780,8 +785,9 @@ scope of this document. Key names can be detected by running |xev| from a terminal, pressing the desired key, and looking at the output -(it's in the parentheses, after the keysym). A \wmii-specific -utility is forthcoming. +(it's in the parentheses, after the keysym). Or, more simply, +you can run the \man 1 {wikeyname} utility bundled with \wmii\ +and press the key you wish to bind. Examples of key bindings: @@ -874,19 +880,19 @@ writing new values to the control file. For instance, if a client is fullscreen, its control file will contain the line: \begin{code} - Fullscreen on + fullscreen on \end{code} \noindent To restore the client from fullscreen, either of the following lines may be written to its control file: \begin{code} - Fullscreen off - Fullscreen toggle + fullscreen off + fullscreen toggle \end{code} -When next read, the |Fullscreen on| line will have been replaced -with |Fullscreen off|. No care need be taken to preserve the +When next read, the |fullscreen on| line will have been replaced +with |fullscreen off|. No care need be taken to preserve the other contents of the file. They're generated anew each time it's read. @@ -903,15 +909,39 @@ client. The files in these directories are: \item[ctl] The control file. The properties are: \index{filesystem!/client/*/@\clientlabel!ctl} \begin{description} - \item[Fullscreen] The client's fullscreen state. When + \item[allow] The set of unusual actions the client is + allowed to perform, in the same format as the tag set. + \begin{description} + \item[activate] The client is allowed to activate + itself—that is, focus its window and, as the case may + require, uncollapse it and select a tag it resides on. + This flag must be set on a client if you wish it able to + activate itself from the system tray. + \end{description} + \item[floating] Defines whether this client is likely to + float when attached to a new view. May be |on|, |off|, + |always|, or |never|. Ordinarilly, the value changes + automatically whenever the window is moved between the + floating and managed layers. However, setting a value of + |always| or |never| overrides this behavior. + \item[fullscreen] The client's fullscreen state. When |on|, the client is displayed fullscreen on all of its views. Possible values are |on|, |off|, and |toggle|. - \item[Urgent] The client's urgency state. When |on|, the - client's layout box will be highlighted. Possible values - are |on|, |off|, and |toggle|. + \item[group] The client's group ID, or 0 if not part of a + group. Clients tend to open with the same tags and in + the same columns as the last active member of their + group. Setting this property is only useful when done + via the rules file. \item[kill] When written, the window is closed politely, if possible. + \item[pid] Read-only value of the PID of the program that + owns the window, if the value is available and the + process is on the same machine as wmii. \item[slay] When written, the client is killed peremptorily. + \item[tags] The client's tags. The same as the tags file. + \item[urgent] The client's urgency state. When |on|, the + client's layout box will be highlighted. Possible values + are |on|, |off|, and |toggle|. \end{description} \item[props] The client's window class (the X11 |WM_CLASS| property) and title string, separated by colons. This file @@ -922,14 +952,20 @@ client. The files in these directories are: \index{filesystem!/client/*/@\clientlabel!label} \item[tags] \index{filesystem!/client/*/@\clientlabel!tags} - The client's tags. Tag names are separated by |+| - signs. Tags beginning and ending with |/| are treated as - regular expressions. If the written value begins with a |+| - or a |-|, the tags are updated rather than overwritten. Tag - names which directly follow a |-| sign are removed rather - than added. Regular expression tags which directly follow a - minus sign are treated as exclusion expressions. For - example, the tag string |+/foo/-/food/| will match the tag + The client's tags. Tag names are separated by |+|, |-|, or + |^| signs. Tags beginning and ending with |/| are treated as + regular expressions, which place the client on any extant + matching tag\footnote{While a client with a regex tag will + always appear in all matching views, it will not keep those + views in existence. When the last client explicitly tagged + with a view is removed, the view is deleted as soon as it + becomes inactive.}. If the written value begins with a |+|, + |-|, or |^|, the tags are updated rather than overwritten. + Tag names which directly follow a |-| sign are removed + rather than added, while those following a |^| are toggled. + Regular expression tags which directly follow a minus sign + are treated as exclusion expressions. For example, the tag + string |+/foo/-/food/| will match the tag |foobar|, but not the tag |foodstand|. \end{description} @@ -967,9 +1003,9 @@ And to manage their tags, we'll need: «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” + “Delete:wmiir xwrite /client/$1/ctl kill” \ + “Kill: wmiirxwrite /client/$1/ctl slay” \ + “Fullscreen:wmiir xwrite /client/$1/ctl fullscreen on” \end{code} \subsection{Unresponsive Clients} @@ -1128,8 +1164,8 @@ IDs to prevent untoward effects when this script dies. «Command Execution Initialization» ::= terminal() { wmiir setsid xterm “$@” } proglist() { - IFS=: set -- $1 - find -L $@ -maxdepth 1 -perm /111 | sed ‘1d; s,.*/,,’ | sort | uniq + IFS=: + wmiir proglist $1 | sort | uniq unset IFS } \end{code} @@ -1232,22 +1268,35 @@ The root filesystem contains the following: If there is no ‹n›th width, it is given $1/\mbox{‹ncol›th}$ of the screen. - \item[tagrules] - \index{filesystem!/!tagrules} - The |/tagrules| file contains a list of - rules similar to the colrules. These rules specify - the tags a client is to be given when it is created. - Rules are specified: + \item[rules] + \index{filesystem!/!rules} + The |/rules| file contains a list of + rules similar to the colrules. These rules set + properties for a client when it is created. + Rules are specified: - \begin{quote}\texttt{ - /‹regex›/ -> ‹tag›{\color{gray}[}+‹tag›{\color{gray}]*}} - \end{quote} + \begin{quote}\texttt{ + /‹regex›/ -> ‹key›{\color{gray}=}‹value› {\color{gray}\ldots}} + \end{quote} + + When a client's ‹name›:‹class›:‹title› matches + ‹regex›, the matching rules are applied. For each + ‹key›=‹value› pair, the |ctl| file property matching + ‹key› is set to ‹value›. Additionally, the following + keys are accepted and have special meaning: + + \begin{description} + \item[continue] + Normally, when a matching rule is encountered, + rule matching stops. When the continue key is + provided (with any value), matching continues at + the next rule. + \item[force-tags] + Like tags, but overrides any settings obtained + obtained from the client's group or from the + |_WMII_TAGS| window property. + \end{description} - When a client's ‹name›:‹class›:‹title› matches - ‹regex›, it is given the tagstring ‹tag›. There are - two special tags. |!|, which is deprecated, and identical - to |sel|, represents the current tag. |~| - represents the floating layer. \end{description} \index{!filesystem!/|)} @@ -1312,8 +1361,8 @@ For clarity, here is the end result: # «Command Execution Initialization» terminal() { wmiir setsid xterm “$@” } proglist() { - IFS=: set -- $1 - find -L $@ -maxdepth 1 -perm /111 | sed ‘1d; s,.*/,,’ | sort | uniq + IFS=: + wmiir proglist $1 | sort | uniq unset IFS } @@ -1448,7 +1497,7 @@ For clarity, here is the end result: # «Client Command Keys» Mod4-Shift-c) wmiir xwrite /client/sel/ctl kill;; - Mod4-f) wmiir xwrite /client/sel/ctl Fullscreen toggle;; + Mod4-f) wmiir xwrite /client/sel/ctl fullscreen toggle;; # «Command Execution Keys» Mod4-Return) terminal & ;; @@ -1484,9 +1533,9 @@ For clarity, here is the end result: # «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” + “Delete:wmiir xwrite /client/$1/ctl kill” \ + “Kill:wmiir xwrite /client/$1/ctl slay” \ + “Fullscreen:wmiir xwrite /client/$1/ctl fullscreen on” # «Tag Menu Events» LeftBarMouseDown) # LeftBarMouseDown ‹Button› ‹Bar Name› diff --git a/mk/wmii.mk b/mk/wmii.mk @@ -20,7 +20,8 @@ LIBS9 = $(ROOT)/lib/libstuff.a $(ROOT)/lib/libregexp9.a $(ROOT)/lib/libbio.a $(R CFLAGS += '-DVERSION=\"$(VERSION)\"' '-DCOPYRIGHT=\"$(COPYRIGHT)\"' \ '-DCONFDIR=\"$(CONFDIR)\"' '-DCONFPREFIX=\"$(ETC)\"' \ - '-DLOCALCONF=\"$(LOCALCONF)\"' '-DGLOBALCONF=\"$(GLOBALCONF)\"' + '-DLOCALCONF=\"$(LOCALCONF)\"' '-DGLOBALCONF=\"$(GLOBALCONF)\"' \ + -DIXP_NEEDAPI=127 FILTER = sed "s|@CONFPREFIX@|$(ETC)|g; \ s|@GLOBALCONF@|$(GLOBALCONF)|g; \ diff --git a/util/link b/util/link @@ -27,7 +27,7 @@ echo LD "$($bin/cleanname ${BASE}$outfile)" [ -n "$noisycc" ] && echo $LD -o $outfile $ofiles $LDFLAGS $args $LD -o $outfile $ofiles $LDFLAGS $args >$xtmp 2>&1 status=$? -[ $status -eq 0 ] || $LD -o $outfile $ofiles $LDFLAGS $args >&2 +[ $status -eq 0 ] || echo $LD -o $outfile $ofiles $LDFLAGS $args >&2 sed 's/.*: In function `[^:]*: *//' $xtmp | egrep . | egrep -v 'is almost always misused|is dangerous, better use|in statically linked applications requires at runtime'