diff options
author | tv <tv@krebsco.de> | 2022-04-06 15:30:43 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2022-04-06 15:30:43 +0200 |
commit | 834baebfec3296d4ca71661c77cdc5ad8906c024 (patch) | |
tree | 86b3c4fba5e3e634585c054e054ba1e80bd9d027 | |
parent | 6421da4e02383bae762fabae97974091733a3386 (diff) |
shutdown: add xmonad-0.17 compatibility1.3.0
-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, |