summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/App/Main.hs
diff options
context:
space:
mode:
authorChuck <chuck@intelligence.org>2019-09-05 11:11:12 -0700
committerjao <jao@gnu.org>2019-09-06 06:05:14 +0100
commite4b0a5ed59c168d1802648659e087a8191589c1f (patch)
treef81e7a0054e2e71e5f84b207853449237ba2982d /src/Xmobar/App/Main.hs
parent3105055dd2ff93b46e7e38a4bb697b284be338f3 (diff)
downloadxmobar-e4b0a5ed59c168d1802648659e087a8191589c1f.tar.gz
xmobar-e4b0a5ed59c168d1802648659e087a8191589c1f.tar.bz2
Write error log to data dir, not conf dir
Write xmobar.errors to XMOBAR_DATA_DIR, not XMOBAR_CONFIG_DIR. This allows XMOBAR_CONFIG_DIR to be read-only. This brings xmobar into alignment with how xmonad manages its analogous directories (before this change, a read-only DATA dir worked with xmonad but not with xmobar).
Diffstat (limited to 'src/Xmobar/App/Main.hs')
-rw-r--r--src/Xmobar/App/Main.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Xmobar/App/Main.hs b/src/Xmobar/App/Main.hs
index e54c846..714d153 100644
--- a/src/Xmobar/App/Main.hs
+++ b/src/Xmobar/App/Main.hs
@@ -70,14 +70,14 @@ cleanupThreads vars =
for_ (concat vars) $ \(asyncs, _) ->
for_ asyncs cancel
-buildLaunch :: Bool -> Bool -> FilePath -> ParseError -> IO ()
-buildLaunch verb force p e = do
+buildLaunch :: Bool -> Bool -> FilePath -> String -> ParseError -> IO ()
+buildLaunch verb force p datadir e = do
let exec = takeBaseName p
- dir = takeDirectory p
+ confDir = takeDirectory p
ext = takeExtension p
if ext `elem` [".hs", ".hsc", ".lhs"]
- then recompile dir exec force verb >>
- executeFile (dir </> exec) False [] Nothing
+ then recompile confDir datadir exec force verb >>
+ executeFile (confDir </> exec) False [] Nothing
else trace True ("Invalid configuration file: " ++ show e) >>
trace True "\n(No compilation attempted: \
\only .hs, .hsc or .lhs files are compiled)"
@@ -101,7 +101,8 @@ xmobarMain = do
(c:_) -> error $ c ++ ": file not found"
_ -> doOpts defaultConfig flags >>= xmobar
Just p -> do r <- readConfig defaultConfig p
+ dataDir <- xmobarDataDir
case r of
Left e ->
- buildLaunch (verboseFlag flags) (recompileFlag flags) p e
+ buildLaunch (verboseFlag flags) (recompileFlag flags) p dataDir e
Right (c, defs) -> doOpts c flags >>= xmobar' defs