[xmonad] Trying to code jump-or-execute

Spencer Janssen sjanssen at cse.unl.edu
Thu Jan 31 00:39:15 EST 2008


On Wed, Jan 30, 2008 at 06:05:01PM -0500, Joseph Garvin wrote:
> I'm a former sawfish user, and I used to have this really awesome keyboard
> shortcut called "jump-or-exec". I would press for example Super+F, and if
> Firefox was not running, it would be executed, and if it was already
> running, then it would be given focus. I had similar shortcuts for emacs,
> terminals, etc.
> 
> I'm a bit of a haskell newb -- I can tell that I can simply use 'spawn' to
> launch a process, and if I had a list of current windows I would know how to
> iterate through them and find out whether one currently exists, but I don't
> know how to get such a list. Ideally I'd like to be able to match against
> window title or class. Is there a way to do this with xmonad?

You can use XMonad.StackSet.allWindows to get a list of all windows.  Then
you've just got to match against the desired properties -- XMonad.ManageHook
has some examples you can emulate.  Finally, use XMonad.StackSet.focusWindow to
bring focus to the identified window.


Cheers,
Spencer Janssen


More information about the xmonad mailing list