[xmonad] FZF integration

Thomas Droxler thomas.droxler at gmail.com
Fri Sep 1 13:38:46 UTC 2017


Hi all,

I'm a big fan of FZF <https://github.com/junegunn/fzf> and I wanted to make
an xmonad integration, to work like Util.Dmenu
<https://hackage.haskell.org/package/xmonad-contrib-0.13/docs/XMonad-Util-Dmenu.html>.
I'm quite new to Haskell and I got some problems to do it.

The main problem I have is that fzf needs to run in a shell and when I run
an external terminal, it sucessfully pops up, but then the rest of the code
continue to be executed and I can't wait for the output of fzf. Moreover,
fzf give an output in the terminal, but then how do I get the output in my
haskell code?

I tried several think and the closest I got is to write the result of fzf
in a file and read it back, but I cannot wait until my terminal shutdown to
read my file, I have something like:

*(filePath, handle) <- openTempFile "*path*" "fzf"*
*hClose handle*
*(_, _, _, procHandle) <- runInteractiveCommand ("xterm -e '*dataForFZF* |
fzf >" ++ filePath ++"'")*
*-- Here I need to wait that my term close, I tried: waitForProcess
procHandle*
*-- But it just freeze my Xmonad, and not sure a while loop on
getProcessExitCode is better*
*str <- readFile filePath*
doSomethingWith* str*
*removeFile filePath*

Anyone has a hint to do this?

Thanks a lot, cheers.

Thomas Droxler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/xmonad/attachments/20170901/139babab/attachment.html>


More information about the xmonad mailing list