Issue with window icon and system variables, when launching CygWin with a keyboard shortcut key

May 17th, 2005   10:27 am

The scenario is this. I have a Microsoft Natural Pro keyboard (to encourage me to type better, but we all know the concept, in itself, is ridiculous, let alone the practicing of it). I’ve redefined the Back key (meant to be used with a web browser) to launch a Cygwin shell. All works fine, except 2 things. Firstly, the icon, displayed in the window title bar, is not the CygWin icon, but rather the generic Command.exe icon. Also, system variables set (using the environment variables dialog in Computer/System properties) don’t reflect in new shell windows opened.

The solution? Well you could just ignore the icon issue; let’s face it it takes it is a minor inconvenience in the greater scheme it. Or, you could create a shortcut to cygwin.bat (at the root of the CygWin install dir), get properties on that new shortcut, change it’s icon to use the cygwin.ico (again in CygWin install root dir), and point your keyboard key to that new shortcut instead… much better!

The environment variable thing took a bit longer to figure out, and Google falls well short on being able to help with keywords like “variable”, “environment” “not” “set” and “CygWin”, and the various combinations thereof! So the problem is that if you set a system variable (as against a user one) in the Environment Variables dialog of System Properties (right click My Computer | Properties | Advanced | Environment Variables on WinXP will get you there) it isn’t set in a CygWin shell you launch from your keyboard. It is set, as expected, when you open a new Cmd window, use the Cygwin installed shortcuts, or double click on the cygwin.bat file itself. Yes, I was opening a new shell window each time, and not expecting it to reflect real time, in the one shell window! … Anywho, the problem was caused by type32.exe (the “IntelliType” keyboard driver software) being the process that spawned the new CygWin shell. It obviously reads the environment once at start up and uses that to pass to processes it spawns. No nice solution other than to kill type32.exe, and relaunch it (you can just Start | Run | type32). I guess it’d be easy enough to write a wrapper script for that, but that extends beyond the “is it really worth the effort” line, which this post has now become!

css.php