• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

Patch.rs1H A D16-Nov-201450.7 KiB2,0481,952

Patch.rs1.nfoH A D16-Nov-20142.8 KiB8366

README.keybindingsH A D16-Nov-20143.1 KiB8961

README.menuH A D16-Nov-2014880 3723

README.remoteH A D16-Nov-20143.1 KiB10171

README.keybindings

1With the keybinding patch you can bind a key to run an external
2command.  There are two types of bindings:
3
41. When the wmx-modifier is pressed [the one defined to CONFIG_ALT_KEY
5in Config.h].
6
72. When no modifiers are pressed.
8
9Actually, in both of the above cases the state of caps-lock and
10num-lock is ignored.
11
12When wmx starts up it examines the ~/.wmx directory, which
13traditionally consisted of two things.  Executable files (or usually
14symlinks to them) are the commands that appear on the Command Menu
15(the middle button in the root, and the options file is parsed at
16startup (by Config.C).
17
18With the keybinding patch wmx checks for 2 additional directories:
19.keys and .mkeys.
20
21When wmx starts up it examines these directories for executable files
22whose filename is a valid keymap name.  For example "F1" and
23"KP_Enter" are valid.  So is "1" but "f1" is probably not.
24
25Files in the .keys directory are activated when the key is pressed
26without any modifier (such as Shift, Control or Meta).
27
28Files in the .mkeys directory are activated when the key is pressed
29and the wmx-modifier key is pressed.  (The wmx-modifier is defined in
30Config.h;  the default is Alt, but I reccomend changing it.  Super_L
31is usually a good choice.)
32
33(For convenience the num-lock and caps-lock is ignored, so "no
34modifiers" and "only wmx modifier" really isn't quite correct.)
35
36
37For example,  suppose ~/.wmx/.keys/F1 contains
38
39------------------------------------------------------------------------
40#! /bin/sh
41xlogo -title F1
42------------------------------------------------------------------------
43
44then when you press F1 an xlogo pops up with F1 in the title bar.  If
45the file were moved to ~/.wmx/.mkeys/F1 then you would have to have
46the wmx-modifier key held down when you pressed F1.
47
48Ok, that's not an exciting example.
49
50
51A really useful program is xwit:
52	http://www.x.org/contrib/utilities/xwit-3.4.tar.gz
53This allows you to do "window manager type things" from a shell script.
54For example, you can move a window to an absolute location or relative
55to its current position.
56
57When wmx calls a file because of a keybinding it passes it with one
58argument,  the window id.  This is how we can tell xwit which window
59to work with.
60
61For example, I have these two:
62
63File ~/.wmx/.mkeys/comma
64------------------------------------------------------------------------
65#! /bin/sh
66
67# move current window left 50 pixels
68xwit -id $1 -rmove -50 0
69------------------------------------------------------------------------
70
71File ~/.wmx/.mkeys/period
72------------------------------------------------------------------------
73#! /bin/sh
74
75# move current window right 50 pixels
76xwit -id $1 -rmove 50 0
77------------------------------------------------------------------------
78
79
80Now, by pressing the wmx-modifier and the comma key the current window
81is moved left a bit,  and with the period it goes right a bit.
82I used comma and period because they are above the "<" and ">" keys.
83You can't use filenames "less" and "greter" because the keysym "less"
84is bound to the the "period" key when the shift modifier is prespent.
85
86
87With the remote patch you can do fancier things as explained there.
88
89

README.menu

1The standard wmx client menu shows the label.  If you're looking for a
2specific window it can be hard to find if there are many.
3
4With the "class" option turned on the client window will display
5for example
6
7[emacs] README.menu
8
9instead of the default:
10
11README.menu
12
13If you also turn on the "sort" option the names are sorted,  so all
14the emacs ones are connsecutive.
15
16
17To turn on class and/or sort you can
18
191. Change Config.h to have
20#define CLASS_IN_MENU True
21
222. With the default setting of
23#define CLASS_IN_MENU	(dConfig.classInMenu())
24you can turn it on by adding "class:on" to the options string.
25
26E.g.
27cd ~/.wmx
28ln -sf class:on/sort:on options
29
30Or, of course, add to your existing options such as
31ln -sf right:toggleheight/class:on/sort:on options
32
33
343. If you have the remote option patch then in the telnet window
35you can use the options command:
36options class:on/sort:on
37

README.remote

1With the remote control patch if you invoke wmx with either the "-r"
2or "-p" option then wmx opens a socket.  With the -r option the
3default port of 6999 is used,  the -p option allows you to specific
4the port number.  Wmx listens on this port for commands and executes
5them.
6
7
8If you telnet into this port you will see:
9
10Welcome to wmx remote control.  Type help for commands
11
12Each reply (including error messages) always ends with an empty line
13to allow a program to parse it.  For example:
14
15input:	channel 2
16output: OK
17output:
18
19With that example wmx will have switched to channel two,  so it would
20have been a good idea to make the above telnet window a sticky one!
21
22By itself the remote control is fun to play with, but what good is it?
23
24Well, with the keybinding patch you can run a command that can send a
25command to the socket.  The easiest way to do this from a shell script
26is using the socket program.  If you don't have this you should!
27
28	http://www.jnickelsen.de/socket/
29
30This is a very handy program which can do many things.  The nice
31feature here is that you can invoke it from a shell script to send
32commands to a socket.
33
34Here is an example file that hides the curent window:
35
36------------------------------------------------------------------------
37#! /bin/sh
38
39# Hide current window
40
41PORT=6999
42echo hide $1 | socket -q localhost $PORT
43------------------------------------------------------------------------
44
45If this file is copied to ~/.wmx/.keys/F1 with execute permission
46(and wmx restarted) then when you press F1 the window under the cursor
47disappears.  Ok, so you can do the same thing by moving the pointer to
48the box and clicking.  Sometmes, though, having a key bound can be
49faster.
50
51Here's a more interesting example:
52
53------------------------------------------------------------------------
54#! /bin/sh
55
56# Move this window to the next channel
57
58# go to next channel
59echo channel | socket -q localhost 6999  | \
60	gawk  '/Current channel is/{ n = $4; n++ ; print "wchannel",'"$1"', n}' |
61	socket -q localhost 6999
62------------------------------------------------------------------------
63
64As the comment says,  the current window is moved to the next channel
65but the current channel is left as is.
66
67To do the same thing with the mouse you would have to move the pointer
68to the frame, middle click (or use the mouse wheel),  then move back
69to the previous channel by moving the pointer away from the window
70and going back to the previous channel.
71
72Cycling amoungst windows often gets ones you're not interested in.
73This file allows cycling between just the same client classes.
74
75------------------------------------------------------------------------
76#! /bin/sh
77
78# warp to the next client of the same class on the same channel
79# ignoring hidden and withdrawn clients
80
81(echo clients ; echo clients ; echo quit) | socket localhost 6999 | \
82
83gawk -v W=$1 '
84
85BEGIN { CLASS = ""; }
86
87(CLASS != "" && $3 !~ /.*[HW].*/ && $4 == CLASS && $2 == CHANNEL) {
88	print "warp", $1
89	print "quit"
90	exit;
91}
92
93($1 == W) {
94	CLASS = $4
95	CHANNEL = $2
96}
97' | \
98  tee -a $HOME/Log | \
99socket -q localhost 6999
100------------------------------------------------------------------------
101