summaryrefslogtreecommitdiff
path: root/desktop/xmonad
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2013-08-20 00:10:11 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2013-08-20 00:10:11 +0100
commit215b880dae5880793c2167fc9ee64a1d5c22a132 (patch)
tree77e51568aa0df0ca4b17733d26c1732fc5489049 /desktop/xmonad
parentf4a7267b0a2b30cec7ee530bde7f93c21d6124a8 (diff)
downloadresources-215b880dae5880793c2167fc9ee64a1d5c22a132.tar.bz2
Attempt to launch gnome display control center when screen count changes
Diffstat (limited to 'desktop/xmonad')
-rw-r--r--desktop/xmonad/xmonad.hs33
1 files changed, 31 insertions, 2 deletions
diff --git a/desktop/xmonad/xmonad.hs b/desktop/xmonad/xmonad.hs
index 8963dad..9aa3b06 100644
--- a/desktop/xmonad/xmonad.hs
+++ b/desktop/xmonad/xmonad.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE DeriveDataTypeable #-}
+
import XMonad
import XMonad.Config.Gnome
import XMonad.Actions.DynamicWorkspaces
@@ -21,7 +23,8 @@ import XMonad.Actions.WindowGo
import Control.Monad (liftM2)
import XMonad.Hooks.FadeInactive
import XMonad.Hooks.ManageHelpers
-
+import XMonad.Util.ExtensibleState as XS
+import XMonad.Layout.IndependentScreens (countScreens)
launchInSpeshulTerminal :: String -> String -> X ()
launchInSpeshulTerminal roleTitle cmd = do
@@ -53,9 +56,34 @@ myManageHook =
myLogHook client pp =
- (logHook gnomeConfig) >> dbusLogWithPP client pp >> fadeInactiveLogHook fadeAmount
+ ((logHook gnomeConfig) >>
+ dbusLogWithPP client pp >>
+ fadeInactiveLogHook fadeAmount)
where fadeAmount = 0.8
+data ScreenTracker = ScreenTracker { stScreenCount :: Int }
+ deriving (Typeable, Read, Show)
+
+instance ExtensionClass ScreenTracker where
+ initialValue = ScreenTracker { stScreenCount = 0 }
+ extensionType = PersistentExtension
+
+myStartupHook :: X ()
+myStartupHook = do
+ liftIO $ putStrLn "Starting up XMonad..."
+ st <- XS.get
+ let count = stScreenCount st
+ nowCount <- countScreens
+ if count == nowCount
+ then liftIO $ putStrLn "No change"
+ else do
+ XS.put $ st { stScreenCount = nowCount }
+ liftIO $ putStrLn $ "Changed from " ++ (show count) ++ " to " ++ (show nowCount)
+ if (count /= 0)
+ then safeSpawn "gnome-control-center" ["display"]
+ else return ()
+
+ liftIO $ putStrLn "Startup hook completed."
main :: IO ()
main = do
@@ -72,6 +100,7 @@ main = do
. minimize
. mkToggle (single FULL)
$ (layoutHook gnomeConfig)
+ , startupHook = myStartupHook
} `EZ.additionalKeysP`
[ -- General keys
("M-x", spawn "gnome-terminal")