My usual workflow is like that (for instance): My screen is split into two. My editor (Emacs or whatever) for markdown is on the left, the other on the right (web browser to view the results of changes I made in editor.)

  • Save changes in my editor
  • Press Alt-Tab to switch to browser window. I usually have many windows open and it is sometimes taking time to press Alt-Tab several times (I usually miss the window I need.) Then click F5 to refresh my browser.
  • Then back to my editor to edit my markdown and recycle above items again if necessary.

I wonder there is a way to shorten the time of doing all the steps above. I am using Gnome. I would like to bind a key for all steps above.

3 Answers 3


I'm not using gnome, but you should be able to do what you want by mixing tools xbindkeys and wmctrl. (The former may have a gui xbindkey-config for easier configuration).

xbindkeys listens for keyboard events you configure in file ~/.xbindkeysrc, and will run a command when it sees them.

wmctrl talks to conforming window managers and asks them to move, resize, activate windows identified by id or name.

For example this config should activate your emacs when you type Alt=

"wmctrl -a emacs"

Instead of having two such bindings, you can also use xdotool getactivewindow getwindowname to find the name of the currently focused window, and then toggle to the other window. xdotool can also activate windows, if you have problems with gnome and wmctrl.


Instead of relying on your window manager, invoke a command from your editor to focus the browser window. If you merely want to open a new tab, all you have to do with Firefox or Chromium/Chrome is run the browser executable with the desired URL. For example, in Emacs, you can type M-! firefox http://localhost/myfile.md RET.

If you want to focus an existing window, you can use xdotool. You can also make it inject keystrokes in the browser window to trigger the browser's reload command.

xdotool search --class Firefox --name 'My web page' windowactivate --sync key F5

This assumes that the tab you want is active. Firefox and Chrome have no easy built-in way of switching tabs from the command line.


You could simply use workspaces, they're exactly what you're looking for!

As you use GNOME, it's very easy to add new workspaces. Think of a workspace as "one desktop".

So you can have specifiv windows open on different workspaces. You can also add keyboard shortcuts to quickly move to a specific workspace. E.g. SUPER+number is a often-used combination. (SUPER is the Linux name for the "Windows key".) As you use GNOME, you can also just press SUPER to open a workspace overview, where you can click one to switch to it. Pretty handy!

Now you just have to decide on where to put your windows. I for myself have a very strict setting:

Workspace 1: Browser
Workspace 2: Game
Workspace 3: IDE + Terminals
and so on...

So when I want to look into my browser, I always know that I just have to press SUPER+1 and - boom! - I'm in my browser. Back to programming? SUPER+3 and start typing.

  • Aha! It is a good hint. But I usually want to jump between two application windows side by side ( covering whole screen), not among workspaces. A
    – ofenerci
    Commented Jul 21, 2017 at 16:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .