aboutsummaryrefslogtreecommitdiff
path: root/src/Internal/ScreenRotate.hs
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2022-03-25 19:48:53 -0600
committerJosh Rahm <joshuarahm@gmail.com>2022-03-25 19:48:53 -0600
commit4b1adef5afe4748c2f9d9362baff71a44428b902 (patch)
tree065d941bcacd0e7b6999405d2e3908986c42b327 /src/Internal/ScreenRotate.hs
parent9118fc86df893f92a14d5ec4d82d052253a450b0 (diff)
parenta7129b68fb7fa4f7cea52513fad7223dcbba9801 (diff)
downloadrde-4b1adef5afe4748c2f9d9362baff71a44428b902.tar.gz
rde-4b1adef5afe4748c2f9d9362baff71a44428b902.tar.bz2
rde-4b1adef5afe4748c2f9d9362baff71a44428b902.zip
Merge branch 'v017' of josher.dev:rde into v017
Diffstat (limited to 'src/Internal/ScreenRotate.hs')
-rw-r--r--src/Internal/ScreenRotate.hs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Internal/ScreenRotate.hs b/src/Internal/ScreenRotate.hs
new file mode 100644
index 0000000..ff6417c
--- /dev/null
+++ b/src/Internal/ScreenRotate.hs
@@ -0,0 +1,19 @@
+module Internal.ScreenRotate where
+
+import XMonad.StackSet as W
+
+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 = tail $ cycle $ map W.workspace screens
+ (current':visible') = zipWith (\s w -> s {workspace = w} ) screens workspaces
+ in W.StackSet current' visible' others floating
+
+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 = 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