You are not logged in.

#1 2014-08-11 16:02:34

davama
Member
From: NY
Registered: 2014-02-07
Posts: 45

[Solved] Xmobar and mpd

Hello im back but now with an xmobar question.
Trying to get mpd stats to show on xmobar
Installled xmobar from cabal using --flags="all_extensions". Had some problems with this since c2hs wasnt found, just added "~/.cabal/bin" to my $PATH
when i add the mdp run command to xmobar i get

xmobar: .xmonad/xmobar.hs: configuration file contains errors at:
"Config" (line 19, column 11):
unexpected "s"
expecting space or "Run"

xmobar 0.21
(C) 2007 - 2010 Andrea Rossato
(C) 2010 - 2014 Jose A Ortega Ruiz
<xmobar@projects.haskell.org>

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more details.


here is the xmobar.hs file

Config  { font = "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*"
        , bgColor = "black"
        , fgColor = "grey" 
        , position = Top L 90
        , commands = [ Run Weather "KLGA" ["-t", "<stationState>:<tempF>F |","-L","40","-H","90","--low","blue","--normal","green","--high","red"] 36000
		     , Run MultiCpu ["-t", "CPU: <autototal>%","-L","3","-H","50","--normal","green","--high","red"] 10
                     , Run Memory ["-t","Mem: <usedratio>%","-L","1","-H","75","--normal","green","--high","red"] 10
                     , Run Date "%a %b %_d %Y %H:%M:%S" "date" 10
                     , Run DynNetwork ["-t","<rx><tx>","-S","True","-L","0","-H","70","--normal","green","--high","red"] 10
		     , Run Uptime [] 600
		     , Run Com "/home/dvmacias/.xmonad/bin/connection.sh" [] "Connection" 10
		     , Run MPD ["-t","<composer> <title> <plength> <statei> "] 10
		     , Run Battery ["-L","50","-H","75","--high","green","--normal","yellow", "--low", "red", "--template", "bat:<left> |"] 100
		     , Run Com "/home/dvmacias/.xmonad/bin/volume.sh" [] "vol" 1
		     , Run Com "/home/dvmacias/.xmonad/bin/media.sh" [] "media" 1
		     , Run StdinReader 
                     ]
        , sepChar = "%"
        , alignSep = "}{"
        , template = "%StdinReader% }{ %KLGA% %battery% %multicpu% | %memory% | %Connection% %dynnetwork% | <action=`xclock`><fc=#ee9a00>%date%</fc></action> | Vol: <fc=green>%vol%</fc> | %uptime% %media%  %mpd% "
        }

The config file runs fine but with the mpd commented out.

Thank you in advance for your help in this.

-Dave

Last edited by davama (2014-08-13 15:38:32)

Offline

#2 2014-08-11 20:34:53

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: [Solved] Xmobar and mpd

The version in the repos doesn't have MPD support compiled in. That's why you're seeing the error that you are.

Offline

#3 2014-08-11 21:41:20

davama
Member
From: NY
Registered: 2014-02-07
Posts: 45

Re: [Solved] Xmobar and mpd

I could have sworn i did. But will try again tomorrow. Will post an update then. Thanks for responding skottish

Offline

#4 2014-08-11 22:23:58

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: [Solved] Xmobar and mpd

davama wrote:

I could have sworn i did. But will try again tomorrow. Will post an update then. Thanks for responding skottish

I apologize for assuming that you were using the version from the repos. It's just that I was able to reproduce your error and with a quick build of xmobar, the problem went away.

Offline

#5 2014-08-12 12:38:32

davama
Member
From: NY
Registered: 2014-02-07
Posts: 45

Re: [Solved] Xmobar and mpd

So i tried again. this time with the AUR packages.

(2/2) checking available disk space                                                                                                             [########################################################################################] 100%
(1/1) removing xmobar                                                                                                                           [########################################################################################] 100%
(1/1) installing xmobar-git                                                                                                                     [########################################################################################] 100%
Optional dependencies for xmobar-git
    haskell-alsa-mixer: Enables Volume plugin. [installed]
    haskell-dbus: Control xmobar with DBUS.
    haskell-libmpd: Enables MPD plugin. [installed]
    haskell-hinotify: Support for inotify.
    haskell-timezone-olson: With haskell-timezone-series, enables DateZone plugin
    haskell-timezone-series: With haskell-timezone-olson, enables DateZone plugin
:: xmobar-git cleaned

But unfortunately nothing. I changed my xmobar.hs a bit. Actually running two instances at once. this is the xmobar.hs.down file with the mpd code inside

Config { font = "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*"
       , bgColor = "black"
       , fgColor = "grey"
       , position = Bottom
       , lowerOnStart = True
        , commands = [ Run Weather "KLGA" ["-t", "<stationState>:<tempF>F","-L","40","-H","90","--low","blue","--normal","green","--high","red"] 36000
                    , Run Date "%a %b %_d %Y %H:%M:%S" "date" 10
		    , Run Com "/home/dvmacias/.xmonad/bin/mpc.sh" [] "mpc" 1
		    , Run Com "/home/dvmacias/.xmonad/bin/media.sh" [] "media" 1
		    , Run Com "/home/dvmacias/.xmonad/bin/volume.sh" [] "vol" 1
		    , Run MPD ["-t","<composer> <title> (<album>) <track>/<plength> <statei> ","--", "-P", ">>", "-Z", "|", "-S", "><"] 10
                    ]
       , sepChar = "%"
       , alignSep = "}{"
       , template = "<action=`xclock`><fc=#ee9a00>%date%</fc></action> | Vol: <fc=green>%vol%</fc> | %KLGA% | %mpd% }{ %media% <fc=green>%mpc%</fc>"
       }

but i still get:

xmobar: .xmonad/xmobar.hs.down: configuration file contains errors at:
"Config" (line 13, column 10):
unexpected "s"
expecting space or "Run"

As a work around i wrote a script "/home/dvmacias/.xmonad/bin/mpd.sh" but i would like to use the xmobar plugin. Any else i should try or check?

Thank you again.

Offline

#6 2014-08-12 17:03:43

davama
Member
From: NY
Registered: 2014-02-07
Posts: 45

Re: [Solved] Xmobar and mpd

skottish can you be so kind to tell me what you did?
i even tried it from source, downloading it from git.
and set the xmobar.cabal file dependencies to true but no change.
using the haskell site instructions
http://projects.haskell.org/xmobar/

Thanks

Offline

#7 2014-08-12 17:19:22

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: [Solved] Xmobar and mpd

The PKGBUILD that I used is this:

pkgname=xmobar
pkgver=0.21
pkgrel=2
pkgdesc="A Minimalistic Text Based Status Bar"
url="http://hackage.haskell.org/package/xmobar"
license=('custom:BSD3')
arch=('i686' 'x86_64')
depends=('gmp' 'libxft' 'libxinerama' 'wireless_tools' 'libxrandr')
makedepends=('ghc' 'haskell-x11' 'haskell-x11-xft' 'haskell-utf8-string' 'haskell-http' 'haskell-libmpd'
	     'haskell-stm' 'haskell-parsec' 'haskell-mtl' 'haskell-regex-base' 'haskell-regex-compat')
options=('strip')
source=(http://hackage.haskell.org/packages/archive/xmobar/$pkgver/xmobar-$pkgver.tar.gz)
md5sums=('8d4442d3772ad9f475d96b955fda220d')

build() {
    cd ${srcdir}/xmobar-$pkgver

    runhaskell Setup configure --disable-optimization --prefix=/usr --flags="with_utf8 with_xft with_iwlib with_mpd"
    runhaskell Setup build
}

package() {
    cd ${srcdir}/xmobar-$pkgver
    runhaskell Setup copy --destdir=${pkgdir}
    install -D -m644 license ${pkgdir}/usr/share/licenses/$pkgname/LICENSE
}

All of my Haskell packages are either from [haskell-core] from Arch Haskell or stuff I created myself.

The new version that you posted runs on my machine without my even having your scripts, so I'm wondering if there's somthing not correct about the installation of your packages. Does this tell you anything useful about packages not being installed correctly?

ghc -v

Offline

#8 2014-08-12 18:17:17

davama
Member
From: NY
Registered: 2014-02-07
Posts: 45

Re: [Solved] Xmobar and mpd

Running "ghc -v" gives me:

Glasgow Haskell Compiler, Version 7.8.3, stage 2 booted by GHC version 7.8.2
Using binary package database: /usr/lib/ghc-7.8.3/package.conf.d/package.cache
Using binary package database: /home/dvmacias/.ghc/x86_64-linux-7.8.3/package.conf.d/package.cache
hiding package transformers-0.3.0.0 to avoid conflict with later version transformers-0.4.1.0
wired-in package ghc-prim mapped to ghc-prim-0.3.1.0-954cb57749cf319beafdc89b3415422c
wired-in package integer-gmp mapped to integer-gmp-0.5.1.0-d42e6a7874a019e6a0d1c7305ebc83c4
wired-in package base mapped to base-4.7.0.1-e4b74d27ad8c8987c63abc42a80e7335
wired-in package rts mapped to builtin_rts
wired-in package template-haskell mapped to template-haskell-2.9.0.0-3afdeeadb657091939ef0bfa600dc614
wired-in package dph-seq not found.
wired-in package dph-par not found.
Hsc static flags: 
*** Deleting temp files:
Deleting: 
*** Deleting temp dirs:
Deleting: 
ghc: no input files
Usage: For basic information, try the `--help' option.

I tried using your PKGBUILD but got this. Looks like dependencies again.....

-> makepkg -s
==> Making package: xmobar 0.21-2 (Tue Aug 12 14:15:26 EDT 2014)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Found xmobar-0.21.tar.gz
==> Validating source files with md5sums...
    xmobar-0.21.tar.gz ... Passed
==> Extracting sources...
  -> Extracting xmobar-0.21.tar.gz with bsdtar
==> Removing existing pkg/ directory...
==> Starting build()...
Configuring xmobar-0.21...
Setup: At least the following dependencies are missing:
HTTP >=4000,
X11 >=1.6.1,
X11-xft >=0.2 && <0.4,
libmpd ==0.8.*,
mtl >=2.0 && <2.3,
parsec ==3.1.*,
regex-compat -any,
stm >=2.3 && <2.5,
utf8-string ==0.3.*
==> ERROR: A failure occurred in build().
    Aborting...

Offline

#9 2014-08-12 18:46:26

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: [Solved] Xmobar and mpd

ghc -v only has one complaint (transformers), but it seems to have worked around it. It is looking for the package cache in your home directory instead of the system version. I actually deleted the one out of my home directory because my Haskell installation was getting messed up. You could try this as well:

ghc-pkg check

As well, it may be helpful to look at cabal and see what it thinks is installed. This one isn't too noisy:

cabal list X11

Offline

#10 2014-08-13 15:36:38

davama
Member
From: NY
Registered: 2014-02-07
Posts: 45

Re: [Solved] Xmobar and mpd

skottish... im a fool!

I realized that when i did a cabla install xmobar blablah it was system wide so i had so many little issues. Deleting ~/.cabal and ~/.ghc was not enough
so i basically wiped everything and started from scratch again. I have all my files backup-ed so setup is just copy paste or ln -s and it just works.

Ok so now for the explanation:
DO NOT SYSTEM WIDE cabal install pkg. it is not a package manager. Instead if possible use aur packages.
commands i used:

pacaur -S xmobar-git
pacaur -S haskell-libmpd

thanks for you help in this skottish really appreciate it.
Marking as Solved!

Offline

#11 2014-08-13 15:46:14

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: [Solved] Xmobar and mpd

Sweet!

It's unclear to me if you know about ArchHaskell, but if not, packages like haskell-libmpd are already available. If you decide to enable it, it needs to go above [testing] in your pacman.conf file. As well, make sure that you use the 'xsounds' repo as 'kiwilight' seems to be less stable from my experience. As with before, it's best to remove everything and resinstall with the new repo.

Last edited by skottish (2014-08-13 15:48:02)

Offline

#12 2014-08-14 13:27:57

davama
Member
From: NY
Registered: 2014-02-07
Posts: 45

Re: [Solved] Xmobar and mpd

No i did not. That is soo cool. Better than using cabal i think.
Follow the wiki and it still works like a charm.

Thanks for the info.
Take care

Offline

Board footer

Powered by FluxBB