aboutsummaryrefslogtreecommitdiff
path: root/src/Rahm/Desktop/ScreenRotate.hs
blob: 1f238b18c003088cf41d8ee4a037da9ce4d8ca60 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module Rahm.Desktop.ScreenRotate where

import XMonad.StackSet as W

screenRotateBackward :: W.StackSet i l a sid sd -> W.StackSet i l a sid sd
screenRotateBackward (W.StackSet current visible others floating) = do
  let screens = current : visible
      workspaces = tail $ cycle $ map W.workspace screens
      (current':visible') = zipWith (\s w -> s {workspace = w} ) screens workspaces
      in W.StackSet current' visible' others floating

screenRotateForward :: W.StackSet i l a sid sd -> W.StackSet i l a sid sd
screenRotateForward (W.StackSet current visible others floating) = do
  let screens = current : visible
      workspaces = rcycle $ map W.workspace screens
      (current':visible') = zipWith (\s w -> s {workspace = w} ) screens workspaces
      in W.StackSet current' visible' others floating

  where rcycle l = last l : l