You are not logged in.

#1 2008-09-23 17:12:35

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

[SOLVED]simple dzen2 with workspace information (Xmonad)

I've given up on trying to figure out how dzen2 works. I just can't get it.
Nor how it could be incorporated into Xmonad (I don't know haskell yet, but I swear I will get around to it soon wink )

All I want is a simple workspace list with some indication of the active one and possibly the (non)existence of open windows on them.
I'll post my xmonad.hs here. Please, do give a helping hand smile

Also, can dzen2 be made with a completely transparent background (like conky) ?

This is my xmonad.hs :

import XMonad
--import XMonad hiding (Tall)
import XMonad.Actions.CycleWS
import XMonad.Actions.CopyWindow
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageDocks
import XMonad.ManageHook
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.UrgencyHook
import XMonad.Hooks.ManageHelpers
import XMonad.Layout.PerWorkspace
--import XMonad.Layout.HintedTile
import XMonad.Layout.Gaps
import XMonad.Layout.LayoutHints
import XMonad.Util.EZConfig
import XMonad.Util.Run
import XMonad.Prompt
import XMonad.Prompt.Shell
import System.Exit
import System.IO

import qualified XMonad.StackSet as W 
import qualified Data.Map        as M
import qualified XMonad.Actions.FlexibleResize as Flex

 
-- The preferred terminal program, which is used in a binding below and by
-- certain contrib modules.
--
myTerminal      = "urxvt"
 
-- modMask lets you specify which modkey you want to use. The default
-- is mod1Mask ("left alt").  You may also consider using mod3Mask
-- ("right alt"), which does not conflict with emacs keybindings. The
-- "windows key" is usually mod4Mask.
--
myModMask       = mod4Mask
 
-- The mask for the numlock key. Numlock status is "masked" from the
-- current modifier status, so the keybindings will work with numlock on or
-- off. You may need to change this on some systems.
--
-- You can find the numlock modifier by running "xmodmap" and looking for a
-- modifier with Num_Lock bound to it:
--
-- > $ xmodmap | grep Num
-- > mod2        Num_Lock (0x4d)
--
-- Set numlockMask = 0 if you don't have a numlock key, or want to treat
-- numlock status separately.
--
myNumlockMask   = mod2Mask
 
-- The default number of workspaces (virtual screens) and their names.
-- By default we use numeric strings, but any string may be used as a
-- workspace name. The number of workspaces is determined by the length
-- of this list.
--
-- A tagging example:
--
-- > workspaces = ["web", "irc", "code" ] ++ map show [4..9]
--
myWorkspaces    = ["Alpha", "Beta", "Gamma", "Delta", "Epsilon", "Zeta"]
 
-- Width of the window border in pixels.
--
myBorderWidth   = 1
 
-- Border colors for unfocused and focused windows, respectively.
--
myNormalBorderColor  = "#333333"
myFocusedBorderColor = "#ffffff"
 
-- Default offset of drawable screen boundaries from each physical
-- screen. Anything non-zero here will leave a gap of that many pixels
-- on the given edge, on the that screen. A useful gap at top of screen
-- for a menu bar (e.g. 15)
--
-- An example, to set a top gap on monitor 1, and a gap on the bottom of
-- monitor 2, you'd use a list of geometries like so:
--
-- > defaultGaps = [(18,0,0,0),(0,18,0,0)] -- 2 gaps on 2 monitors
--
-- Fields are: top, bottom, left, right.
--
myDefaultGaps   = [(30,1,1,1)]

------------------------------------------------------------------------
-- Layouts:
 
-- You can specify and transform your layouts by modifying these values.
-- If you change layout bindings be sure to use 'mod-shift-space' after
-- restarting (with 'mod-q') to reset your layout state to the new
-- defaults, as xmonad preserves your old layout settings by default.
--
-- The available layouts.  Note that each layout is separated by |||,
-- which denotes layout choice.
--
myLayout = tiled ||| Mirror tiled ||| Full
  where
     -- default tiling algorithm partitions the screen into two panes
     tiled   = Tall nmaster delta ratio
 
     -- The default number of windows in the master pane
     nmaster = 1
 
     -- Default proportion of screen occupied by master pane
     ratio   = 1/2
 
     -- Percent of screen to increment by when resizing panes
     delta   = 3/100
 
------------------------------------------------------------------------
-- Window rules:
 
-- Execute arbitrary actions and WindowSet manipulations when managing
-- a new window. You can use this to, for example, always float a
-- particular program, or have a client always appear on a particular
-- workspace.
--
-- To find the property name associated with a program, use
-- > xprop | grep WM_CLASS
-- and click on the client you're interested in.
--
-- To match on the WM_NAME, you can use 'title' in the same way that
-- 'className' and 'resource' are used below.
--
myManageHook = manageDocks <+> manageHook defaultConfig <+> composeOne [
      transience
    , resource  =? "MPlayer"             -?> doFloat
    , resource  =? "Gimp"                -?> doFloat
    , resource  =? "gnome-alsamixer"      -?> doFloat
    , resource  =? "desktop_window"      -?> doIgnore
 ]
 
-- Whether focus follows the mouse pointer.
myFocusFollowsMouse :: Bool
myFocusFollowsMouse = True
 
 
------------------------------------------------------------------------
-- Status bars and logging
 
-- Perform an arbitrary action on each internal state change or X event.
-- See the 'DynamicLog' extension for examples.
--
-- To emulate dwm's status bar
--
-- > logHook = dynamicLogDzen
--
-- myLogHook = ewmhDesktopsLogHook

myLogHook = dynamicLogDzen

 
------------------------------------------------------------------------
-- Startup hook
 
-- Perform an arbitrary action each time xmonad starts or is restarted
-- with mod-q.  Used by, e.g., XMonad.Layout.PerWorkspace to initialize
-- per-workspace layout choices.
--
-- By default, do nothing.
myStartupHook = return ()
 
 
 ------------------------------------------------------------------------
-- Key bindings. Add, modify or remove key bindings here.
--
myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
 
    -- launch a terminal
    [ ((modMask .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
 
    -- close focused window 
    , ((modMask .|. shiftMask, xK_c     ), kill)
    , ((mod1Mask, xK_F4), kill)
 
     -- Rotate through the available layout algorithms
    , ((modMask,               xK_space ), sendMessage NextLayout)
 
    --  Reset the layouts on the current workspace to default
    , ((modMask .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
 
    -- Resize viewed windows to the correct size
    , ((modMask,               xK_n     ), refresh)
 
    -- Move focus to the next window
    , ((modMask,               xK_Tab   ), windows W.focusDown)
 
    -- Move focus to the next window
    , ((modMask,               xK_j     ), windows W.focusDown)
 
    -- Move focus to the previous window
    , ((modMask,               xK_k     ), windows W.focusUp  )
 
    -- Move focus to the master window
    , ((modMask,               xK_m     ), windows W.focusMaster  )
 
    -- Swap the focused window and the master window
    , ((modMask,               xK_Return), windows W.swapMaster)
 
    -- Swap the focused window with the next window
    , ((modMask .|. shiftMask, xK_j     ), windows W.swapDown  )
 
    -- Swap the focused window with the previous window
    , ((modMask .|. shiftMask, xK_k     ), windows W.swapUp    )
 
    -- Shrink the master area
    , ((modMask,               xK_h     ), sendMessage Shrink)
 
    -- Expand the master area
    , ((modMask,               xK_l     ), sendMessage Expand)
 
    -- Push window back into tiling
    , ((modMask,               xK_t     ), withFocused $ windows . W.sink)
 
    -- Increment the number of windows in the master area
    , ((modMask              , xK_comma ), sendMessage (IncMasterN 1))
 
    -- Deincrement the number of windows in the master area
    , ((modMask              , xK_period), sendMessage (IncMasterN (-1)))
 
    -- Quit xmonad
    , ((modMask .|. shiftMask, xK_q     ), io (exitWith ExitSuccess))
 
    -- Restart xmonad
    , ((modMask              , xK_q     ), restart "xmonad" True)
    ]
    ++
 
    --
    -- mod-[1..9], Switch to workspace N
    -- mod-shift-[1..9], Move client to workspace N
    --
    [((m .|. modMask, k), windows $ f i)
        | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
        , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
    ++
 
    --
    -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
    -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
    --
    [((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f))
        | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
        , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
 
 
------------------------------------------------------------------------
-- Mouse bindings: default actions bound to mouse events
--
myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
 
    -- mod-button1, Set the window to floating mode and move by dragging
    [ ((modMask, button1), (\w -> focus w >> mouseMoveWindow w))
 
    -- mod-button2, Raise the window to the top of the stack
    , ((modMask, button2), (\w -> focus w >> windows W.swapMaster))
 
    -- mod-button3, Set the window to floating mode and resize by dragging
    , ((modMask, button3), (\w -> focus w >> mouseResizeWindow w))
 
    -- you may also bind events to the mouse scroll wheel (button4 and button5)
    ]
 
------------------------------------------------------------------------
-- Now run xmonad with all the defaults we set up.
 
-- Run xmonad with the settings you specify. No need to modify this.
--
main = xmonad defaults
 
-- A structure containing your configuration settings, overriding
-- fields in the default config. Any you don't override, will 
-- use the defaults defined in xmonad/XMonad/Config.hs
-- 
-- No need to modify this.
--
defaults = defaultConfig {
      -- simple stuff
        terminal           = myTerminal,
        focusFollowsMouse  = myFocusFollowsMouse,
        borderWidth        = myBorderWidth,
        modMask            = myModMask,
        numlockMask        = myNumlockMask,
        workspaces         = myWorkspaces,
        normalBorderColor  = myNormalBorderColor,
        focusedBorderColor = myFocusedBorderColor,
     -- defaultGaps        = myDefaultGaps,
 
      -- key bindings
        keys               = myKeys,
        mouseBindings      = myMouseBindings,
 
      -- hooks, layouts
        layoutHook         = gaps [(U,28), (D,1), (L,1), (R,1)] $ ewmhDesktopsLayout $ avoidStruts $ layoutHook defaultConfig,
        manageHook         = myManageHook,
        logHook            = myLogHook,
        startupHook        = myStartupHook
    }

Last edited by moljac024 (2008-09-28 10:59:42)


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#2 2008-09-23 19:11:59

vogt
Member
From: Toronto, Canada
Registered: 2006-11-25
Posts: 389

Re: [SOLVED]simple dzen2 with workspace information (Xmonad)

you could check some other sample configs, but here's one that should work:

import XMonad
import XMonad.Hooks.DynamicLog (dzen)

main = dzen xmonad

To be able to customize, you'd have to bypass that wrapper function. How to do that is here: http://xmonad.org/xmonad-docs/xmonad-co … icLog.html

The docs all provide concrete examples, so you don't necessarily have to know what is going on, though that helps.

Offline

#3 2008-09-25 19:09:21

Ashren
Member
From: Denmark
Registered: 2007-06-13
Posts: 1,229
Website

Re: [SOLVED]simple dzen2 with workspace information (Xmonad)

Moljac, you can't as far as I know have a completely transparent background with dzen2, since you have to use transset to acheive transparency, which means that the text will become completely transparent as well.

Experiment with transset+xdotool. L
ike this:

echo "Arch is the best" | dzen2 -fg "black" -bg "lightblue" -w 230 -p -e & transset .3 & sleep 1 ; xdotool mousemove 5 5 ; xdotool click 1

Ups, example did not work. Corrected.

Last edited by Ashren (2008-09-25 19:33:34)

Offline

#4 2008-09-25 19:49:31

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: [SOLVED]simple dzen2 with workspace information (Xmonad)

Thanks for the responses guys.
I thought dzen2 couldn't be transparent so I've given up on that.
And DynamicLog wouldn't work for me, since that lists more stuff than I want. I just want a workspace list with a differently colored active one. And perhaps an indication of some existing windows on others. So, should I use DynamicLogPP for customizing what gets piped to dzen2 ?

The documentation on the official Xmonad site is kind of confusing to me.


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#5 2008-09-25 20:20:04

Ashren
Member
From: Denmark
Registered: 2007-06-13
Posts: 1,229
Website

Re: [SOLVED]simple dzen2 with workspace information (Xmonad)

moljac024 wrote:

Thanks for the responses guys.
So, should I use DynamicLogPP for customizing what gets piped to dzen2 ?

Yep. PP is for Pretty Printing.

For example ppCurrent is the current workspace you're in. You can define what dzenColor you'd like to have here. Background first, foreground afterwards. Finish it of with some spacing (pad). I.e:

ppCurrent = dzenColor "black" "white" . pad

You can read about the different pp's here: http://hackage.haskell.org/packages/arc … tml#t%3APP

A typical PP config could look like this:

myLogHook h = dynamicLogWithPP $ defaultPP {
              ppCurrent  = dzenColor "#222222" "white" . pad
            , ppVisible  = dzenColor "white" "black" . pad
            , ppHidden   = dzenColor "lightblue" "#222222" . pad 
            , ppHiddenNoWindows = dzenColor "#777777"  "#222222" . pad
            , ppUrgent   = dzenColor "red" "yellow"
            , ppWsSep    = " | "
            , ppSep      = " | "
            , ppLayout   = dzenColor "lightblue" "#222222" .
                           (\ x -> fill (case x of
                                           "Tall"               -> icon "tall.xbm"
                                           "Mirror Tall"        -> icon "mtall.xbm"
                                           "Full"               -> icon "full.xbm"
                                           _                    -> pad x) 4)
            , ppTitle    = ("^fg(white) " ++) . dzenEscape  
            , ppOutput   = hPutStrLn h
            }
    where
      icon h = "^i(/home/edgar/dzen_bitmaps/" ++ h ++ ")"
      fill :: String -> Int -> String
      fill h i = "^p(" ++ show i ++ ")" ++ h ++ "^p(" ++ show i ++ ")"

You can insert dzen2 codes directly in to ppWsSep and ppSep to draw your own separators. After where you can define your own dzen2 decorations as well:

where
...
square h = "^r(4x4)"

Have fun.

Offline

#6 2008-09-26 16:10:47

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: [SOLVED]simple dzen2 with workspace information (Xmonad)

Ok, I've tried that and this is how the relevant parts of my xmonad.hs look now but no dzen starts with Xmonad.

myLogHook = dynamicLogWithPP $ defaultPP {
              ppCurrent  = dzenColor "#222222" "white" . pad
            , ppVisible  = dzenColor "white" "black" . pad
            , ppHidden   = dzenColor "lightblue" "#222222" . pad 
            , ppHiddenNoWindows = dzenColor "#777777"  "#222222" . pad
            , ppUrgent   = dzenColor "red" "yellow"
            }
main = dzen $ \conf -> xmonad defaults

 
-- A structure containing your configuration settings, overriding
-- fields in the default config. Any you don't override, will 
-- use the defaults defined in xmonad/XMonad/Config.hs
-- 
-- No need to modify this.
--
defaults = defaultConfig {
      -- simple stuff
        terminal           = myTerminal,
        focusFollowsMouse  = myFocusFollowsMouse,
        borderWidth        = myBorderWidth,
        modMask            = myModMask,
        numlockMask        = myNumlockMask,
        workspaces         = myWorkspaces,
        normalBorderColor  = myNormalBorderColor,
        focusedBorderColor = myFocusedBorderColor,
     -- defaultGaps        = myDefaultGaps,
 
      -- key bindings
        keys               = myKeys,
        mouseBindings      = myMouseBindings,
 
      -- hooks, layouts
        layoutHook         = gaps [(U,30), (D,1), (L,1), (R,1)] $ avoidStruts $ layoutHook defaultConfig,
        manageHook         = myManageHook,
        logHook            = myLogHook,
        startupHook        = myStartupHook
    }

What am I doing wrong ?
I told you I'd need a hand with this smile


EDIT: This is how the top of my desktop looks like right now:

26092008184338te0.png

And this is more or less how I would like it to look with the workspaces dzen (right now it's just conky displaying text only):

26092008184318tp2.png

Last edited by moljac024 (2008-09-26 16:57:01)


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#7 2008-09-26 17:46:07

Ashren
Member
From: Denmark
Registered: 2007-06-13
Posts: 1,229
Website

Re: [SOLVED]simple dzen2 with workspace information (Xmonad)

Try replacing:

workspaces         = myWorkspaces,

with

workspaces         = [ "Alpha","Beta","Gamma","Delta","Epsilon","Zeta" ],

Offline

#8 2008-09-26 18:36:33

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: [SOLVED]simple dzen2 with workspace information (Xmonad)

Hi Ashren, I've tried that but there really is no difference because myWorkspaces is defined before with the exact value.
You can see that in my first post where I've put my entire xmonad.hs

This is all I get (but sometimes it just disappears) :

26092008203623fv9.png


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#9 2008-09-27 02:12:26

vogt
Member
From: Toronto, Canada
Registered: 2006-11-25
Posts: 389

Re: [SOLVED]simple dzen2 with workspace information (Xmonad)

I think that when you specify the defaultPP, you are overriding the defaultPP {ppOutput = hPutStrLn h} that the dzen function adds.

One naive solution is to explicitly pass the handle that is the dzen's input through to the pp definition (here it is called h):

import XMonad

import XMonad.Hooks.DynamicLog  (dynamicLogWithPP, defaultPP, PP(..))
import XMonad.Hooks.ManageDocks (manageDocks,avoidStruts)
import XMonad.Util.Run          (spawnPipe,hPutStrLn)

dzenCmd = "dzen2 " ++ flags
 where
    fg      = "'#a8a3f7'" -- n.b quoting
    bg      = "'#3f3c6d'"
    flags   = "-e 'onstart=lower' -w 400 -ta l -fg " ++ fg ++ " -bg " ++ bg

main = spawnPipe dzenCmd >>= xmonad . myConf

myConf h = defaultConfig
            { logHook = dynamicLogWithPP $ defaultPP
                    { ppOutput = hPutStrLn h
                    , ppLayout = const ""
                    , ppTitle  = const ""
                    }
            , manageHook = manageDocks
            , layoutHook = avoidStruts myLayout -- this isn't defined here?
            }

Note that if you lift the pp data definition out of the myConf, then you need to pass that h through myConf, to the function defining the pp.

Last edited by vogt (2008-09-27 02:18:00)

Offline

#10 2008-09-27 08:28:30

Ashren
Member
From: Denmark
Registered: 2007-06-13
Posts: 1,229
Website

Re: [SOLVED]simple dzen2 with workspace information (Xmonad)

This is what I have in imports:

import XMonad
import System.Exit
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run (spawnPipe,hPutStrLn)
import XMonad.Util.Loggers

import qualified XMonad.StackSet as W
import qualified Data.Map        as M

Mylayout:

myLayout = avoidStruts (tall ||| Mirror tall ||| Full)
  where
     tall   = Tall nmaster delta ratio
     nmaster = 1
     ratio   = 1/2
     delta   = 2/100

My PP settings + layout icons and dzenstatusbar:

myLogHook h = dynamicLogWithPP $ defaultPP {
              ppCurrent  = dzenColor "#222222" "white" . pad
            , ppHidden   = dzenColor "lightblue" "#222222" . pad
            , ppHiddenNoWindows = dzenColor "#777777"  "#222222" . pad
            , ppWsSep    = "^r(2x17)"
            , ppSep      = "^fg(white)^r(2x17)"
            , ppLayout   = dzenColor "lightblue" "#222222" .
                           (\ x -> fill (case x of
                                           "Tall"               -> icon "tall.xbm"
                                           "Mirror Tall"     -> icon "mtall.xbm"
                                           "Full"               -> icon "full.xbm"
                                           _                     -> pad x) 4)
            , ppTitle    = ("^fg(orange)" ++) . dzenEscape
            , ppOutput   = hPutStrLn h
            }
    where
      icon h = "^i(/home/edgar/dzen_bitmaps/" ++ h ++ ")" -- enter your icons dir. Find them here:http://dzen.geekmode.org/dwiki/doku.php?id=dzen:icon-packs
      fill :: String -> Int -> String
      fill h i = "^p(" ++ show i ++ ")" ++ h ++ "^p(" ++ show i ++ ")"


myStatusBar = "dzen2 -fn '-*-dina-*-r-*-*-14-*-*-*-*-*-*-*' -bg '#222222' -fg '#777777' -h 16 -ta l -sa c -w 1280 -e ''"

And this is what I have in defaultconfig:

main = do din <- spawnPipe myStatusBar
      spawnPipe secondDzenCommand

          xmonad $ defaultConfig {

                       terminal           = "urxvtc",
                       focusFollowsMouse  = True,
                       borderWidth        = 1,
                       modMask            = mod1Mask,
                       numlockMask        = mod2Mask,
                       workspaces         = ["main","web","dev","fun","music"],
                       normalBorderColor  = "#000000",
                       focusedBorderColor = "white",

                       -- key bindings
                       keys               = myKeys,
                       mouseBindings      = myMouseBindings,

                       -- hooks, layouts
                       layoutHook         = myLayout,
                       manageHook      = myManageHook,
                       logHook              = myLogHook din
                     }

If it still does not work post your entire xmonad.hs.

PS. Vogt, thanks for pointing out another way to create the dzen bar. Experimentation ensues.

Offline

#11 2008-09-27 11:54:26

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: [SOLVED]simple dzen2 with workspace information (Xmonad)

*sigh* It doesn't work.
I keep getting this error:

xmonad.hs:217:10:
    The last statement in a 'do' construct must be an expression

Also there seem to be errors in my logHook, since I get this when not trying to launch dzen to see if all else is correct:

xmonad.hs:238:29:
    Couldn't match expected type `X ()'
           against inferred type `t -> X ()'
    In the `logHook' field of a record

Here is my xmonad.hs

Imports:

import XMonad
--import XMonad hiding (Tall)
import XMonad.Actions.CycleWS
import XMonad.Actions.CopyWindow
import XMonad.ManageHook
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.UrgencyHook
import XMonad.Hooks.ManageHelpers
--import XMonad.Hooks.EwmhDesktops
--import XMonad.Layout.HintedTile
import XMonad.Layout.PerWorkspace
import XMonad.Layout.Gaps
import XMonad.Layout.LayoutHints
import XMonad.Layout.NoBorders
import XMonad.Util.EZConfig
--import XMonad.Util.Run
import XMonad.Util.Run (spawnPipe,hPutStrLn)
import XMonad.Util.Loggers
import XMonad.Prompt
import XMonad.Prompt.Shell
import System.Exit
import System.IO

import qualified XMonad.StackSet as W 
import qualified Data.Map        as M
import qualified XMonad.Actions.FlexibleResize as Flex

Layout:

myLayout = gaps [(U,30), (D,1), (L,1), (R,1)] $ avoidStruts (tiled ||| Mirror tiled ||| Full)
  where
     -- default tiling algorithm partitions the screen into two panes
     tiled   = Tall nmaster delta ratio
 
     -- The default number of windows in the master pane
     nmaster = 1
 
     -- Default proportion of screen occupied by master pane
     ratio   = 1/2
 
     -- Percent of screen to increment by when resizing panes
     delta   = 5/100

myLogHook:

myLogHook h = dynamicLogWithPP $ defaultPP {
              ppCurrent  = dzenColor "#ffffff" "#000000" . pad
            , ppVisible  = dzenColor "#888888" "#000000" . pad
            , ppHidden   = dzenColor "#888888" "#000000" . pad 
            , ppHiddenNoWindows = dzenColor "#888888"  "#000000" . pad
            , ppUrgent   = dzenColor "#ff0000" "#000000"
            }
            where
      fill :: String -> Int -> String
      fill h i = "^p(" ++ show i ++ ")" ++ h ++ "^p(" ++ show i ++ ")"

myStatusBar = "dzen2 -p -fn '-*-bitstream vera sans mono-medium-r-normal-*-17-*-*-*-*-*-*-*' -x 736 -y 1 -w 272 -h 27 -bg '#000000'"

Main:

main = do din <- spawnPipe myStatusBar
        xmonad $ defaultConfig {

     -- simple stuff
        terminal           = myTerminal,
        focusFollowsMouse  = myFocusFollowsMouse,
        borderWidth        = myBorderWidth,
        modMask            = myModMask,
        numlockMask        = myNumlockMask,
        workspaces         = myWorkspaces,
        normalBorderColor  = myNormalBorderColor,
        focusedBorderColor = myFocusedBorderColor,
     -- defaultGaps        = myDefaultGaps,
 
     -- key bindings
        keys               = myKeys,
        mouseBindings      = myMouseBindings,
 
      -- hooks, layouts
      --  layoutHook         = gaps [(U,30), (D,1), (L,1), (R,1)] $ avoidStruts $ layoutHook defaultConfig,
          layoutHook         = myLayout,
        manageHook         = myManageHook,
        logHook            = myLogHook,
        startupHook        = myStartupHook
      }

I really appreciate you guys spending your time to help me. Special thanks to Ashren. Bare with me for just a little while, we're getting closer wink

Last edited by moljac024 (2008-09-27 11:58:37)


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#12 2008-09-27 12:20:36

Ashren
Member
From: Denmark
Registered: 2007-06-13
Posts: 1,229
Website

Re: [SOLVED]simple dzen2 with workspace information (Xmonad)

You're welcome moljac.

I think you need to add "ppOutput = hPutStrLn h" to your defaultPP config. My dzen won't work without it.

Perhaps you could post your xmonad.hs as one paste?

xmonad.hs:217:10 refers to line 217 cursor position 10.

Offline

#13 2008-09-27 12:39:32

pseup
Member
Registered: 2008-06-06
Posts: 103

Re: [SOLVED]simple dzen2 with workspace information (Xmonad)

moljac024 wrote:

*sigh* It doesn't work.

Couple of changes I see that are needed:

main = do din <- spawnPipe myStatusBar
       xmonad $ defaultConfig {

Becomes:

main = do
       din <- spawnPipe myStatusBar
       xmonad $ defaultConfig {

(Or indent 'xmonad $ ...' to match 'din <- ...')
        logHook            = myLogHook,

Becomes:

        logHook            = myLogHook din

Maybe addition of

        , ppOutput = hPutStrLn h

to your defaultPP.

Last edited by pseup (2008-09-27 12:52:16)

Offline

#14 2008-09-27 13:05:55

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: [SOLVED]simple dzen2 with workspace information (Xmonad)

Ashren wrote:

I think you need to add "ppOutput = hPutStrLn h" to your defaultPP config. My dzen won't work without it.

pseup wrote:

Couple of changes I see that are needed:

main = do din <- spawnPipe myStatusBar
       xmonad $ defaultConfig {

Becomes:

main = do
       din <- spawnPipe myStatusBar
       xmonad $ defaultConfig {

(Or indent 'xmonad $ ...' to match 'din <- ...')
        logHook            = myLogHook,

Becomes:

        logHook            = myLogHook din

Thanks guys! That did it! dzen2 loads correctly. Now it's just a matter of customizing dzen2 and what gets piped to it. Thanks again! wink

While we're at it, I have a question (Ashren, I think you might know this one, as I get the impression you're the dzen2 expert here)
xfontsel won't show one of my .pcf fonts. It's actually smoothansi from the artwitz-fonts package. I would really like to use this font.
dzen2 should support .pcf fonts, right ? I think one of those does show up in xfontsel but I have no clue why the others don't.

Last edited by moljac024 (2008-09-27 13:14:05)


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#15 2008-09-27 13:17:13

pseup
Member
Registered: 2008-06-06
Posts: 103

Re: [SOLVED]simple dzen2 with workspace information (Xmonad)

I think you need to add a FontPath in your xorg.conf for them, /usr/share/fonts/artwiz-fonts or whatever the location is and restart X.

Last edited by pseup (2008-09-27 13:17:40)

Offline

#16 2008-09-27 13:41:45

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: [SOLVED]simple dzen2 with workspace information (Xmonad)

pseup wrote:

I think you need to add a FontPath in your xorg.conf for them, /usr/share/fonts/artwiz-fonts or whatever the location is and restart X.

Thanks, should have been able to figure that out myself smile

One last thing (I promise): There are too many spaces between the workspace names. They're spread out too thin. Is that the way Xmonad outputs or can they be brought closer together ?

Here's a shot:

27092008154608pl5.png


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#17 2008-09-27 15:18:11

Ashren
Member
From: Denmark
Registered: 2007-06-13
Posts: 1,229
Website

Re: [SOLVED]simple dzen2 with workspace information (Xmonad)

You can define the WS separator in your defaultPP:

, ppWsSep    = ""

You can write anything between the quotes - also dzen2 metacharacters. See if it does what your want.

Ps. I think gotmor is the resident dzen2 expert. wink

Last edited by Ashren (2008-09-27 15:28:38)

Offline

#18 2008-09-27 16:10:56

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: [SOLVED]simple dzen2 with workspace information (Xmonad)

Ashren wrote:

You can define the WS separator in your defaultPP:

, ppWsSep    = ""

You can write anything between the quotes - also dzen2 metacharacters. See if it does what your want.

Ps. I think gotmor is the resident dzen2 expert. wink

Aaaaand we're done here. Thank you very much gentlemen.
You can proudly say that you've played a big role in creating one of the best looking Xmonad desktops wink

Here's a shot here:

27092008180834bk3.th.png

Cheers and thanks once again!

Last edited by moljac024 (2008-09-27 16:11:54)


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#19 2008-09-27 16:32:53

Ashren
Member
From: Denmark
Registered: 2007-06-13
Posts: 1,229
Website

Re: [SOLVED]simple dzen2 with workspace information (Xmonad)

Congrats! Looks good.

Offline

#20 2008-10-12 21:02:50

tz3lm0th
Member
Registered: 2008-09-08
Posts: 4

Re: [SOLVED]simple dzen2 with workspace information (Xmonad)

Hi, I have a quick question. How do you setup your bar? Is everything contained in one dzen instance, or do you have multiple ones and then using positioning to align them? I've set up a basic xmonad.hs config that shows my workspaces, layout and title, but I'd like to add a clock, a network monitor and stuff like that. I do know how to make them, so that's not what I'm asking, I just wanted to know if there is some way to pipe my scripts into the existing dzen that xmonad.hs spawns? And "IF", is there a way to align everything after the "title" to the far right of my bar? Or do I have to create a different dzen instance for my other stuff? To summerize, is it possible to draw one dzen instance with multiple sources? Like, it draws the workspace, title etc from xmonad.hs and then the rest of my stuff from a script and puts it all into one single dzen instance?

Sorry, my english is not that good, but I hope someone understand my question. wink

Offline

#21 2008-10-12 21:08:29

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: [SOLVED]simple dzen2 with workspace information (Xmonad)

I'm not sure if that can be done but you could just make two instances and put them right next to each other. That would just look like one bar.
Did my screenshot give you the wrong idea ? Because those 1 pixel gaps between dzen2, conky and trayer are there because I want it that way.


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#22 2008-10-12 21:24:58

tz3lm0th
Member
Registered: 2008-09-08
Posts: 4

Re: [SOLVED]simple dzen2 with workspace information (Xmonad)

Thanks for the quick reply moljac!

I guess I'll just have to make two dzen bars then, the reason I asked was just to see if there was any way of merging it all together into one instance, so that when I press Mod-Q everything would get loaded. One more question, when I right click on my dzen bar it kills it, is there any way to disable that?

Offline

#23 2008-10-13 13:36:28

gotmor
Member
From: Germany
Registered: 2007-09-03
Posts: 84
Website

Re: [SOLVED]simple dzen2 with workspace information (Xmonad)

tz3lm0th wrote:

Thanks for the quick reply moljac!

I guess I'll just have to make two dzen bars then, the reason I asked was just to see if there was any way of merging it all together into one instance, so that when I press Mod-Q everything would get loaded.

Well, there is a way indeed - using a multiplexer.
Here you can find 2 implementations: http://dzen.geekmode.org/dwiki/doku.php … ultiplexer

One more question, when I right click on my dzen bar it kills it, is there any way to disable that?

Sure:   dzen2 -e ''    would disable ALL events-to-actions associations.

Also be sure to have a look in here for a reference of all commands and options.

Bye, Rob.

Offline

#24 2008-10-14 20:58:47

tz3lm0th
Member
Registered: 2008-09-08
Posts: 4

Re: [SOLVED]simple dzen2 with workspace information (Xmonad)

Thank you! Gonna check out the multiplexer thing. wink And thanks for the hint on dzen2,
I've never actually clicked on the "-e <event/action string>" link, (didn't realize it was
a link really tongue) but that explains a lot!

Offline

Board footer

Powered by FluxBB