mirror of
https://github.com/xmonad/xmonad.git
synced 2025-05-19 08:30:21 -07:00
add getXMonadDir (2nd try)
This commit is contained in:
parent
1ab1d729a0
commit
4fa10442ab
5
Main.hs
5
Main.hs
@ -16,11 +16,10 @@ module Main (main) where
|
|||||||
|
|
||||||
import XMonad.Main
|
import XMonad.Main
|
||||||
import XMonad.Config
|
import XMonad.Config
|
||||||
import XMonad.Core (recompile)
|
import XMonad.Core (getXMonadDir, recompile)
|
||||||
|
|
||||||
import Control.Exception (handle)
|
import Control.Exception (handle)
|
||||||
import System.IO
|
import System.IO
|
||||||
import System.Directory
|
|
||||||
import System.Environment
|
import System.Environment
|
||||||
import System.Posix.Process (executeFile)
|
import System.Posix.Process (executeFile)
|
||||||
|
|
||||||
@ -44,7 +43,7 @@ main = do
|
|||||||
buildLaunch :: IO ()
|
buildLaunch :: IO ()
|
||||||
buildLaunch = do
|
buildLaunch = do
|
||||||
recompile False
|
recompile False
|
||||||
dir <- fmap (++ "/.xmonad") getHomeDirectory
|
dir <- getXMonadDir
|
||||||
args <- getArgs
|
args <- getArgs
|
||||||
executeFile (dir ++ "/xmonad") False args Nothing
|
executeFile (dir ++ "/xmonad") False args Nothing
|
||||||
return ()
|
return ()
|
||||||
|
@ -26,7 +26,7 @@ module XMonad.Core (
|
|||||||
SomeMessage(..), fromMessage, runLayout, LayoutMessages(..),
|
SomeMessage(..), fromMessage, runLayout, LayoutMessages(..),
|
||||||
runX, catchX, userCode, io, catchIO,
|
runX, catchX, userCode, io, catchIO,
|
||||||
withDisplay, withWindowSet, isRoot,
|
withDisplay, withWindowSet, isRoot,
|
||||||
getAtom, spawn, restart, recompile, trace, whenJust, whenX,
|
getAtom, spawn, restart, getXMonadDir, recompile, trace, whenJust, whenX,
|
||||||
atom_WM_STATE, atom_WM_PROTOCOLS, atom_WM_DELETE_WINDOW, ManageHook, Query(..), runManageHook
|
atom_WM_STATE, atom_WM_PROTOCOLS, atom_WM_DELETE_WINDOW, ManageHook, Query(..), runManageHook
|
||||||
) where
|
) where
|
||||||
|
|
||||||
@ -313,6 +313,10 @@ restart mprog resume = do
|
|||||||
catchIO (executeFile prog True args Nothing)
|
catchIO (executeFile prog True args Nothing)
|
||||||
where showWs = show . mapLayout show
|
where showWs = show . mapLayout show
|
||||||
|
|
||||||
|
-- | Return the path to @~\/.xmonad@.
|
||||||
|
getXMonadDir :: MonadIO m => m String
|
||||||
|
getXMonadDir = io $ getAppUserDataDirectory "xmonad"
|
||||||
|
|
||||||
-- | 'recompile force', recompile ~\/.xmonad\/xmonad.hs when any of the
|
-- | 'recompile force', recompile ~\/.xmonad\/xmonad.hs when any of the
|
||||||
-- following apply:
|
-- following apply:
|
||||||
-- * force is True
|
-- * force is True
|
||||||
@ -327,7 +331,7 @@ restart mprog resume = do
|
|||||||
--
|
--
|
||||||
recompile :: MonadIO m => Bool -> m ()
|
recompile :: MonadIO m => Bool -> m ()
|
||||||
recompile force = io $ do
|
recompile force = io $ do
|
||||||
dir <- (++ "/.xmonad") <$> getHomeDirectory
|
dir <- getXMonadDir
|
||||||
let bin = dir ++ "/" ++ "xmonad"
|
let bin = dir ++ "/" ++ "xmonad"
|
||||||
err = bin ++ ".errors"
|
err = bin ++ ".errors"
|
||||||
src = bin ++ ".hs"
|
src = bin ++ ".hs"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user