From 80913aeed46fc607f057a77ffdd884b5db77a0bc Mon Sep 17 00:00:00 2001 From: Pavan Rikhi Date: Thu, 9 Apr 2020 13:51:37 -0400 Subject: Add a HandleReader Plugin This adds a new `HandleReader` plugin, which displays data from a Haskell `Handle`. This is really only useful if you are running xmobar from within another Haskell program, but lets you avoid the mechanics of creating a named pipe with the proper file permissions. Instead, you can use `System.Process.createPipe` to make a pair of read & write Handles. If you pass the read handle to HandleReader, you can use hPutStr on the write Handle to send data to xmobar from your application code. --- readme.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'readme.md') diff --git a/readme.md b/readme.md index 2a57860..aab8894 100644 --- a/readme.md +++ b/readme.md @@ -1613,6 +1613,23 @@ will display "N/A" if for some reason the `date` invocation fails. logHook = dynamicLogString myPP >>= xmonadPropLog } +### `HandleReader Handle Alias` + +- Display data from a Haskell `Handle` +- This plugin is only useful if you are running xmobar from another Haskell + program like XMonad. +- You can use `System.Process.createPipe` to create a pair of `read` & `write` + Handles. Pass the `read` Handle to HandleReader and write your output to the + `write` Handle: + + (readHandle, writeHandle) <- createPipe + xmobarProcess <- forkProcess $ xmobar myConfig + { commands = + Run (HandleReader readHandle "handle") : commands myConfig + } + hPutStr writeHandle "Hello World" + + # Plugins ## Writing a Plugin -- cgit v1.2.3