I am sure many of you remember the legendary Quake series games. We grew up with this stuff. And you remember what was the coolest feature of Quake? No, it was neither the graphics, nor that you could blow your friends in little pieces, after you have killed them: it was the console. It was the only game series that I am aware of (ok, I’m not really a games freak, so don’t take my word for it) that it was offering a ‘console’ to the players. You could do all short of cool things just by pressing the tilda (~) key, such as change from FPS to a TPS mode, draw benchmark data like Frames per second, alter your avatar and so on. In one sentence, it was giving to the player the one thing that Command Lines usually give: POWER!
That is why, one of the most useful tools on my Linux machine is a terminal emulator called Guake, that is imitating the behaviour of the Quake terminal. (there are also OS/X equivalents for the Mac lovers). But what about Windows? And I care about windows, because I’m sort of forced to use it on my work laptop. Can I have the same kind of Power on my windows machines?
The answer is: yes! But you have to prove that you deserve it. It doesn’t come out of the box, but it is doable and oh, yes, powerful! It’s not easy first of all because Windows doesn’t come with such a cool terminal such as bash or zsh. It also doesn’t come with an out of the box hotkey listener. Or rather it does but it’s pretty limited.. Finally, it doesn’t come with a user friendly console that offers tab autocompletion, multiple tab support etc. etc…. But with the power of open source, we are here to solve all these one by one :)
This is pretty easy. You just need to install Bash, or your favourite terminal. There are plently available out there, such as win-bash or cygwin. I personall have used the bash emulator that comes with Git, as I also use git very often.
Once you have a working bash shell, you can install console2 (http://sourceforge.net/projects/console/), a very beautiful and user friendly console that can run various terminals. It offers features such as multiple tabs, transparent background which varies whether it is on focus or not, the possibility to remove all window manager related decorations to make it look like a glass and finally the ability to stay on top of other windows when not focused. Once installed, you can set it up to execute the shell you want from the settings. (In this example you see how I am using bash from git installation).
Besides one shell, you can also run different shells in different tabs. And the cool thing is that it doesn’t have to be a linux shell, but any kind of shell. For instance, I am also a big fan of R and I set up my Console2 to be able to run an R shell, without the need to execute it from bash. The same can go for other shell interfaces (e.g. Python, ruby etc)
You can define these as ‘Tab 2’, ‘Tab 3’ etc. etc. The coolest thing is that you can evoke these shells using a specific shortcut. I use for instance CTRL+T for a new tab with a bash terminal, CTRL+R for a new R shell and CTRL+P for a new Python shell.
Finally, you can play around with the appearance of the Console to make it as beautiful as you like. Remember, it’s important you make it beautiful cause you will use it pretty often ;) I personally set an amount of transparency when the console is focused so that I can read the text that might be beneath the console (it’s pretty useful for instance when I am debugging and trying to copy a line of code from my editor to my shell)
You can find the configuration of Console2 that I am using in attachment.
Ok, that’s done with the console as well. How do we evoke it with the tilda (~)? For that we’re going to use our third little buddy which is called AutoHotKey (http://ahkscript.org/). AutoHotKey is a hotkey listener that is as powerfull as it gets. It has it’s own scripting language that you can use to make miracles happen. In our case, we want to just listen for the tilda key (or any other key combo if you dare to escape the tradition) and manage the visibility of Console2, depending on the current state of it.
- If Console2 is not running -> Execute it and me it appear
- If Console2 is running but is hidden -> Make it appear
- If Console2 is running, it is visible but not focused -> Bring it to focus
- If Console2 is running, it is visible and focused -> Make it dissapear
You can do that with a very simple script that I am attaching (updated attachment 08/12/14). If you want to change the hotkey (don’t you dare!) then you need to change the ‘sc029::’ on the fourth line. You can find extensive documentation on the AutoHotKey website on how to define keystrokes and combinations of keystrokes. when you write your script, you need to execute it with AutoHotKey and see magic happens :)
Unfortunately, all this extreme costumisation comes with the cost of beging a bit buggy. Nothing serious actually, I just have noticed that AutoHotKey doesn’t work well with the Synergy Project, which is another awesome tool that I use often to work both on my Windows and Linux machine with the same keyboard and mouse. But when the synergy service is running, AutoHotKey behaves weirdly. Synergy is aware of this uncompatability, not sure if they are planning to do something about it though. Just keep this in mind in case you are also a user of Synergy.
Enjoy and let me know if you found this useful!