diff options
Diffstat (limited to 'src/Rahm/Desktop/Workspaces.hs')
| -rw-r--r-- | src/Rahm/Desktop/Workspaces.hs | 69 |
1 files changed, 1 insertions, 68 deletions
diff --git a/src/Rahm/Desktop/Workspaces.hs b/src/Rahm/Desktop/Workspaces.hs index 1bd5c51..72e929b 100644 --- a/src/Rahm/Desktop/Workspaces.hs +++ b/src/Rahm/Desktop/Workspaces.hs @@ -12,11 +12,8 @@ module Rahm.Desktop.Workspaces adjacentWorkspace, viewAdjacent, viewAdjacentTo, - adjacentScreen, withScreen, workspaceWithWindow, - getScreensOnSamePlane, - getScreensOnDifferentPlane, getWorkspaceToTheRight, getWorkspaceToTheLeft, getWorkspaceAbove, @@ -33,12 +30,10 @@ import Data.Int (Int32) import Data.List (find, sort, sortBy, sortOn, (\\)) import Data.List.Safe ((!!)) import Data.Maybe (fromMaybe, listToMaybe, mapMaybe) -import Debug.Trace -import Rahm.Desktop.Geometry import Rahm.Desktop.Common (getCurrentWorkspace, gotoWorkspace, runMaybeT_) +import Rahm.Desktop.Geometry import Rahm.Desktop.Logger import qualified Rahm.Desktop.StackSet as W -import Text.Printf (printf) import XMonad ( Rectangle (Rectangle), ScreenDetail (SD), @@ -50,7 +45,6 @@ import XMonad windows, withWindowSet, ) -import XMonad.Util.Loggers (logFileCount) import Prelude hiding ((!!)) newtype Selector = Selector (forall a. (a -> Bool) -> [a] -> Maybe a) @@ -111,48 +105,6 @@ getHorizontallyOrderedScreens windowSet = where screens = (True, W.current windowSet) : map (False,) (W.visible windowSet) -getVerticallyOrderedScreens :: - W.StackSet wid l a ScreenId ScreenDetail -> - [(Bool, W.Screen wid l a ScreenId ScreenDetail)] --- ^ Returns a list of screens ordered from top to bottom -getVerticallyOrderedScreens windowSet = - flip sortBy screens $ \sc1 sc2 -> - let (SD (Rectangle _ y1 _ _)) = W.screenDetail (snd sc1) - (SD (Rectangle _ y2 _ _)) = W.screenDetail (snd sc2) - in y1 `compare` y2 - where - screens = (True, W.current windowSet) : map (False,) (W.visible windowSet) - --- | Returns screens which are horizontally ordered, but are on the same "plane" --- as the current screen. A screen is considered on the same "plane" if it's --- middle point is vertically oriented within the vertical boundaries of the --- current screen. -getScreensOnSamePlane :: - W.StackSet wid l a ScreenId ScreenDetail -> - [(Bool, W.Screen wid l a ScreenId ScreenDetail)] -getScreensOnSamePlane ss = - filter matchesYCenter $ getHorizontallyOrderedScreens ss - where - yCenter - | (SD (Rectangle _ y _ h)) <- W.screenDetail . W.current $ ss = - (y + fromIntegral h) `div` 2 - matchesYCenter (_, W.screenDetail -> (SD (Rectangle _ y _ h))) = - y < yCenter && y + fromIntegral h > yCenter - --- | Returns screens which are vertically ordered, but are on a different plane --- from the current screen. -getScreensOnDifferentPlane :: - W.StackSet wid l a ScreenId ScreenDetail -> - [(Bool, W.Screen wid l a ScreenId ScreenDetail)] -getScreensOnDifferentPlane ss = - filter (not . matchesScreen . getYCenter . snd) $ getVerticallyOrderedScreens ss - where - getYCenter (W.screenDetail -> SD (Rectangle _ y _ h)) = - y + (fromIntegral h `div` 2) - matchesScreen yCenter - | (SD (Rectangle _ y _ h)) <- W.screenDetail (W.current ss) = - yCenter < y + fromIntegral h && yCenter > y - accompanyingWorkspace :: WorkspaceId -> WorkspaceId accompanyingWorkspace [s] | isDigit s = show (fl (ord s - ord '0')) @@ -265,22 +217,3 @@ getWorkspaceBelow w = do refRect <- lift $ getScreenRect w rects <- lift getScreenRectangles MaybeT $ return (snd <$> closestInDirection rects w S) - -getWorkspaceCenter :: WorkspaceId -> X (Maybe (Int32, Int32)) -getWorkspaceCenter w = withWindowSet $ \(W.StackSet cur vis _ _) -> - let currentCenter = getScreenCenter cur - visibleCenters = map getScreenCenter vis - allCenters = currentCenter : visibleCenters - matchingCenters = filter ((== w) . snd) allCenters - in return $ if null matchingCenters then Nothing else Just (fst (head matchingCenters)) - where - getScreenCenter screen = - let SD (Rectangle x y w h) = W.screenDetail screen - wsTag = W.tag (W.workspace screen) - in ((x + fromIntegral w `div` 2, y + fromIntegral h `div` 2), wsTag) - -lookupNext :: (Eq a) => a -> [a] -> a -lookupNext x [] = x -lookupNext target (x : xs) - | x == target = if null xs then target else head xs - | otherwise = lookupNext target xs |