aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2022-04-24 20:47:40 -0600
committerJosh Rahm <joshuarahm@gmail.com>2022-04-24 20:47:40 -0600
commit1ff9a98f85df0c3df4e3f1c3f332100922d18317 (patch)
treedfec036196f7acbce683f754bc0248757133bbb8
parent72414e1732064079719b1f1021dc4badce654903 (diff)
downloadrde-1ff9a98f85df0c3df4e3f1c3f332100922d18317.tar.gz
rde-1ff9a98f85df0c3df4e3f1c3f332100922d18317.tar.bz2
rde-1ff9a98f85df0c3df4e3f1c3f332100922d18317.zip
Roll ScreenRotate into StackSet
-rw-r--r--src/Rahm/Desktop/Keys.hs5
-rw-r--r--src/Rahm/Desktop/ScreenRotate.hs19
-rw-r--r--src/Rahm/Desktop/StackSet.hs22
3 files changed, 22 insertions, 24 deletions
diff --git a/src/Rahm/Desktop/Keys.hs b/src/Rahm/Desktop/Keys.hs
index a8b05a4..0f61018 100644
--- a/src/Rahm/Desktop/Keys.hs
+++ b/src/Rahm/Desktop/Keys.hs
@@ -58,7 +58,6 @@ import Rahm.Desktop.MouseMotion
import Rahm.Desktop.PassMenu
import Rahm.Desktop.PromptConfig
import Rahm.Desktop.RebindKeys
-import Rahm.Desktop.ScreenRotate (screenRotateForward, screenRotateBackward)
import Rahm.Desktop.Submap
import Rahm.Desktop.Swallow
import Rahm.Desktop.SwapMaster (swapMaster)
@@ -771,8 +770,8 @@ mouseMap = runButtons $ do
(button4, windows W.focusUp),
(button5, windows W.focusDown),
- (button7, windows screenRotateForward),
- (button6, windows screenRotateBackward)
+ (button7, windows W.screenRotateForward),
+ (button6, windows W.screenRotateBackward)
]
forM_ (map fst workspaceButtons) $ \b ->
diff --git a/src/Rahm/Desktop/ScreenRotate.hs b/src/Rahm/Desktop/ScreenRotate.hs
deleted file mode 100644
index 718976d..0000000
--- a/src/Rahm/Desktop/ScreenRotate.hs
+++ /dev/null
@@ -1,19 +0,0 @@
-module Rahm.Desktop.ScreenRotate where
-
-import Rahm.Desktop.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
diff --git a/src/Rahm/Desktop/StackSet.hs b/src/Rahm/Desktop/StackSet.hs
index 251bee3..8db16c1 100644
--- a/src/Rahm/Desktop/StackSet.hs
+++ b/src/Rahm/Desktop/StackSet.hs
@@ -5,10 +5,12 @@ module Rahm.Desktop.StackSet (
swapWorkspaces,
greedyView,
shiftWin,
+ screenRotateBackward,
+ screenRotateForward,
module W) where
-import Prelude hiding (head, tail)
-import Data.List.Safe (head, tail)
+import Prelude hiding (head)
+import Data.List.Safe (head)
import Data.List (find)
import XMonad.StackSet as W hiding (greedyView, shiftWin)
import qualified XMonad.StackSet
@@ -49,3 +51,19 @@ greedyView wid ss = swapWorkspaces (tag . workspace . current $ ss) wid ss
shiftWin :: (Ord a, Eq s, Eq i) => i -> a -> StackSet i l a s sd -> StackSet i l a s sd
shiftWin wid a = XMonad.StackSet.shiftWin wid a . fst . ensureWorkspace wid
+
+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