diff options
Diffstat (limited to 'src/Rahm/Desktop/Hooks/WindowChange.hs')
| -rw-r--r-- | src/Rahm/Desktop/Hooks/WindowChange.hs | 29 |
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 () + } |