Tuesday, February 1, 2011

Center mouse after aero snap keyboard shortcut (auto hotkey)

True X-Mouse has a few problems. The most noticeable (for me) is that if the window the mouse is over moves (ie: you use the Aero Snap keyboard shortcuts, practically my favorite command in Windows 7), the window focus changes to the window below it. (This can really mess with your muscle memory!)

Turns out AutoHotKey can remedy the situation (I'm new to AutoHotKey, so there's probably a more elegant way to do this):

; Aero-Snap Mouse
; Move mouse to center of windows that are aero-snapped (True X-Mouse won't do this)
CenterMouseInWindow(Title)
{
WinActivate, %Title% ; True X-Mouse may have taken focus away when we moved
WinGetPos, X, Y, width, height, %Title%
center_x:=width/2
center_y:=height/2
MouseMove,center_x,center_y
return
}

#Left::
WinGetTitle, Title, A
SendInput #{Left}
CenterMouseInWindow(Title)
return

#+Left::
WinGetTitle, Title, A
SendInput #+{Left}
CenterMouseInWindow(Title)
return

#Right::
WinGetTitle, Title, A
SendInput #{Right}
CenterMouseInWindow(Title)
return

#+Right::
WinGetTitle, Title, A
SendInput #+{Right}
CenterMouseInWindow(Title)
return

#Up::
WinGetTitle, Title, A
SendInput #{Up}
CenterMouseInWindow(Title)
return

#Down::
WinGetTitle, Title, A
SendInput #{Down}
CenterMouseInWindow(Title)
return



This captures the aero snap shortcuts, gets the title for the current window, sends the aero snap shortcut to windows (which moves the window), then re-activates the old window and centers the mouse.

It's not instant (even with MoveMouse speed=0, I tried it), so you can't do Win+Shift+Left/Right rapid fire, but it works pretty well other than that.

Wednesday, January 26, 2011

Focus follows mouse for Windows

True X-Mouse does a good job of focus-follows-mouse in Windows. It's *really* nice for switching focus from remote desktop to local windows, since alt-tab is (intentionally) eaten by the remote machine

It also does some clip-board stuff to simulate X-Windows cut/copy/paste behavior, which I don't really care about (but so far hasn't gotten in my way).

Saturday, January 1, 2011

Wednesday, November 24, 2010

Easily sleep/restart/shutdown Windows via remote desktop

To easily shutdown/restart/sleep a windows machine via remote desktop, click on the desktop and press Alt+F4. This will bring up the standard Windows shutdown prompt (where you can choose shutdown, restart, sleep, etc). (I didn't know that!)

More info here.

Sunday, November 21, 2010

"Aero Snap" (sort of) in FVMW

I really like Windows 7's "Aero Snap" feature. I never drag windows, but I use Win+Left/Right all the time, and it really bugs me when I use another system and it doesn't do anything.

Here's how to do it in FVWM:
AddToFunc LeftHalf
+ I Move 0 0
+ I Maximize 50 100
+ I Raise
AddToFunc RightHalf
+ I Maximize 50 100
+ I Move 50 0
+ I Raise
Key Left A 4 LeftHalf
Key Right A 4 RightHalf


FVWM will remember the old window size for you (but will follow your window placement rules when positioning it).

Thursday, November 18, 2010

VSTS data bindings and unicode

I have a test with a data source (settings.csv) and a data binding (mysetting). Settings.csv exists, and there's an entry for 'mysetting', but VSTS complains:
Error...Could not run Web test 'test' on agent 'agent': Could not access table 'settings#csv' in data source 'settingsSource' of test '12345678-abcd-abcd-abcd-12345678abcd': No value given for one or more required parameters.

Turns out it's because the csv file is Unicode. The easiest way to fix this (for me, at any rate), is Powershell:
cat settings.csv | out-file temp.csv -encoding ascii
Compare the sizes of settings.csv and temp.csv with ls. If temp.csv is smaller, then settings.csv was unicode.
mv temp.csv settings.csv -force

The truly maddening thing is that VS seems to be saving out as Unicode itself, so I have to edit my csv files elsewhere.

Fullscreen flash in linux freezes video: partial solution

Linux flash has problems with fullscreen on my laptop with an integrated intel graphics chipset. Most of the time I fullscreen it, the audio keeps playing but the video freezes.

You can solve the problem by disabling hardware acceleration, but that noticeably impacted my video quality (dropped frames, pixelation). However, it appears that a combination of changing focus to other windows and quickly fullscreening/un-fullscreening will make it work. Unfortunately, I haven't found a set of steps that works every time...usually, I just click around a lot until it works.