xmonad-contrib-0.18.0: Community-maintained extensions for xmonad
Copyright(c) nzeh@cs.dal.ca
LicenseBSD3-style (see LICENSE)
Maintainernzeh@cs.dal.ca
Stabilityunstable
Portabilityunportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

XMonad.Actions.GroupNavigation

Description

Provides methods for cycling through groups of windows across workspaces, ignoring windows that do not belong to this group. A group consists of all windows matching a user-provided boolean query.

Also provides a method for jumping back to the most recently used window in any given group, and predefined groups.

Synopsis

Usage

Import the module into your xmonad.hs:

import XMonad.Actions.GroupNavigation

To support cycling forward and backward through all xterm windows, add something like this to your keybindings:

, ((modm              , xK_t), nextMatch Forward  (className =? "XTerm"))
, ((modm .|. shiftMask, xK_t), nextMatch Backward (className =? "XTerm"))

These key combinations do nothing if there is no xterm window open. If you rather want to open a new xterm window if there is no open xterm window, use nextMatchOrDo instead:

, ((modm              , xK_t), nextMatchOrDo Forward  (className =? "XTerm") (spawn "xterm"))
, ((modm .|. shiftMask, xK_t), nextMatchOrDo Backward (className =? "XTerm") (spawn "xterm"))

You can use nextMatchWithThis with an arbitrary query to cycle through all windows for which this query returns the same value as the current window. For example, to cycle through all windows in the same window class as the current window use:

, ((modm , xK_f), nextMatchWithThis Forward  className)
, ((modm , xK_b), nextMatchWithThis Backward className)

Finally, you can define keybindings to jump to the most recent window matching a certain Boolean query. To do this, you need to add historyHook to your logHook:

main = xmonad $ def { logHook = historyHook }

Then the following keybindings, for example, allow you to return to the most recent xterm or emacs window or to simply to the most recent window:

, ((modm .|. controlMask, xK_e),         nextMatch History (className =? "Emacs"))
, ((modm .|. controlMask, xK_t),         nextMatch History (className =? "XTerm"))
, ((modm                , xK_BackSpace), nextMatch History (return True))

Again, you can use nextMatchOrDo instead of nextMatch if you want to execute an action if no window matching the query exists.

data Direction Source #

The direction in which to look for the next match

Constructors

Forward

Forward from current window or workspace

Backward

Backward from current window or workspace

History

Backward in history

nextMatch :: Direction -> Query Bool -> X () Source #

Focuses the next window that matches the given boolean query. Does nothing if there is no such window. This is the same as nextMatchOrDo with alternate action return ().

nextMatchOrDo :: Direction -> Query Bool -> X () -> X () Source #

Focuses the next window that matches the given boolean query. If there is no such window, perform the given action instead.

nextMatchWithThis :: Eq a => Direction -> Query a -> X () Source #

Focuses the next window for which the given query produces the same result as the currently focused window. Does nothing if there is no focused window (i.e., the current workspace is empty).

historyHook :: X () Source #

Action that needs to be executed as a logHook to maintain the focus history of all windows as the WindowSet changes.

Utilities

Below are handy queries for use with nextMatch, nextMatchOrDo, and nextMatchWithThis.

isOnAnyVisibleWS :: Query Bool Source #

A query that matches all windows on visible workspaces. This is useful for configurations with multiple screens, and matches even invisible windows.