MathCurvesSurfacesWallpaper GroupsGallerySoftwarePOV-Ray
ProgramingLinuxPerl PythonHTMLCSSJavaScriptPHPJavaEmacsUnicode ♥
Web Hosting by 1&1

Keyboard Tip: One Key to Switch to {Firefox, Emacs, Terminal}

Xah Lee, ,

This page tells you how to set a singe key to switch to your favorite app, for {Windows, Mac, Linux}. For example, F9 to Firefox, or emacs, or terminal.

Linux

“wmctrl” is a command-line util to manipulate windows. ⁖ {switch, close, move, resize, set title, list, … }. To install: sudo apt-get install wmctrl

For example, to make F9 switch to Firefox, go to your Control Panel, Keyboard app, click to create a new key, give the command wmctrl -xa firefox.

See also: Linux Keyboard Layout, Keymapping, Keybinding, Tools.

Mac OS X

To do the same for Mac OS X, best is QuickSilver. Just install it and use the GUI to set a key to app. See: Mac OS X Keyboard Layout, Keymapping, Keybinding, Tools.

Windows

For Windows, one solution is AutohotKey.

Here's a sampe AHK script:

; 2012-09-10 AutoHotkey script
; launch or switch emacs

#NoTrayIcon

If WinExist("ahk_class Emacs")
{
  If WinActive("ahk_class Emacs") {
    WinActivateBottom, ahk_class Emacs
      } Else {
    WinActivate
}
}
Else
{
  Run "C:\Users\mary\apps\emacs-24.2\bin\runemacs.exe"
  ; Run "C:\Users\Public\Desktop\ErgoEmacs.lnk"
  WinWait ahk_class Emacs
  WinActivate
}
Return

ExitApp

Save it as a file as 〔launch or switch emacs.ahk〕, then you can use IntelliType to set F9 to run this script. Or, in your main AutoHotkey script, add this line: $F9::Run "C:\Users\mary\ahk_scripts\launch or switch emacs.ahk". You'll need to intall AutoHotkey. See: AutoHotkey Tutorial.

A semi-solution is to buy a Microsoft keyboard and use the bundled IntelliType software. This isn't a complete solution, because for apps that launches new instead of switching, there's no way to use IntelliType to make it switch instead. However, IntelliType is still a great keyboard software for many other purposes. (but it only works with Microsoft keyboards.)

For other Windows keyboarding tools, see: Keyboard Layout & Key Macro tools for Windows.


Why do you want to use a single key to switch? See: Computer Keyboard: Increase Productivity Using Function Keys.

Thanks to {Yuri Khan, Vadim Atlygin, Evan Cofsky} for help on Linux.

blog comments powered by Disqus