You are not logged in.

#1 2009-12-22 02:53:45

camphor
Member
Registered: 2009-03-01
Posts: 32

[SOLVED] Need help with dzen2, conky and xmonad.

Hey all. I've recently been using XMonad and have found it to be a really useful tool, especially when it comes to keeping me on task and dealing with screen real-estate. However, I've been having difficulty setting up a dzen2 status bar that displays what conky pipes into it.

Here is my xmonad.hs file :

import XMonad
import IO
import XMonad.Util.Run
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.DynamicLog
import XMonad.Layout.NoBorders
import XMonad.Util.EZConfig
main = do
    bar <- spawn myConkyBar
    xmonad $ defaultConfig
        {
          borderWidth        = 2
        , terminal        = "urxvt"
        , normalBorderColor     = "#343434"
        , focusedBorderColor    = "cyan" 
        , workspaces         = ["www","lp","letter","else"]
        , manageHook         = manageDocks <+> manageHook defaultConfig
             , layoutHook         = avoidStruts  $  layoutHook defaultConfig
        } `additionalKeys`
        [ ((0, xK_F12), spawn "urxvt")
        , ((mod4Mask.|. 0, xK_w), spawn "firefox")
        , ((mod4Mask .|. shiftMask, xK_w), spawn "scrot -s")
        , ((0, xK_Print), spawn "scrot -d 2")
        ] 

myConkyBar = "conky -c .conkyrc | dzen2 -fn 'Clean' -bg #343434 -x 0 -y 768"

And the relevant .conkyrc file:

 out_to_console yes
text_buffer_size 512
mpd_host localhost
mpd_port 6600
update_interval 1.0
cpu_avg_samples 2
net_avg_samples 2

TEXT
^fg(cyan)^i(/home/greg/.icons/mpd.xbm) ^fg(#E0EEEE)$mpd_smart ^fg(#343434)| ^fg(cyan)^i(/home/greg/.icons/cpu.xbm) ^fg(#FF69B4)${cpu cpu1}% ^fg(cyan)^i(/home/greg/.icons/cpu.xbm) ^fg(#FF69B4)${cpu cpu2}% ^fg(#343434)| ^fg(cyan)^i(/home/greg/.icons/mem.xbm) ^fg()$mem ^fg(#343434)| ^fg(cyan)^i(/home/greg/.icons/down.xbm) ^fg(#FF69B4)${downspeed wlan0} ^fg(cyan)^i(/home/greg/.icons/up.xbm) ^fg(#FF69B4)${upspeed wlan0} ^fg(#343434)| ^fg(red)${battery_percent BAT0}% ^fg(#343434)| ^fg(red)$acpitemp C ^fg(#343434)| ^fg(#CD5555)$kernel ^fg(#343434)| ^fg(cyan)${time %m-%d-%y %l:%M%p}

The main problem I'm having is that Xmonad will make the space for dzen, but conky will write to the root window, and not dzen. So the long string of text is written on the root window without any formatting, and dzen is (usually) just a black bar. I'm not the best with Haskell, but I am im
proving, so any help would be appreciated. smile

Also, I've noticed that dzen2 only updates when switching workspaces. Was I supposed to define an update interval somewhere?

Last edited by camphor (2009-12-23 04:53:35)

Offline

#2 2009-12-22 14:25:22

Lastebil
Member
From: Suomi
Registered: 2007-01-16
Posts: 35

Re: [SOLVED] Need help with dzen2, conky and xmonad.

I'm using xmobar now, not dzen2, so this may be a bit less helpful than I'd hope - but, when I _was_ using it, I noted that I needed to be VERY careful about how I piped info into dzen2.  Sometimes I would THINK I was piping stuff in, and lo and behold, I was piping it or directing it somewhere else.

So check your conky output - and be sure that it's "output to console" is getting directed into the dzen2 pipe.  It SHOULD be from what I see there.  But, well, try sticking "tee" in there so you can "tee" the output to a file as well as to dzen2, and maybe you'll see what the output actually is.  (man tee, if you're not familiar with this really useful redirection tool.)

Offline

#3 2009-12-22 15:11:39

blackz
Member
Registered: 2008-06-15
Posts: 10

Re: [SOLVED] Need help with dzen2, conky and xmonad.

i think you have to use the logHook,
this is part of my configuration, although i'm not using Xmonad anymore (haven't found the time to really configure it)

-- XMonad:
main = do
  xmobar <- spawnPipe myStatusBar
  dynHooksRef <- initDynamicHooks
  xmonad $ myUrgencyHook $ defaultConfig
 
    { terminal           = myTerminal
    , focusFollowsMouse  = myFocusFollowsMouse
    , borderWidth        = myBorderWidth
    , modMask            = myModMask
    --, numlockMask        = myNumlockMask
    , workspaces         = myWorkspaces
    , normalBorderColor  = myNormalBorderColor
    , focusedBorderColor = myFocusedBorderColor
    , layoutHook         = myLayout
    , manageHook         = myManageHook <+> manageDocks <+> dynamicMasterHook dynHooksRef
    , handleEventHook    = myEventHook
    , logHook          = dynamicLogWithPP $ myXmobarPP xmobar
    , startupHook        = myStartupHook
    }

is using Xmobar, but the config from where i took this was using dzen, maybe you can use that:

http://haskell.org/haskellwiki/Xmonad/C … _xmonad.hs

ps: sorry for the awful english.

Offline

#4 2009-12-22 15:45:36

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: [SOLVED] Need help with dzen2, conky and xmonad.

i use conky-cli with dzen in xmonad.

i have two dzen's setup to look like one.  the left is piped from the logHook (which you don't have) and the right is piped from conky-cli.

xmonad -> dzen you need something like

main = do
  d <- spawnPipe myLeftDzen
  xmonad $ defaultConfig
    { ...
    , logHook = myLogHook d
    , ...
    }

myLogHook h = -- whatever ppStuff you want outputting to a handle defined as `h'

but in your case it should simply be

main = do
  spawn myBar
  xmonad $ defaultConfig
    { ..

myBar = "conky -c ~/.conky | dzen -options... "

i wrote a post on my site about all this but it appears to be down right now hmm  (this also means i don't have access to my xmonad.hs to confirm my code blocks above).

oh, i also have "out_to_x no" in my conkyrc along with the "out_to_console yes" setting.

HTH,
Pat

Last edited by brisbin33 (2009-12-22 15:46:50)

Offline

#5 2009-12-23 04:53:10

camphor
Member
Registered: 2009-03-01
Posts: 32

Re: [SOLVED] Need help with dzen2, conky and xmonad.

Lastebil wrote:

I'm using xmobar now, not dzen2, so this may be a bit less helpful than I'd hope - but, when I _was_ using it, I noted that I needed to be VERY careful about how I piped info into dzen2.  Sometimes I would THINK I was piping stuff in, and lo and behold, I was piping it or directing it somewhere else.

This was actually the case. I was using my normal conky bin instead of one I had compiled specifically for the purpose of piping into dzen2, and that was causing both problems.

Thanks to everyone for all of the useful tips! smile

Offline

Board footer

Powered by FluxBB