summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTomas Janousek <tomi@nomi.cz>2022-02-20 19:52:54 +0000
committerTomas Janousek <tomi@nomi.cz>2022-02-20 19:57:28 +0000
commit7cca823651a4a33e0c99d4062a382704f7904572 (patch)
tree863a95147bc9048c40cd2f4d3cf3f718520135c1
parent80b8030505699e9a734ea83423d526d97e0684ec (diff)
downloadxmobar-7cca823651a4a33e0c99d4062a382704f7904572.tar.gz
xmobar-7cca823651a4a33e0c99d4062a382704f7904572.tar.bz2
Documentation: More robust QueueReader example
1. Call `initThreads` early because there's no guarantee the xmobar thread will do this before xmonad makes any Xlib calls (although it's likely as xmonad startup is probably more expensive). 2. Use `forkOS` to fail early if running in a non-threaded RTS. Also, xmobar's own main thread would normally be a bound thread, so this may (likely non-observably) result in more consistent behaviour. Related: https://github.com/jaor/xmobar/issues/571
-rw-r--r--doc/window-managers.org3
1 files changed, 2 insertions, 1 deletions
diff --git a/doc/window-managers.org b/doc/window-managers.org
index 6403e37..5c5b083 100644
--- a/doc/window-managers.org
+++ b/doc/window-managers.org
@@ -200,8 +200,9 @@ choice.
#+begin_src haskell
main :: IO ()
main = do
+ initThreads
q <- STM.newTQueueIO @String
- bar <- forkIO $ xmobar myConf
+ bar <- forkOS $ xmobar myConf
{ commands = Run (QueueReader q id "XMonadLog") : commands myConf }
xmonad $ def { logHook = logWorkspacesToQueue q }