aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2026-03-01 14:43:53 -0700
committerJosh Rahm <joshuarahm@gmail.com>2026-03-01 14:43:53 -0700
commit5e678c0c4cad37ecbf91c43cbd829087d8340b2f (patch)
treea70e617129f3653fd987c8d5df304837fd365fde /src
parent0b01da5b4c2c9de8e3f0b7454cc5cb177aba1dd4 (diff)
downloadrde-5e678c0c4cad37ecbf91c43cbd829087d8340b2f.tar.gz
rde-5e678c0c4cad37ecbf91c43cbd829087d8340b2f.tar.bz2
rde-5e678c0c4cad37ecbf91c43cbd829087d8340b2f.zip
[cleanup] clean up some unused functions.
Diffstat (limited to 'src')
-rw-r--r--src/Main.hs10
-rw-r--r--src/Rahm/Desktop/Dragging.hs19
-rw-r--r--src/Rahm/Desktop/PopupTerminal.hs26
-rw-r--r--src/Rahm/Desktop/Workspaces.hs69
4 files changed, 37 insertions, 87 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 1c67732..e6bced1 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -1,7 +1,8 @@
import Control.Monad.Reader
- ( MonadReader (ask),
+ ( MonadIO (liftIO),
+ MonadReader (ask),
ReaderT (runReaderT),
- liftM2, MonadIO (liftIO),
+ liftM2,
)
import Data.Char (toUpper)
import Data.List (isInfixOf, isPrefixOf)
@@ -114,7 +115,6 @@ main = do
spawn fp
spawnOnce "alacritty --class popup-terminal"
addScreenCorner SCUpperLeft (liftIO $ putStrLn "Hello, World!"),
-
manageHook =
composeAll
[ isFullscreen --> doFullFloat,
@@ -177,10 +177,6 @@ shouldChromeFloat = do
return $
className == "Google-chrome" && not ("New Tab" `isPrefixOf` title)
-changeHook :: Location -> Location -> X ()
-changeHook l1 l2 =
- logs Info "Change %s -> %s" (show l1) (show l2)
-
doLogWindow :: ManageHook
doLogWindow = do
t <- title
diff --git a/src/Rahm/Desktop/Dragging.hs b/src/Rahm/Desktop/Dragging.hs
index 1f19290..3e5fa30 100644
--- a/src/Rahm/Desktop/Dragging.hs
+++ b/src/Rahm/Desktop/Dragging.hs
@@ -1,4 +1,19 @@
-module Rahm.Desktop.Dragging where
+module Rahm.Desktop.Dragging
+ ( afterDrag,
+ isDragging,
+ finishDrag,
+ windowsUnderCursor,
+ sinkOnRelease,
+ sinkByWindowUnderCursor,
+ ifReleased,
+ ifReleased',
+ mouseResizeWindowAndThen,
+ mouseMoveWindowsAndThen,
+ dragWorkspace,
+ dragAlternateWorkspace,
+ dragWindow,
+ )
+where
import Control.Arrow ((&&&))
import qualified Control.Exception as C
@@ -17,10 +32,10 @@ import Rahm.Desktop.Layout.PinWindow (isWindowPinned, pinWindow, unpinWindow)
import Rahm.Desktop.Logger
import Rahm.Desktop.Marking (setAlternateWindows)
import qualified Rahm.Desktop.StackSet as W
+import Rahm.Desktop.Workspaces (accompanyingWorkspace)
import XMonad (X, io)
import qualified XMonad as X
import XMonad.Util.WindowProperties (getProp32s)
-import Rahm.Desktop.Workspaces (accompanyingWorkspace)
-- Action which happens after a dragging event.
--
diff --git a/src/Rahm/Desktop/PopupTerminal.hs b/src/Rahm/Desktop/PopupTerminal.hs
index fb38563..bf0b8c3 100644
--- a/src/Rahm/Desktop/PopupTerminal.hs
+++ b/src/Rahm/Desktop/PopupTerminal.hs
@@ -1,17 +1,23 @@
-module Rahm.Desktop.PopupTerminal where
+module Rahm.Desktop.PopupTerminal
+ ( getPopupTerminalWindow,
+ movePopupToCurrentWorkspace,
+ movePopupToHiddenWorkspace,
+ updatePopupTerminalHook,
+ )
+where
-import XMonad
-import qualified XMonad.Util.ExtensibleState as XS
-import Data.Monoid
import Control.Monad.Trans
-import qualified XMonad.StackSet as W
import Data.Foldable (forM_)
+import Data.Monoid
+import XMonad
+import qualified XMonad.StackSet as W
+import qualified XMonad.Util.ExtensibleState as XS
import XMonad.Util.SpawnOnce (spawnOnce)
newtype PopupTerminalState = PopupTerminalState
- {
- popupTerminalWindow :: Maybe Window
- } deriving (Show, Read)
+ { popupTerminalWindow :: Maybe Window
+ }
+ deriving (Show, Read)
instance ExtensionClass PopupTerminalState where
initialValue = PopupTerminalState Nothing
@@ -25,8 +31,8 @@ movePopupToCurrentWorkspace = do
mWin <- getPopupTerminalWindow
forM_ mWin $ \win -> do
windows $ \ws ->
- W.focusWindow win $
- W.shiftWin (W.tag (W.workspace (W.current ws))) win ws
+ W.focusWindow win $
+ W.shiftWin (W.tag (W.workspace (W.current ws))) win ws
movePopupToHiddenWorkspace :: X ()
movePopupToHiddenWorkspace = do
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