Enabling extensions when using xmobar as a library?
solomon-b opened this issue · comments
This may simply be an XY problem, but bear with me..
I want to use a a haskell source file to configure xmobar
as shown here. I also would ideally like to be able to import arbitrary libraries to use in my config. However I am on nixos and this doesn't work out of the box:
➜ xmobar xmobar.hs
Error detected while loading xmobar configuration file: ./xmobar.hs
xmobar.hs:1:1: error:
Could not find module ‘Xmobar’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
1 | import Xmobar
| ^^^^^^^^^^^^^
Please check the file for errors.
So I made a cabal project called my-xmobar
and imported the xmobar
package as a dependency. I can now use your example xmobar.hs
as my main.hs
and run it. However, if I try to use XFT fonts then I get this error:
➜ cabal run
Up to date
Warning: Xmobar must be built with the with_xft flag to support font 'xft:Bitstream Vera Sans Mono:size=11:bold:antialias=true.' Falling back on default.
Since I'm using xmobar
as a library I don't see a way to enable that flag. Is there a way to enable all the extensions when using xmobar
in this way? Alternatively, is there a simpler way to be able to run xmobar
using a haskell source file and ideally be able to add arbitrary dependencies?
Thank you this was really helpful!
This is solved now right?
Should there be an example somewhere in this repository before closing the issue? Maybe not. I think it is a tooling use/discovery issue. Regardless, this issue helped me :)
When used with cabal and using xmobar from xmonad, i have a cabal.project with a constraints stanza
constraints: xmobar +with_xft +with_alsa
this is definitely a tooling discovery issue