Squib of the day: keys for windows

365 3/26: Going on a Key West adventure/bike rideGNOME bug 97725 raises the interesting idea of associating keys with windows.  Two differing approaches have been advocated:

  1. Have a set of keys which work to “bookmark” windows, and a corresponding set of keys which mean “jump to bookmark n“.
  2. Have a keystroke which means “bookmark this window using the key I’m about to press”, and allow users to press bookmark keystrokes in the alt+tab window.

It is of course important that the bookmarks are associated with a given window indefinitely, otherwise they become a lot less useful.

As a step towards the second option, I’ve written a very quick and hacky script called metacity-bookmark.  The name is a little misleading, because it should work with any EWMH window manager; it uses the window matching technique described in this post.  As usual, you’ll need X11::Protocol installed from CPAN (“sudo cpan X11::Protocol“).

Bind the program to some key or other, which we’ll call Bookmark from now on, and then you can do:

  • Bookmark + key — jump to the window identified by key
  • Bookmark + Space + key — identify the current window by key

Feel free to play with this and let me know what you think.  I’ve made little windows pop up to tell you the program was running, inspired by the “Compose” indicator that used to appear onscreen on old DECs, if my memory serves.

One obvious limitation of the current script is that when it activates a window, it doesn’t switch to the workspace which the window’s on.  I may fix this another day when I fix all the other problems with this script, but if you fancy diving in and fixing it yourself, it shouldn’t be too hard.

As a possible extension to this, windows could also have bookmarks automatically associated with them from their creation, based on their name– for example, the first GIMP window could automatically be given “G”.  And either kind of bookmark could be displayed in the Alt+Tab switcher next to the associated window’s preview or icon.

Photo © jpre86, cc-by-nc-nd.

Published by

Thomas Thurman

Mostly themes, triaging, and patch review.

2 thoughts on “Squib of the day: keys for windows”

  1. To be honest, I already have a system for dynamically associating keyboard shortcuts to windows, or even groups of windows; it’s called switch_to_workspace_n.

  2. Not too interesting IMHO. I also wonder what it’d do if I assigned a key to xterm and opened 5 xterms… perhaps cycle?

    It would be interesting to have a method to more efficiently access running programs. I for one usually have a lot of programs to switch between, but often I find that there are several of the same type, which leads me to think that this is best solved on an application level (ie, Nautilus’ recent tab support… if they’d only add ctrl+tab support)… /me goes off to find new terminal emulator.
    There was that thing that was in Fluxbox where windows of the same type where grouped into tabs, and that was cool… but it seemed to fail or even cause problems more then it succeeded and helped.

Leave a Reply

Your email address will not be published. Required fields are marked *

Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported.