You are not logged in.

#1 2008-12-09 00:51:39

Roberth
Member
From: The Pale Blue Dot
Registered: 2007-01-12
Posts: 894

Getting xmonad, dzen and conky to go hand in hand...

Hello

Here is my config

import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run
import XMonad.Util.Loggers
import XMonad.Util.EZConfig(additionalKeys)
import System.IO
 
main = do
  statuspipe <- spawnPipe "dzen2 -bg black -fg white -ta l -w 1680"
  xmonad $ defaultConfig {
     terminal = "terminal --hide-menubar",
         borderWidth = 2,
         normalBorderColor = "#000000",
         focusedBorderColor = "#0071FF",
         manageHook = manageDocks <+> manageHook defaultConfig,
         layoutHook = avoidStruts  $  layoutHook defaultConfig,
     logHook = dynamicLogWithPP $ defaultPP 
         { 
         ppCurrent           = dzenColor "#FFFFFF" "#0071FF"
         , ppOutput          = hPutStrLn statuspipe
         -- , ppVisible         = dzenColor "#8B80A8" ""
         , ppHidden          = dzenColor "#FFFFFF" ""
         , ppHiddenNoWindows = dzenColor "#4A4459" ""
         -- , ppLayout          = dzenColor "#6B6382" ""
         , ppSep             = "  "
         , ppWsSep           = " "
         , ppUrgent          = dzenColor "#0071FF" ""
         -- , ppTitle           = dzenColor "#AA9DCF" "". shorten 700 . dzenEscape
         }
 
 
         }

     `additionalKeys`
     [ 
    ((0, xK_Print), spawn "scrot") , 
    ((mod1Mask, xK_F2), spawn "gmrun") 
     ]

As you can see I am running dzen straigth out of the xmonad config, the reason I need to do that is the status stuff for xmonad. And now I want to add conky stuff to it. The only way I found(or to honest a friend of mine sort of) was to add the line ppExtra which uses logcmd to run conky.

The solution was great exept, I wasn't able to adjust where I wanted the conky on my dzen bar it was just placed right beside the status stuff in the dzen since conky couldn't decide itself where to be. The solution on the wiki wount work for me since I have the status stuff on dzen.

So any suggestions?


Use the Source, Luke!

Offline

#2 2008-12-09 01:18:29

SamC
Member
From: Calgary
Registered: 2008-05-13
Posts: 611
Website

Re: Getting xmonad, dzen and conky to go hand in hand...

Most people run more than one dzen bar.

Offline

#3 2008-12-09 01:20:23

Roberth
Member
From: The Pale Blue Dot
Registered: 2007-01-12
Posts: 894

Re: Getting xmonad, dzen and conky to go hand in hand...

But Can I run them on top of each other?


Use the Source, Luke!

Offline

#4 2008-12-09 02:03:38

Sakurina
Member
From: Trois-Rivieres, Quebec, Canada
Registered: 2008-10-09
Posts: 90
Website

Re: Getting xmonad, dzen and conky to go hand in hand...

SamC wrote:

Most people run more than one dzen bar.

It took me like two months to realize this, but this is true.

Roberth wrote:

But Can I run them on top of each other?

You could just set widths and give the second dzen instance start coordinates.

Offline

#5 2008-12-09 19:09:58

sablabra
Member
Registered: 2008-07-21
Posts: 32

Re: Getting xmonad, dzen and conky to go hand in hand...

I've spent quite some time doing the exactly same thing as you're trying to achieve (I believe). My dzen bar(s) look like this:

200812091952561678x15scgz1.th.png

In order to achieve that I'm running two instances of dzen. One for the workspaces and title, and one for date/cpu load/ram etc. (which is sent directly from conky-cli). Both instances are started by xmonad using spawnPipe (configured in xmonad.hs.). I haven't added much comments to my xmonad.hs, but hopefully you'll figure it out tongue

{- xmonad.hs -}

-- Imports --
-- main
import XMonad
import IO (Handle, hPutStrLn)
-- utils
import XMonad.Util.Run (spawnPipe)
-- hooks
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.DynamicLog
-- layouts
import XMonad.Layout.NoBorders

---------------------------------------------------------------------
-- Variables --
myNormalBGColor     = "#2e3436"
myFocusedBGColor    = "#414141"
myNormalFGColor     = "#E0FFFF"
myFocusedFGColor    = "#1994d1"
myUrgentFGColor     = "#f57900"
myUrgentBGColor     = "#2e3436"
mySeperatorColor    = "#2e3436"
myVisibleBGColor    = "#515151"

-- Remember to change to appropiate path
xmonadDir           = "/home/<user>/.xmonad"

---------------------------------------------------------------------
-- Main --
main = do
        bar <- spawnPipe myWorkspaceBar
        bar2 <- spawnPipe myDateBar
        xmonad $ defaultConfig
                { manageHook            = manageDocks <+> manageHook defaultConfig
                , layoutHook            = myLayoutHook
                , logHook               = dynamicLogWithPP $ myDzenPP bar
                , workspaces            = myWorkspaces
                , terminal              = myTerminal
                , borderWidth           = myBorderWidth
                , normalBorderColor     = myNormalBorderColor
                , focusedBorderColor    = myFocusedBorderColor
                }

---------------------------------------------------------------------
-- Terminal --
myTerminal = "urxvt"

-- Workspaces --
myWorkspaces = ["1:main", "2:misc", "3", "4", "5", "6", "7", "8", "9"]

---------------------------------------------------------------------

-- Looks --
-- borders
myBorderWidth           = 1
myNormalBorderColor     = "grey30"
myFocusedBorderColor    = "#1994d1"

-- layoutHooks
myLayoutHook = avoidStruts (tiled ||| Mirror tiled ||| noBorders Full)
   where
     tiled = Tall 1 (3/100) (3/5)

---------------------------------------------------------------------
-- DZEN bars --
myWorkspaceBar = "dzen2 -p -ta l -h 12 -w 840 -x 1024 -bg black -fn '-*-terminus-*-*-*-*-*-*-*-*-*-*-*'"
myDateBar = "conky | dzen2 -ta r -h 12 -w 840 -x 1864 -bg black -fn '-*-terminus-*-*-*-*-*-*-*-*-*-*-*'"

---------------------------------------------------------------------
-- DZEN looks --
myDzenPP handle = defaultPP
myDzenPP handle = defaultPP
        { ppCurrent       = wrap ("^fg(" ++ myFocusedFGColor ++ ")^bg(" ++ myFocusedBGColor ++ ")^p(2)^i(" ++ xmonadDir ++ "/dzen_bitmaps/has_win.xbm)") "^p(4)^fg()$
        , ppUrgent        = wrap ("^fg(" ++ myUrgentFGColor ++ ")^bg(" ++ myUrgentBGColor ++ ")^p(4)") "^p(4)^fg()^bg()"
        , ppVisible       = wrap ("^fg(" ++ myNormalFGColor ++ ")^bg(" ++ myNormalBGColor ++ ")^p(4)") "^p(4)^fg()^bg()"
        , ppHiddenNoWindows = wrap ("^fg(" ++ myNormalFGColor ++ ")")"^fg()"
        , ppHidden        = wrap ("^fg(" ++ myNormalFGColor ++ ")^bg(" ++ myVisibleBGColor ++ ")^p(4)") "^p(4)^fg()^bg()"
        , ppSep           = ""
        , ppTitle         = dzenColor myNormalFGColor "" . wrap "< " " >"
        , ppOutput        = hPutStrLn handle
        , ppLayout        = dzenColor myFocusedFGColor "" .
                            (\x -> case x of
                                "Tall" -> "^p(4)^i(" ++ xmonadDir ++ "/dzen_bitmaps/tall.xbm)^p(4)"
                                "Mirror Tall" -> "^p(4)^i(" ++ xmonadDir ++ "/dzen_bitmaps/mtall.xbm)^p(4)"
                                "Full" -> "^p(4)^i(" ++ xmonadDir ++ "/dzen_bitmaps/full.xbm)^p(4)"
                            )
}

I addition to this you'll have to configure your ~/.conkyrc file, but this is done very easily.


Btw, to configure the position of the dzen bar and what's displayed in dzen, read the dzen2 man.

Last edited by sablabra (2008-12-09 19:11:57)

Offline

#6 2008-12-13 16:27:39

buttons
Member
From: NJ, USA
Registered: 2007-08-04
Posts: 620

Re: Getting xmonad, dzen and conky to go hand in hand...

Yes, you can overlap them.  If you want to make one on the bottom of the stack, dzen has the option onstart=lower.

Using this, instead of meticulously figuring out exactly where one starts and the other ends, just build your dzens up from the bottom.

Mine kinda goes like this:
dzen bar first 2/3rds of screen, piped from centered conky, bottom stack
dzen bar across the whole top of the screen, displays the datetime on the right side, bottom stack
dzen bar on the left for xmonad, top stack.  This one has a specified width.

....and when I was writing this I found out I had a bar at the bottom of the stack I've never actually seen on this computer before, from a previous config :S

Last edited by buttons (2008-12-13 16:29:17)


Cthulhu For President!

Offline

Board footer

Powered by FluxBB