aboutsummaryrefslogtreecommitdiff
path: root/src/Rahm/Desktop/Hooks/WindowChange.hs
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2022-11-21 12:05:03 -0700
committerJosh Rahm <rahm@google.com>2022-11-21 12:05:03 -0700
commitee9be16599f20aef6d1d3fd15666c00452f85aba (patch)
tree1aed66c1de2ce201463e3becc2d452d4a8aa2992 /src/Rahm/Desktop/Hooks/WindowChange.hs
parenta1636c65e05d02f7d4fc408137e1d37b412ce890 (diff)
downloadrde-ee9be16599f20aef6d1d3fd15666c00452f85aba.tar.gz
rde-ee9be16599f20aef6d1d3fd15666c00452f85aba.tar.bz2
rde-ee9be16599f20aef6d1d3fd15666c00452f85aba.zip
Format with ormolu.
Diffstat (limited to 'src/Rahm/Desktop/Hooks/WindowChange.hs')
-rw-r--r--src/Rahm/Desktop/Hooks/WindowChange.hs29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/Rahm/Desktop/Hooks/WindowChange.hs b/src/Rahm/Desktop/Hooks/WindowChange.hs
index 3bc66a4..092fbf4 100644
--- a/src/Rahm/Desktop/Hooks/WindowChange.hs
+++ b/src/Rahm/Desktop/Hooks/WindowChange.hs
@@ -1,12 +1,11 @@
module Rahm.Desktop.Hooks.WindowChange where
-import XMonad
import Control.Monad
-import qualified XMonad.Util.ExtensibleState as XS
import Data.Default
import Rahm.Desktop.Common
-
import qualified Rahm.Desktop.StackSet as W
+import XMonad
+import qualified XMonad.Util.ExtensibleState as XS
newtype LastLocation = LastLocation (Maybe Location)
deriving (Read, Show)
@@ -17,7 +16,7 @@ instance Default LastLocation where
instance ExtensionClass LastLocation where
initialValue = def
extensionType = PersistentExtension
-
+
-- Creates a log hook from the function provided.
--
-- The first argument to the function is the old window, the second argument in
@@ -26,18 +25,18 @@ instance ExtensionClass LastLocation where
-- If the first window is Nothing, this is the first time XMonad started.
withLocationChangeHook :: (Maybe Location -> Location -> X ()) -> XConfig l -> XConfig l
withLocationChangeHook fn config =
- config {
- logHook = do
- logHook config
+ config
+ { logHook = do
+ logHook config
- currentLocation <-
- Location <$> getCurrentWorkspace <*> withWindowSet (return . W.peek)
+ currentLocation <-
+ Location <$> getCurrentWorkspace <*> withWindowSet (return . W.peek)
- LastLocation last <- XS.get
+ LastLocation last <- XS.get
- when (last /= Just currentLocation) $
- fn last currentLocation
+ when (last /= Just currentLocation) $
+ fn last currentLocation
- XS.put $ LastLocation $ Just currentLocation
- return ()
- }
+ XS.put $ LastLocation $ Just currentLocation
+ return ()
+ }