How to Set Key to Switch to Browser

, , …,

This page shows you how to set a singe key to switch to your favorite app, for {Windows, Mac, Linux}. For example, set F8 to switch to browser, or terminal.

there are 2 or 3 apps we use perhaps 80% of our computing time. So, it's nice to set a single F key to switch to them.

What's wrong with 【Ctrl+Tab ↹】?

Ctrl+Tab ↹】 or 【⌘ Cmd+Tab ↹】 are inferior, because:

If you set a single F key to switch to a specific app, it becomes muscle memory.

Here's how for {Mac OS X, Linux, Microsoft Windows}.

Mac OS X

Mac Quicksilver key trigger panel
Mac Quicksilver key trigger panel

Use QuickSilver. Just install it and use the GUI to set a key to app. See: Mac OS X Keyboard Layout, Keymapping, Keybinding, Tools.


There are several ways to do it in Linux. Some are simpler, some are most robust.


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:

# switch to Firefox
wmctrl -xa firefox
linux xfce keyboard control panel set key to switch to terminal
keyboard setting panel in linux xfce


Here's what you can do with 「xdotool」 to switch/launch app.

This is what I came up with to switch between my editor/browser/terminal using surplus numpad keys. (Tried wmctrl -xa first but it switches to the first terminal on the first desktop it finds.)

"xdotool search --onlyvisible --class  Geany   windowraise windowfocus"

"xdotool search --onlyvisible --class  Firefox   windowraise windowfocus"

"xdotool search --onlyvisible --class  Sakura   windowraise windowfocus"

That's in 〔~/.xbindkeysrc〕 … I started using xbindkeys so I can switch WMs without redoing all my hotkeys.

P.S. - found a switch-or-launch script for Linux: Doesn't work well with systray apps but my goal is to banish those.. map them to W-F1 etc.

JumpApp → A faster way to launch applications and switch between them

The idea is simple — bind a key for any given application that will:

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


For Windows, one solution is AutohotKey.

AutoHotkey System Notification Area
AutoHotkey icon in Taskbar

You'll need to intall AutoHotkey. See: AutoHotkey Tutorial ⌨.

Here's a sampe AHK script:

; 2010-04-01, 2011-11-27
; launch or switch to firefox

SetTitleMatchMode, 2

If WinExist("Mozilla Firefox")
  If WinActive("Mozilla Firefox") {
    WinActivateBottom, Mozilla Firefox
      } Else {
  Run "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"


Save it as a file and name it launch_or_switch_firefox.ahk, then you can use Microsoft IntelliType (bundled with Microsoft Keyboards) 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_firefox.ahk"

Increase Productivity Using Function Keys

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

Set Window to Auto-Raise

Also, do this: Mouse Hover to Auto-Raise Window

and Single-click Open File in Windows & Linux

blog comments powered by Disqus