xmonad-contrib-0.16.999: Community-maintained extensions extensions for xmonad
Copyright(c) 2020 Ivan Brennan <ivanbrennan@gmail.com>
LicenseBSD3-style (see LICENSE)
MaintainerIvan Brennan <ivanbrennan@gmail.com>
Stabilitystable
Portabilityunportable
Safe HaskellNone
LanguageHaskell98

XMonad.Actions.RotateSome

Contents

Description

Functions for rotating some elements around the stack while keeping others anchored in place. Useful in combination with layouts that dictate window visibility based on stack position, such as XMonad.Layout.LimitWindows.

Synopsis

Usage

You can use this module with the following in your ~/.xmonad/xmonad.hs:

import XMonad.Actions.RotateSome

and add keybindings such as the following:

  , ((modMask .|. controlMask, xK_n), surfaceNext)
  , ((modMask .|. controlMask, xK_p), surfacePrev)

Consider a workspace whose stack contains five windows A B C D E but whose layout limits how many will actually be shown, showing only the first plus two additional windows, starting with the third:

 ┌─────┬─────┐
 │     │  C  │
 │  A  ├─────┤
 │     │  D  │
 └─────┴─────┘

 A  B  C  D  E
 _     ____

If C has focus and we'd like to replace it with one of the unshown windows, surfaceNext will move the next unshown window, E, into the focused position:

 ┌─────┬─────┐                ┌─────┬─────┐
 │     │ *C* │                │     │ *E* │
 │  A  ├─────┤ surfaceNext -> │  A  ├─────┤
 │     │  D  │                │     │  D  │
 └─────┴─────┘                └─────┴─────┘

 A  B *C* D  E                A  C *E* D  B
 _     ____                   _     ____

This repositioned windows B C E by treating them as a sequence that can be rotated through the focused stack position. Windows A and D remain anchored to their original (visible) positions.

A second call to surfaceNext moves B into focus:

 ┌─────┬─────┐                ┌─────┬─────┐
 │     │ *E* │                │     │ *B* │
 │  A  ├─────┤ surfaceNext -> │  A  ├─────┤
 │     │  D  │                │     │  D  │
 └─────┴─────┘                └─────┴─────┘

 A  C *E* D  B                A  E *B* D  C
 _     ____                   _     ____

A third call would complete the cycle, bringing C back into focus.

surfaceNext :: X () Source #

Treating the focused window and any unshown windows as a ring that can be rotated through the focused position, surface the next element in the ring.

surfacePrev :: X () Source #

Like surfaceNext in reverse.

rotateSome :: (a -> Bool) -> Stack a -> Stack a Source #

rotateSome p stack treats the elements of stack that satisfy predicate p as a ring that can be rotated, while all other elements remain anchored in place.