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