From 7cca823651a4a33e0c99d4062a382704f7904572 Mon Sep 17 00:00:00 2001 From: Tomas Janousek Date: Sun, 20 Feb 2022 19:52:54 +0000 Subject: 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 --- doc/window-managers.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 } -- cgit v1.2.3