5/11/2010

05-11-10 - Some New Cblib Apps

Coded up some new goodies for myself today and released them in a new cblib and chuksh .

RunOrActivate : useful with a hot key program, or from the CLI. Use RunOrActivate [program name]. If a running process of that program exists, it will be activated and made foreground. If not, a new instance is started. Similar to the Windows built-in "shortcut key" functionality but not horribly broken like that is.

(BTW for those that don't know, Windows "shortcut keys" have had huge bugs ever since Win 95 ; they sometimes work great, basically doing RunOrActivate, but they use some weird mechanism which causes them to not work right with some apps (maybe they use DDE?), they also have bizarre latency semi-randomly, usually they launch the app instantly but occasionally they just decide to wait for 10 seconds or so).

RunOrActivate also has a bonus feature : if multiple instances of that process are running it will cycle you between them. So for example my Win-E now starts an explorer, goes to existing one if there was one, and if there were a few it cycles between explorers. Very nice. Also works with TCC windows and Firefox Windows. This actually solves a long-time useability problem I've had with shortcut keys that I never thought about fixing before, so huzzah.

WinMove : I've been using this forever, lets you move and resize the active window in various ways, either by manual coordinate or with some shorthands for "left half" etc. Anyway the new bit is I just added an option for "all windows" so that I can reproduce the Win-M minimize all behavior and Win-Shift-M restore all.

I think that gives me all Win-Key functions I actually want.

ADDENDUM : One slightly fiddly bit is the question of *which* window of a process to activate in RunOrActivate. Windows refuses to give you any concept of the "primary" window of a process, simply sticking to the assertion that processes can have many windows. However we all know this is bullshit because Alt-Tab picks out an isolated set of "primary" windows to switch between. So how do you get the list of alt-tab windows? You don't. It's "undefined", so you have to make it up somehow. Raymond Chen describes the algorithm used in one version of Windows.

4 comments:

Tom said...

This prodded me into uploading a couple of similar programs I wrote a while ago...

dispswitch - moves window from one monitor to the next. (This is amazingly useful. Most useful hour or two I ever spent, writing this.)

http://www.tomseddon.plus.com/dispswitch/

align_window2 - a bit like your Winmove I suppose, I wrote this after I heard about the Win7 feature (that I have still never used)

http://www.tomseddon.plus.com/align_window2/

sly-id said...

Funny how everyone ends up writing the same kind of stuff.
As for me, I simply implemented these "move windows" functions in a AHK script, with several Win+arrows/home/end/pg-up/down/... keys to select where to send the (current or pre-listed) windows.

cbloom said...

One thing I'd like in WinMove that's missing is the ability to align MDI sub-windows inside their parent window. eg. I'd like to have my own global keys to move the panes around inside Excel/Photoshop/MSDev. Maybe I'll add that today.

Mojo said...

Presume you've all seen winsplit revolution (http://www.winsplit-revolution.com/) which does mulitmonitor window moves and tiling.

Linuxers have the "grid" plugin for compiz.

old rants