From: Kim W. <ki...@wo...> - 2003-12-07 09:59:37
|
Mike Frysinger wrote: > when trying to wipe through my windows via cmdline (because some stupid game > stole my mouse or whatever) i get annoyed when trying to type out window > ids ... sometimes i incorrectly count the # of 0's or the simple factor of > trying to type a hex number at lightning speed gets the better of me ... > > either way, when i screw up, it makes me angry because i have to retype the > damned thing ;) > > so i made a patch to enable a cheap search/match ... just type 'p' and then > the first few bits of the window id ... p stands for partial ... > for example: > <eesh example> > root@vapier 0 root # eesh > wl > 1800045 : root@vapier:~ > 120153c : patch to make eesh even more obscure - KMail > 40027e : 0 > 1600002 : X-Chat [2.0.6]: SpanKY @ lepton.oftc.net / #gentoo (+stncl 69) > wop p16 move 0 0 > </eesh example> > here we did a partial match against the window id 1600002. > > the matching does a string comparison starting with the first few > characters ... why you ask ? because we english speakers read right to left > and the first few chars are usually pretty nicely distributed ... > > at any rate, the algorithm just looks until it gets a match ... so if in the > previous case i typed 'p1' it would have matched '1800045' instead of > something else ... > yes i know the order changes as you focus other windows or do whatever, but in > the space of typing 'eesh' and then 'wop p###' i doubt the order will > change ... and if it does, well you should have typed out the window id :P > > i also added a few shortcuts for the move, raise, and lower window operations > (m, r, and l respectively of course) While trying out your patch, I got carried away and took it a bit further: - Most ops can be abbreviated down to two characters. Your m, r, and l are mo, ra, and lo, respectively. - Window matching by full or partial window ID, or by window title substring. - The window list now prints the 0x prefix in window ID's for compliance with usual X notation. Examples, all moving the X-Chat window to (0,0): - Match by window ID (first char is a digit) wop 1600002 mo 0 0 wop 0x1600002 mo 0 0 - Match by partial window ID (prefix '+') wop +16 mo 0 0 - Match by window title (prefix '=' and the rest) wop =2 mo 0 0 wop SpanKY mo 0 0 /Kim |