Tuesday, March 8, 2011

Libevent Examples

Just looked at my web stats for the first time in a long time and I see that one of the most requested resources are my libevent examples, which no longer exist here. The code however does still exist:

http://code.google.com/p/ishbits/source/browse/trunk/libevent-examples/

Thursday, April 22, 2010

Back to the Mac

Recent issues with Linux on a laptop has given me the desire to try working on a Mac again. Even though I have a pretty well supported laptop (Lenovo x61), its the little issues that have begun to bother me which include not great sleep/suspend support, wireless and audio issues and an almost never ending stream of updates. Yes, you Linux people may say it works fine, but if you've ever used a Mac before you'll know its not as good as a could be, by far.

I've also found that its really nice to have the real Microsoft Office handy when you swap documents with other non-Linux using people (yeah, OpenOffice doesn't quite cut it when taking turns editing documents) which meant often having a Windows VM running.

The other factor that helps the Mac be a viable option is the majority of the software I develop already builds and installs on a Mac, or can do so with very minor modifications. The stuff that doesn't is so tied to a specific environment that it really requires a virtual machine even when running Linux as the host operating system. This really makes the Mac sound like an ideal system.

So yesterday while heading out just before dinner to grab some hamburger buns I walked by the local Mac retailer (hey, its about 20 steps from Safeway) and grabbed a high-res 15" MacBook with the Core i5 2.53ghz processor. They weren't able to upgrade the ram to 8GB on the spot but I decided I couldn't wait.

Aesthetically its a beautiful machine. The display is about the best computer display I've ever seen. The 3 primary pieces of software I work on compile out of the box. Its also nice to have Microsoft Office running natively. The thing that drove me away from the Mac before was some of the UI behaviours, like Cmd-Tab switching applications, not just windows of applications. But I'm going to give this a true go and may update this blog now and then with issues that I run into as a developer, developing network-level apps primarily for Linux, making the shift to Mac as a development platform.

Wednesday, October 7, 2009

FVWM: Moving a Window to Another Screen

Probably the most lacking feature in most multi-screen setups is the ability to move a window from one screen to another with a keyboard shortcut. I do this to bring the window I'm currently working on into my centre monitor so its directly in front of me. There are 2 ways to go about this. The first is moving a window to a specific display and the second is to move (shift) the window to the left or right display (which would just be back and forth in a dual monitor setup).

For the first case you could define the following function:

# This function will move a window to the X screen provided in the
# first argument. If the window is in the maximized it will be taken
# out of the maximized state before moving. If we don't do this it
# will be moved back to the original screen when the maximized state
# is toggled.
#
# If you do not want the pointer to be moved to the windows new
# location then comment out the line containing WarpToWindow.
DestroyFunc MoveWindowToScreen
AddToFunc MoveWindowToScreen
+ I Current (Maximized) Maximize
+ I SetEnv PWX $[pointer.wx]
+ I Setenv PWY $[pointer.wy]
+ I MoveToScreen $[0]
+ I WindowId $[w.id] WarpToWindow $[PWX]p $[PWY]p


And then add the following to your window operations menu:

+ "&1 Move to Screen 1" MoveWindowToScreen 2
+ "&2 Move to Screen 2" MoveWindowToScreen 0
+ "&3 Move to Screen 3" MoveWindowToScreen 1


Note that the argument you provide to the MoveWindowToScreen function takes the X display number which may not directly map to the order of the screens on your desk.

The second method is to move the screen to the left or the right. Or in the case of a dual monitor setup you could just continually move right to have the window flip/flop between your 2 screens.

First download the following file and save it to ~/.fvwm/ShiftToScreen.py: ShiftToScreen.py
You will also need to update variables screenWidth and screens in ShiftToScreen.py as they are currently setup for my configuration of 3 screens with a width of 1920 pixels each.

Then define the following function:

# This function will move a window to the left or right screen
# depending on the first argument which should be on of "left" or
# "right". It depends on the auxiliary python script
# ShiftToScreen.py.
DestroyFunc ShiftToScreen
AddToFunc ShiftToScreen
+ I Current (Maximized) Maximize
+ I SetEnv PWX $[pointer.wx]
+ I Setenv PWY $[pointer.wy]
+ I PipeRead "python $./ShiftToScreen.py $[0] $[w.x]"
+ I WindowId $[w.id] WarpToWindow $[PWX]p $[PWY]p


You could then add the following to your windows operations menu:

+ "&Left Screen" ShiftToScreen left
+ "&Right Screen" ShiftToScreen right

or define some keyboard shortcuts. For example I have bound Shift-Alt-Left and Shift-Alt-Right to shift the window to the left or right screen:

Key Left WTSF12468 SM ShiftToScreen left
Key Right WTSF12468 SM ShiftToScreen right

If you are only working with 2 screens you will only need to define one shortcut to get flip/flop like behaviour as shifting left beyond the leftmost screen will wrap the window around to the right most screen.

Enjoy.

Tuesday, September 22, 2009

Ideal Multi-Monitor Setup

Multi-monitor configurations are great but I think they leave out some usability aspects that could really make life easier for the keyboard user. When I was just using dual displays I really wanted keyboard shortcuts to do the following:

* Move a window from one screen to the other.
* Swap what is seen on each display.

When I moved to 3 monitors my needs changed a little.

* Shift a window to the screen to the left or the right, rotating around.
* Swap a display with the one to the left or the right.
* Shift all displays to the left or the right.

This would make it extremely fast to move the window you are currently working on to your primary display, then push it back to where it came from. Or swap the contents of your right screen with your centre screen if you need to shift your work focus for a while.

As far as I know this is not possible with Windows, Mac or most Linux configurations. However, I believe using FVWM as your Linux (ok, *nix) window manager will make this all possible, at least my experiments with dual screens have been positive. I'll update this blog with various functions that should make all of the above achievable.

Monday, March 16, 2009

Making that Caps-Lock key an extra Control key

Yes, covered everywhere and I've done it enough time I should know it off by heart now...  I used to swap caps and control, but now I just make the caps an additional control and leave the original control as is...

~/.xmodmap snippet:

remove Lock = Caps_Lock
keysym Caps_Lock = Control_L
add Control = Control_L

Sunday, March 15, 2009

Moved to Victoria

Just a quick update to let everyone know that we are no longer live in Saskatoon but haved moved out to Victoria, BC.

Saturday, October 11, 2008

Hello world!

Due to catatstrophic failures over at vpsville.ca I'm left without a server.  This was the first time I completely removed myself from managing my own servers, and it hasn't turned out well.  Oh well, I think I will move to managed services for the next little while.