diff options
-rw-r--r-- | XMonad/Stockholm/Shutdown.hs | 14 | ||||
-rw-r--r-- | xmonad-stockholm.cabal | 1 |
2 files changed, 13 insertions, 2 deletions
diff --git a/XMonad/Stockholm/Shutdown.hs b/XMonad/Stockholm/Shutdown.hs index 373214e..9d759db 100644 --- a/XMonad/Stockholm/Shutdown.hs +++ b/XMonad/Stockholm/Shutdown.hs @@ -9,14 +9,24 @@ module XMonad.Stockholm.Shutdown import Control.Concurrent (threadDelay) import Control.Monad (forever, when) import Data.Monoid (All(All)) +import System.Directory (getAppUserDataDirectory) import System.Exit (exitSuccess) +import System.Environment (lookupEnv) import System.FilePath ((</>)) import System.IO.Error (isDoesNotExistError, tryIOError) import System.IO (hPutStrLn, stderr) import System.Posix.Process (getProcessID) import System.Posix.Signals (nullSignal, signalProcess) import System.Posix.Types (ProcessID) -import XMonad +import XMonad hiding (getXMonadDataDir) + + +-- XXX this is shim so xmonad-stockholm can be used for both xmonad-0.15 and +-- xmonad-0.17 based configurations. This will break on xmonad>=0.17 if +-- non-default directories are used. +getXMonadDataDir :: IO String +getXMonadDataDir = + maybe (getAppUserDataDirectory "xmonad") pure =<< lookupEnv "XMONAD_DATA_DIR" newShutdownEventHandler :: IO (Event -> X All) newShutdownEventHandler = do @@ -65,7 +75,7 @@ waitProcess pid = forever (signalProcess nullSignal pid >> threadDelay 10000) -- PID file stuff -- -getProcessIDFileName :: (Functor m, MonadIO m) => m FilePath +getProcessIDFileName :: IO FilePath getProcessIDFileName = (</> "xmonad.pid") <$> getXMonadDataDir writeProcessIDToFile :: IO () diff --git a/xmonad-stockholm.cabal b/xmonad-stockholm.cabal index 780cd81..d0998eb 100644 --- a/xmonad-stockholm.cabal +++ b/xmonad-stockholm.cabal @@ -9,6 +9,7 @@ Library Build-Depends: base, containers, + directory, filepath, unix, X11, |