You are not logged in.

#501 2011-10-11 14:48:59

nexus7
Member
From: brain dump
Registered: 2006-12-06
Posts: 285

Re: xmonad Hacking Thread

Thanks very much nnoell smile

I would like to do so, really -- if I only didn't crash my statusbar somehow tongue

It doesn't react and xmonad doesn't comile anymore:

Not in scope: data constructor `MyLogHook'

Why the hell...?

What are typical mistakes for this?
I g**gled for that kind of errors without any useful result...

xmonad.hs' code snippets:

...
import XMonad.Util.Run(spawnPipe) -- spawnPipe and hPutStrLn
import System.IO        -- hPutStrLn -- scope
...

main = do
        status <- spawnPipe myDzenStatus -- xmonad status on the left
        conky <- spawnPipe myDzenConky -- conky stats on the right   
        xmonad $ withUrgencyHook NoUrgencyHook $ defaultConfig
            { modMask = mod4Mask
            , terminal = "terminal"
            , borderWidth = 2
            , normalBorderColor = "#dddddd"
            , focusedBorderColor = "#0000ff"
            , workspaces = myWorkspaces
           , layoutHook = myLayoutHook
            , manageHook = manageDocks <+> myManageHook
                            <+> manageHook defaultConfig
            , logHook = MyLogHook status
        , keys = myKeys
   }

myWorkspaces :: [String] 
myWorkspaces = clickable $ (map dzenEscape) $ ["1","2","3","4","5","6","7","8","9","0"]

-- Statusbar
myLogHook h = dynamicLogWithPP $ myDzenPP { ppOutput = hPutStrLn h }        

myDzenStatus = "dzen2 -w '1000' -ta 'l'"  ++ myDzenStyle
myDzenConky = "-c ~/.xmonad/conkyrc | dzen2 -x '1000' -w '800' -ta 'r'"  ++ myDzenStyle
myDzenStyle = " -h '24' -fg '#777777' -bg '#222222' -fn 'UnDotum:bold:size=16'"


myDzenPP = dzenPP
    { ppCurrent = dzenColor "#3399ff" "" . wrap " " " "
    , ppHidden = dzenColor "#dddddd" "" . wrap " " " " 
    , ppHiddenNoWindows = dzenColor "#777777" "" . wrap " " " "
    , ppUrgent = dzenColor "#ff0000" "" . wrap " " " "
    , ppSep = " "
    , ppLayout = dzenColor "#aaaaaa" "" . wrap " " " "
    , ppTitle = dzenColor "#ffffff" ""
    } 

The main stuff is taken from thayer's config


To my original problem:
I also thought about checking the wrapFont-method shown here.

NB: I didn't know that's gotta get that complicated; maybe I'll open a new thread (better fitting to my 'noob hacking').


we are Arch.
you will be assimilated!
resistance is futile!

Offline

#502 2011-10-11 15:28:57

nnoell
Member
From: Spain
Registered: 2010-08-21
Posts: 99

Re: xmonad Hacking Thread

nexus7 wrote:

Thanks very much nnoell smile

I would like to do so, really -- if I only didn't crash my statusbar somehow tongue

It doesn't react and xmonad doesn't comile anymore:

Not in scope: data constructor `MyLogHook'

Why the hell...?

What are typical mistakes for this?
I g**gled for that kind of errors without any useful result...

Check "MylogHook" in the main function (with capital letter):

, logHook = MyLogHook status

It should look like:

, logHook = myLogHook status

Offline

#503 2011-10-11 16:07:02

nexus7
Member
From: brain dump
Registered: 2006-12-06
Posts: 285

Re: xmonad Hacking Thread

nnoell wrote:

It should look like:

, logHook = myLogHook status

Shocking!!!


Well, erm, created a fresh xmonad.hs with thayer's "template" in the meantime and tried your wsFont-way. -- Works well, until I wanted to make it clickable like this:

wsFont = "blah-20"

myWorkspaces = clickable . (map dzenEscape) $ [ "^fn(" ++ wsFont ++ ")1"
               , "^fn(" ++ wsFont ++ ")2"
               , "^fn(" ++ wsFont ++ ")3"
               , "^fn(" ++ wsFont ++ ")4"
               , "^fn(" ++ wsFont ++ ")5"
               , "^fn(" ++ wsFont ++ ")6"
               , "^fn(" ++ wsFont ++ ")7"
               , "^fn(" ++ wsFont ++ ")8"
               , "^fn(" ++ wsFont ++ ")9"
               , "^fn(" ++ wsFont ++ ")0"
               ]
          where clickable l     = [ "^ca(1,xdotool key super+" ++ show (n) ++ ")" ++ ws ++ "^ca()" |
                            (i,ws) <- zip [1..] l,
                            let n = i ]

-- then the ws-names show up like ^fn(blah-20)1 ^fn(blah-20)2 ^fn(blah-20)3 ...

edit: same with wsFont = "xft:blah:size=20" or wsFont = "xft:blah:pixelsize=20"

Last edited by nexus7 (2011-10-11 16:26:16)


we are Arch.
you will be assimilated!
resistance is futile!

Offline

#504 2011-10-11 16:24:25

nnoell
Member
From: Spain
Registered: 2010-08-21
Posts: 99

Re: xmonad Hacking Thread

nexus7 wrote:

...
-- then the ws-names show up like ^fn(blah-20)1 ^fn(blah-20)2 ^fn(blah-20)3 ...

Remove ". (map dzenEscape)" from myWorkspaces. Like so:

wsFont = "blah-20"

myWorkspaces = clickable $ 
               [ "^fn(" ++ wsFont ++ ")1"
               , "^fn(" ++ wsFont ++ ")2"
               , "^fn(" ++ wsFont ++ ")3"
               , "^fn(" ++ wsFont ++ ")4"
               , "^fn(" ++ wsFont ++ ")5"
               , "^fn(" ++ wsFont ++ ")6"
               , "^fn(" ++ wsFont ++ ")7"
               , "^fn(" ++ wsFont ++ ")8"
               , "^fn(" ++ wsFont ++ ")9"
               , "^fn(" ++ wsFont ++ ")0"
               ]
               where clickable l     = [ "^ca(1,xdotool key super+" ++ show (n) ++ ")" ++ ws ++ "^ca()" |
                      (i,ws) <- zip [1..] l,
                      let n = i ]

Offline

#505 2011-10-11 17:20:50

nexus7
Member
From: brain dump
Registered: 2006-12-06
Posts: 285

Re: xmonad Hacking Thread

Thanks, this works fine so far smile
((Why didn't I see the difference to your post?))


ntl I wanted to display the ws-names with the new font only -- neither the layout's indicating letter nor the title of the actual window (ppTitle?)...

And I'd like to show the names of the non-empty ws; and the tiling layout on the outer left as an icon.

Edit: I saw sth here about layout as icons, but how to move layout to the left (left from the ws-names, which are actual at the very left)?

Last edited by nexus7 (2011-10-11 18:32:18)


we are Arch.
you will be assimilated!
resistance is futile!

Offline

#506 2011-10-11 18:35:34

nnoell
Member
From: Spain
Registered: 2010-08-21
Posts: 99

Re: xmonad Hacking Thread

nexus7 wrote:

Thanks, this works fine so far smile

ntl I wanted to display the ws-names with the new font only -- neither the layout's indicating letter nor the title of the actual window (ppTitle?)...

And I'd like to show the names of the non-empty ws; and the tiling layout on the outer left as an icon.

Edit: I saw sth here about layout as icons, but how to move layout to the left (left from the ws-names, which are actual at the very left)?

So basically, assuming that I understood your request, what you want is something like this:

[layout icon] | [worspace 1] [workspace 2] ... [workspace n]

This can be achieved by using: ppOrder* (set which elements go first), ppTitle (set window title) and ppVisible (set visible but not focused workspaces). Here is the setup for your above dzenPP example:

myDzenPP = dzenPP
    { ppCurrent = dzenColor "#3399ff" "" . wrap " " " "
    , ppVisible = dzenColor "<colorForNonEmptyWS>" "" . wrap " " " "
    , ppHidden = dzenColor "#dddddd" "" . wrap " " " " 
    , ppHiddenNoWindows = dzenColor "#777777" "" . wrap " " " "
    , ppUrgent = dzenColor "#ff0000" "" . wrap " " " "
    , ppSep = " "
    , ppLayout = dzenColor "#aaaaaa" "" . wrap " " " "
    , ppTitle = \x -> ""
    , ppOrder = reverse
    }

BTW, if you want to display the status bar on the topright or bottomright side of your screen, you may want to put -ta 'l' as dzen flag so that the status bar grows to the left.

Edit1: typo.
*Edit2: mistake fixed: changed ppSort to ppOrder.

Last edited by nnoell (2011-10-11 20:19:01)

Offline

#507 2011-10-11 19:19:10

nexus7
Member
From: brain dump
Registered: 2006-12-06
Posts: 285

Re: xmonad Hacking Thread

nnoell wrote:

So basically, assuming that I understood your request, what you want is something like this:

[layout icon] | [worspace 1] [workspace 2] ... [workspace n]

Yes, that's what I mean.

...but I got this error:

xmonad.hs:165:16:
    Couldn't match expected type `X ([WindowSpace] -> [WindowSpace])'
                with actual type `[a0] -> [a0]'
    In the `ppSort' field of a record
    In the expression:
      dzenPP
        {ppCurrent = dzenColor "#3399ff" "" . wrap " " " ",
         ppVisible = dzenColor "#ffff00" "" . wrap " " " ",
         ppHidden = dzenColor "#dddddd" "" . wrap " " " ",
         ppHiddenNoWindows = dzenColor "#777777" "" . wrap " " " ",
         ppUrgent = dzenColor "#ff0000" "" . wrap " " " ", ppSep = " ",
         ppLayout = dzenColor "#aaaaaa" "" . wrap " " " ",
         ppTitle = \ x -> "", ppSort = reverse}
    In an equation for `myDzenPP':
        myDzenPP
          = dzenPP
              {ppCurrent = dzenColor "#3399ff" "" . wrap " " " ",
               ppVisible = dzenColor "#ffff00" "" . wrap " " " ",
               ppHidden = dzenColor "#dddddd" "" . wrap " " " ",
               ppHiddenNoWindows = dzenColor "#777777" "" . wrap " " " ",
               ppUrgent = dzenColor "#ff0000" "" . wrap " " " ", ppSep = " ",
               ppLayout = dzenColor "#aaaaaa" "" . wrap " " " ",
               ppTitle = \ x -> "", ppSort = reverse}

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

So with ppSort probably one can't use clickable workspaces anymore... while displaying the actual/occupied ws's only this isn't of much sense anyhow.

...and found again your code with that configs of different bars. smile
But first things first.

My bars are supposed to show up at the top btw.

Last edited by nexus7 (2011-10-11 20:14:43)


we are Arch.
you will be assimilated!
resistance is futile!

Offline

#508 2011-10-11 20:06:47

nnoell
Member
From: Spain
Registered: 2010-08-21
Posts: 99

Re: xmonad Hacking Thread

Ups, sorry, it is ppOrder instead of ppSort:

myDzenPP = dzenPP
    { ppCurrent = dzenColor "#3399ff" "" . wrap " " " "
    , ppVisible = dzenColor "<colorForNonEmptyWS>" "" . wrap " " " "
    , ppHidden = dzenColor "#dddddd" "" . wrap " " " " 
    , ppHiddenNoWindows = dzenColor "#777777" "" . wrap " " " "
    , ppUrgent = dzenColor "#ff0000" "" . wrap " " " "
    , ppSep = " "
    , ppLayout = dzenColor "#aaaaaa" "" . wrap " " " "
    , ppTitle = \x -> ""
    , ppOrder = reverse
    }

Offline

#509 2011-10-11 20:31:14

nexus7
Member
From: brain dump
Registered: 2006-12-06
Posts: 285

Re: xmonad Hacking Thread

I see, welcome. smile

ws bar reversed.

Now, the empty ws' are still shown, how to get rid if them (if it is not an actual yet empty one)?
And the part of the bar right to the ws' where windows' title is shown (ugh, forgot it's name) has gone now.


we are Arch.
you will be assimilated!
resistance is futile!

Offline

#510 2011-10-11 20:40:55

nnoell
Member
From: Spain
Registered: 2010-08-21
Posts: 99

Re: xmonad Hacking Thread

nexus7 wrote:

Now, the empty ws' are still shown, how to get rid if them (if it is not an actual yet empty one)?

Remove ppHiddenNoWindows line:

myDzenPP = dzenPP
    { ppCurrent = dzenColor "#3399ff" "" . wrap " " " "
    , ppVisible = dzenColor "<colorForNonEmptyWS>" "" . wrap " " " "
    , ppHidden = dzenColor "#dddddd" "" . wrap " " " " 
    , ppUrgent = dzenColor "#ff0000" "" . wrap " " " "
    , ppSep = " "
    , ppLayout = dzenColor "#aaaaaa" "" . wrap " " " "
    , ppTitle = \x -> ""
    , ppOrder = reverse
    }

Offline

#511 2011-10-11 20:50:55

nexus7
Member
From: brain dump
Registered: 2006-12-06
Posts: 285

Re: xmonad Hacking Thread

OK, that was easy. smile


we are Arch.
you will be assimilated!
resistance is futile!

Offline

#512 2011-10-11 21:28:30

nexus7
Member
From: brain dump
Registered: 2006-12-06
Posts: 285

Re: xmonad Hacking Thread

Meanwhile trying to iconize tiling layout.

myIconPath = "/home/meeee/.icons/dzen2/"

-- colors --> http://pastebin.com/z9Ks2PFH
myLayoutFgColor = "#1994d1"
myLayoutBgColor = "#000000"

myDzenPP = dzenPP
    { ppCurrent = dzenColor "#3399ff" "" . wrap "" ""
    , ppVisible = dzenColor "#ffff00" "" . wrap "" ""
    , ppHidden = dzenColor "#dddddd" "" . wrap "" ""
    , ppUrgent = dzenColor "#ff0000" "" . wrap "" ""
    , ppSep = " "
    , ppLayout = dzenColor myLayoutFgColor"" .
        (\x -> case x of
            "ResizableTall" -> wrapBitmap  "tall.xbm"
            "Mirror ResizableTall" -> wrapBitmap "mtall.xbm"
            "Full" -> wrapBitmap "full.xbm"
        )
    , ppTitle = \x -> ""
    , ppOrder = reverse
  }
  where
    wrapFgBg fgColor bgColor content= wrap ("^fg(" ++ myLayoutFgColor ++ ")^bg(" ++ myLayoutBgColor ++ ")") "^fg()^bg()" content
    wrapFg color content = wrap ("^fg(" ++ color ++ ")") "^fg()" content
    wrapBg color content = wrap ("^bg(" ++ color ++ ")") "^bg()" content
    wrapBitmap bitmap = "^p(5)^i(" ++ myIconPath ++ bitmap ++ ")^p(5)"

Compiles without errors, but tiling layout and workspace names vanished. tongue

Last edited by nexus7 (2011-10-11 22:02:33)


we are Arch.
you will be assimilated!
resistance is futile!

Offline

#513 2011-10-12 08:55:13

nnoell
Member
From: Spain
Registered: 2010-08-21
Posts: 99

Re: xmonad Hacking Thread

nexus7 wrote:

Compiles without errors, but tiling layout and workspace names vanished. tongue

This happens probably because your layout names in layoutHook do not match with your ppLayout case conditions in dzenPP. Post your layoutHook please.

Edit: quoted alias fixed.

Last edited by nnoell (2011-10-12 15:25:08)

Offline

#514 2011-10-12 13:42:18

nexus7
Member
From: brain dump
Registered: 2006-12-06
Posts: 285

Re: xmonad Hacking Thread

1/2 off://  unbelievable -- I'd like to use some more layouts together with icons in your pastebin (since I haven't found eg a "circled.xbm" yet)...

Downloaded those subtle-icons, installed xz-utils, p7zip, j7z to get the archive extractetd all results into a single file called "icons"; file says it's a "tar", but tar seems not to work with it... tongue
-- OMG, it's just

$ tar xvf icons

¡ʎpoqʎuɐʇɐɥʇ||ǝʇʇ‚uopǝsɐǝ|d···ɟ

Last edited by nexus7 (2011-10-12 18:56:19)


we are Arch.
you will be assimilated!
resistance is futile!

Offline

#515 2011-10-12 20:50:49

nexus7
Member
From: brain dump
Registered: 2006-12-06
Posts: 285

Re: xmonad Hacking Thread

||
\==> nnoell: ... so where did you get your icons from, since the mentioned collection doesn't contain "circle", "grid" or "full"?

So, little improvements after some more testings and struggles -- the workspaces appear, but the layout icons still don't.

Here's the requested code:

...
-- colors
myLayoutFgColor = "#1994d1"
myLayoutBgColor = "#000000"

-- icons
myIconPath1 = "/home/meee/.icons/dzen2/"
myIconPath2 = "/home/meee/.icons/subtle/"

myDzenPP = dzenPP
    { ppCurrent = dzenColor "#3399ff" "" . wrap "" ""
    , ppVisible = dzenColor "#ffff00" "" . wrap "" ""
    , ppHidden = dzenColor "#dddddd" "" . wrap "" ""   
--    , ppHiddenNoWindows = dzenColor "#777777" "" . wrap "" ""
    , ppUrgent = dzenColor "#ff0000" "" . wrap "" ""   
    , ppSep = " "
-- normal als Buchstabe:    , ppLayout = dzenColor "#aaaaaa" "" . wrap "" ""
    , ppLayout = dzenColor myLayoutFgColor "" .
        (\x -> case x of
            "ResizableTall"        -> wrapBitmap "dzen_bitmaps/arch1.xbm"        -- should become "tall.xbm"
            "Mirror ResizableTall" -> wrapBitmap "dzen_bitmaps/arch2.xbm"        -- "mtall.xbm"  
            "Circle"               -> wrapBitmap "dzen_bitmaps/tile1.xbm"        -- "circle.xbm"
            "Grid"                 -> wrapBitmap "dzen_bitmaps/tile2.xbm"        -- "grid.xbm"
            "Full"                 -> wrapBitmap "dzen_bitmaps/tile3.xbm"        -- "full.xbm"
        )
    , ppTitle = (\x -> " " ++ wrapFg myLayoutFgColor x)  -- bak:     , ppTitle = \x -> ""
    , ppOrder = reverse
  }
  where
    wrapFgBg fgColor bgColor content= wrap ("^fg(" ++ myLayoutFgColor ++ ")^bg(" ++ myLayoutBgColor ++ ")") "^fg()^bg()" content
    wrapFg color content = wrap ("^fg(" ++ color ++ ")") "^fg()" content
    wrapBg color content = wrap ("^bg(" ++ color ++ ")") "^bg()" content
    wrapBitmap bitmap = "^p(5)^i(" ++ myIconPath2 ++ bitmap ++ ")^p(5)"

-- layouts
myLayoutHook = avoidStruts $ smartBorders (tiled ||| Mirror tiled ||| Circle ||| Grid ||| Full)
        where
                tiled   = ResizableTall nmaster delta ratio []
                nmaster = 1
                ratio   = 1/2
                delta   = 3/100
...

For now I don't care much about colors; if something is missing here please let me know. Well, my xmonad.hs looks that much cluttered atm! tongue

Questions:
(1) Though I adopted this from your very pastebin, I don't understand why myLayoutHook differs from ppLayout's x-cases.
(2) What does "^p(5)" mean, pixelsize?
Ah yes, one more thing:
(3) ppTitle shows up at the very left and covers the layout and ws sections. How to put that [layout][workspaces][ppTitle]... , while ppOrder is reversed?


I really appreciate your help smile

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

-- (3) probably  ppOrder must be different, like

ppOrder = \(ws:l:t:_) -> [l,ws,t]

Then it compiles without complaints, but still a gap, then the workspaces, and no ppTitle are shown...

-- and yet another test with:

      , ppOrder = \(ws:l:t:_) -> ["a"] ++ [l] ++ ["b"] ++ [ws] ++ ["c"] ++ [t] ++ ["d"]

looks like "a  b12467cd       " (with letters for workspaces) ((<--the very last edit ~15 hrs later; sorry, forgot to delete that)). That confirms layout and ppTitle are empty.


Gosh, did I see that many configs -- glad not to be a mayfly! tongue
...the weather wouldn't suit me either.

Last edited by nexus7 (2011-10-13 15:14:40)


we are Arch.
you will be assimilated!
resistance is futile!

Offline

#516 2011-10-12 23:33:10

nnoell
Member
From: Spain
Registered: 2010-08-21
Posts: 99

Re: xmonad Hacking Thread

Sorry for the delay, I was very busy today.

nexus7 wrote:

\==> nnoell: ... so where did you get your icons from, since the mentioned collection doesn't contain "circle", "grid" or "full"?

My icons are from subtle-icon pack, and circle, grid and full were created by me with gimp editor. It isn't that hard, just edit one of them and save it with another name. However, if you still want my icons, I can upload them.

nexus7 wrote:

(1) Though I adopted this from your very pastebin, I don't understand why myLayoutHook differs from ppLayout's x-cases.

If layout names differ from ppLayout's x-cases, the status bar for some reason will be vanished as said above. However, if it is all shown except layout name, the problem may be a wrong icon path. Have you checked if the icon path is correct? I tried your config and works fine. If the problem still persists, copy my DzenPP from my first xmonad.hs, without wrapBitmap:

myDzenPP h = defaultPP 
	{ ppOutput          = hPutStrLn h
	, ppSep             = ""
	, ppWsSep           = ""
	, ppCurrent         = wrap "^fg(#ffffff)^bg(#60a0c0)" "^fg()^bg()"
	, ppUrgent          = wrap "^fg(#ffffff)^bg(#aff73e)" "^fg()^bg()"
	, ppVisible         = wrap "^fg(#b8bcb8)^bg(#484848)" "^fg()^bg()"
	, ppHidden          = wrap "^fg(#b8bcb8)^bg(#484848)" "^fg()^bg()"
	, ppHiddenNoWindows = wrap "^fg(#484848)^bg(#000000)" "^fg()^bg()"
	, ppTitle           = wrap "^fg(#9d9d9d)^bg(#000000)" "^fg()^bg()" . wrap "" ""
	, ppLayout          = wrap "^fg(#60a0c0)^bg(#000000)" "^fg()^bg()" .
		(\x -> case x of
			"ResizableTall"        -> " ^i(/home/nnoell/.icons/xbm8x8/tall.xbm) "
			"Mirror ResizableTall" -> " ^i(/home/nnoell/.icons/xbm8x8/mtall.xbm) "
			"Circle"               -> " ^i(/home/nnoell/.icons/xbm8x8/circle.xbm) "
			"Grid"                 -> " ^i(/home/nnoell/.icons/xbm8x8/grid.xbm) "
			"Full"                 -> " ^i(/home/nnoell/.icons/xbm8x8/full2.xbm) "
		)
	}
nexus7 wrote:

(2) What does "^p(5)" mean, pixelsize?

From the dzen README: ^p(ARGUMENT) = position next input amount of PIXELs to the right or left of the current position a.k.a. relative positioning.

nexus7 wrote:

(3) ppTitle shows up at the very left and covers the layout and ws sections. How to put that [layout][workspaces][ppTitle]... , while ppOrder is reversed?

Edit ppOrder to look that way:

, ppOrder = \(ws:l:t:_) -> [l,ws,t]

Edit: typo.

Last edited by nnoell (2011-10-12 23:51:45)

Offline

#517 2011-10-13 00:03:32

nexus7
Member
From: brain dump
Registered: 2006-12-06
Posts: 285

Re: xmonad Hacking Thread

nnoell wrote:

Sorry for the delay, I was very busy today.

Welcome, thanks for sharing your spare time! smile

nnoell wrote:
nexus7 wrote:

\==> nnoell: ... so where did you get your icons from, since the mentioned collection doesn't contain "circle", "grid" or "full"?

My icons are from subtle-icon pack, and circle, grid and full are created by me with gimp editor. It isn't that hard, just edit one of them and save it with another name. However, if you still want my icons, I can upload them.

Yes please!

nnoell wrote:

If layout names differ from ppLayout's x-cases, the status bar for some reason will be vanished as said above. However, if it is all shown except layout name, the problem may be a wrong icon path. Have you checked if the icon path is correct? I tried your config and works fine. If the problem still persists, copy my DzenPP from my first xmonad.hs, without wrapBitmap:...

Cheers, I'll do that!

nnoell wrote:
nexus7 wrote:

(2) What does "^p(5)" mean, pixelsize?

From the dzen README: ^p(ARGUMENT) = position next input amount of PIXELs to the right or left of the current position a.k.a. relative positioning.

I see.

nnoell wrote:
nexus7 wrote:

(3) ppTitle shows up at the very left and covers the layout and ws sections. How to put that [layout][workspaces][ppTitle]... , while ppOrder is reversed?

Edit ppOrder to look that way:

, ppOrder = \(ws:l:t:_) -> [l,ws,t]

Hey, bingo! Anyhow, in my last edit you'll see what is still missing.

Nvm, time to go to sleep in good old Europe now, isn't it?


Edit: another typo.

Last edited by nexus7 (2011-10-13 00:07:16)


we are Arch.
you will be assimilated!
resistance is futile!

Offline

#518 2011-10-13 10:48:33

nexus7
Member
From: brain dump
Registered: 2006-12-06
Posts: 285

Re: xmonad Hacking Thread

Yeah, some more progress -- now, the layout indicator works with customizable colors, and so does ppTitle! smile

Did it without "wrapBitmap". It doesn't make sense however using new definfitions, while implementing them needs even more code! Well, didn't realise it here. tongue

Sorry again, also forgot to mention before, that meanwhile I had found out by myself, too,

, ppTitle = \x -> ""

switches off ppTitle, and already had changed it.


So, next step:
Since I use actually a symbol font for my workspaces, I need to "inject" a (dzen) font switcher before ppTitle. Now anything here is displayed as boxes. -- Somewhere I read s.th. like "myDzenOpts", maybe it's this.


we are Arch.
you will be assimilated!
resistance is futile!

Offline

#519 2011-10-13 11:51:00

nnoell
Member
From: Spain
Registered: 2010-08-21
Posts: 99

Re: xmonad Hacking Thread

nexus7 wrote:

So, next step:
Since I use actually a symbol font for my workspaces, I need to "inject" a (dzen) font switcher before ppTitle. Now anything here is displayed as boxes. -- Somewhere I read s.th. like "myDzenOpts", maybe it's this.

If you want to display ppTitle with a specific font, you just need to declare ppTitle as follows:

, ppTitle = \x -> "^fn(" ++ myTitleFont ++ ")" ++ x ++ ""

Edit: here is my xbm-icon pack.

Last edited by nnoell (2011-10-13 11:53:41)

Offline

#520 2011-10-13 20:04:05

nexus7
Member
From: brain dump
Registered: 2006-12-06
Posts: 285

Re: xmonad Hacking Thread

OK then, thanks for your icons nnoell, they work pretty well. smile

(I also had tried to convert png's from my wmfs to xbm with imagemagick before, what resulted into this inversion bug.)

Except few annoying little things, almost everything is up now.

(1) ppTitle: If there is a very long title (eg in a browser), it is cut abruptly. How to get this a bit more sophistically shortened with replacing the end with "..." ?

(2) dzen/conky: Since using icons, my eth0 upspeed constantly refuses to display. I checked the icon path and tested several icons, with the same result. Even worse, it won't display without icon anymore, say text only. -- The following date and time however are shown. Is this caused by xmonad recompiling? Probably not, but who knows...

Here is the code:

background no
out_to_x no
out_to_console yes
update_interval 3
total_run_times 0
use_spacer none

TEXT
^i(/home/meee/.icons/xdzen/cpu.xpm)^fg(\#888888)${cpu cpu0}%^fg()@^fg(\#aaaaaa)${freq_g 1}GHz^fg() \
^i(/home/meee/.icons/xdzen/memory.xbm)^fg(\#666666)${mem}^fg() \
^fg(\#a4bc51)^i(/home/meee/.icons/xdzen/arrow_down1.xbm)${downspeedf eth0}^fg() \
^fg(\#d94c3d)^i(/home/meee/.icons/xdzen/arrow_up1.xbm)${upspeedf eth0}^fg() \ 
^fg(\#ffffff)${time %y/%-m/%e (%a) %-l:%M %p }^fg()

----------------------------
(3) Well, I'm thinking about having a double lined bar on the top, with all ten workspaces splitted 2x5, the layout centered vertically, and (some) system info with icons at the top and aligned texts below then. What would be a good approach for that? According to the readme, dzen seems to work single lined 'only'. And finally, how to convince xmonad to accept maybe two bars on the top?


((those bloody typos...))

Last edited by nexus7 (2011-10-13 20:30:42)


we are Arch.
you will be assimilated!
resistance is futile!

Offline

#521 2011-10-13 20:47:01

nnoell
Member
From: Spain
Registered: 2010-08-21
Posts: 99

Re: xmonad Hacking Thread

nexus7 wrote:

(1) ppTitle: If there is a very long title (eg in a browser), it is cut abruptly. How to get this a bit more sophistically shorted with replacing the end with "..." ?

Here is an example of ppTitle with 85 characters max. Change the number so that it fits your dzen width.

, ppTitle = \x -> "^fn(" ++ myTitleFont ++ ")" ++ shorten 85 x ++ ""
nexus7 wrote:

(2) dzen/conky: Since using icons, my eth0 upspeed constantly refuses to display. I checked the icon path and tested several icons, with the same result. Even worse, it won't display without icon anymore, say text only. -- The following date and time however are shown. Is this caused by xmonad recompiling? Probably not, but who knows...

How do you pipe conky into dzen? you should try to make a bash script which reads conky variables and then echoes them with a dzen format. Something like:

echo "^i(<iconpath>) $upspeed"

There is a lot of examples on the net, specially on this forum.

nexus7 wrote:

(3) Well, I'm thinking about having a double lined bar on the top, with all ten workspaces splitted 2x5, the layout centered vertically, and (some) system info with icons at the top and aligned texts below then. What would be a good approach for that? According to the readme, dzen seems to work single lined 'only'. And finally, how to convince xmonad to accept maybe two bars on the top?

I think it is impossible to display a 2x5 workspaces with two dzen instances, or at less I don't know how to do it. You could try a double dzen, one below the other with a 1x10 workspaces setup.

Offline

#522 2011-10-13 21:38:21

nexus7
Member
From: brain dump
Registered: 2006-12-06
Posts: 285

Re: xmonad Hacking Thread

nnoell wrote:
nexus7 wrote:

(1) ppTitle: If there is a very long title (eg in a browser), it is cut abruptly. How to get this a bit more sophistically shorted with replacing the end with "..." ?

Here is an example of ppTitle with 85 characters max. Change the number so that it fits your dzen width.

, ppTitle = \x -> "^fn(" ++ myTitleFont ++ ")" ++ shorten 85 x ++ ""

Perfect. smile


nnoell wrote:
nexus7 wrote:

(2) dzen/conky: Since using icons, my eth0 upspeed constantly refuses to display. I checked the icon path and tested several icons, with the same result. Even worse, it won't display without icon anymore, say text only. -- The following date and time however are shown. Is this caused by xmonad recompiling? Probably not, but who knows...

How do you pipe conky into dzen? you should try to make a bash script which reads conky variables and then echoes them with a dzen format. Something like:

echo "^i(<iconpath>) $upspeed"

There is a lot of examples on the net, specially on this forum.

My pipe:

myDzenStatus = "dzen2 -w '900' -ta 'l'" ++ myDzenStyle
myDzenConky  = "LANG=ko_KR.utf8 conky -c ~/.xmonad/conkyrc | dzen2 -x '900' -w '900' -ta 'r'" ++ myDzenStyle
myDzenStyle  = " -h '24' -fg '#777777' -bg '#222222' -fn 'UnDotum-14'"

Edit: Forgot to mention, when enabling upstream (with or without icon), neither upstream nor downstream are shown, if downstream has got an icon. I really don't get it -- it did work before!
And funnily a loaded icon for the following "date" (eg clock.ibm) appears. -- <-- Edit: means, that this is not affected by the error.

nnoell wrote:
nexus7 wrote:

(3) Well, I'm thinking about having a double lined bar on the top, with all ten workspaces splitted 2x5, the layout centered vertically, and (some) system info with icons at the top and aligned texts below then. What would be a good approach for that? According to the readme, dzen seems to work single lined 'only'. And finally, how to convince xmonad to accept maybe two bars on the top?

I think it is impossible to display a 2x5 workspaces with two dzen instances, or at less I don't know how to do it. You could try a double dzen, one below the other with a 1x10 workspaces setup.

...yah, hm, I saw some double/multiple dzen instance and dzen/xmobar-combo configs for top- and bottom bars. Let's see. -- On the other side, I just survived a little bit more "serious xmonad-dzen setup struggle" after a year or so with a simpler xmobar one, so I'd better set my sights lower for now and get more familiar to its usage.

Last edited by nexus7 (2011-10-16 20:26:45)


we are Arch.
you will be assimilated!
resistance is futile!

Offline

#523 2011-10-16 21:01:57

nexus7
Member
From: brain dump
Registered: 2006-12-06
Posts: 285

Re: xmonad Hacking Thread

Now almost everything is fine, just some details left.

I've got access to 10 workspaces:

myWorkspaces = [ "^fn(" ++ wsFont ++ ")0"
               , "^fn(" ++ wsFont ++ ")1"
               , "^fn(" ++ wsFont ++ ")2"
               , "^fn(" ++ wsFont ++ ")3"
               , "^fn(" ++ wsFont ++ ")4"
               , "^fn(" ++ wsFont ++ ")5"
               , "^fn(" ++ wsFont ++ ")6"
               , "^fn(" ++ wsFont ++ ")7"
               , "^fn(" ++ wsFont ++ ")8"
               , "^fn(" ++ wsFont ++ ")9"
               ]

But something is missing; I already got that in a old config that is lost...
How to put ws "0" after ws "9", so that I also could switch to ws N with M-<N> (and not M-<N+1>)?


Ugh, just recognised, that there's yet no M-0.
---
Wait, found something from an old config:

myKeys =  [((m .|. modMask, k), windows $ f i) | (i, k) <- zip (XMonad.workspaces conf) [xK_0 .. xK_9]
         , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
          ++
          [((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f)) | (key, sc) <- zip [xK_w, xK_e] [0..]
          , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
          ++
-- rest of my actual keys -->
          [ ("M-b"        , sendMessage ToggleStruts              ) -- toggle the status bar gap
...

Well, "conf" is not in scope, maybe because this is not EZConfig-style? Then how to "translate" this?

Last edited by nexus7 (2011-10-16 21:24:21)


we are Arch.
you will be assimilated!
resistance is futile!

Offline

#524 2011-10-17 19:06:20

nnoell
Member
From: Spain
Registered: 2010-08-21
Posts: 99

Re: xmonad Hacking Thread

Use ([xK_1 .. xK_9] ++ [xK_0]):

     ...
     ]
     ++
     [((m .|. modMask, k), windows $ f i)
         | (i, k) <- zip (XMonad.workspaces conf) ([xK_1 .. xK_9] ++ [xK_0])
         , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
     ++
     [((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)]]

Offline

#525 2011-10-17 20:54:14

nexus7
Member
From: brain dump
Registered: 2006-12-06
Posts: 285

Re: xmonad Hacking Thread

Thanks a lot again. smile

I'm again getting a

Not in scope: `conf'

-error with this...

edit:\\

2nd, how to implement an individual layout like for gimp? Remember, my ws names got a bit more complicated because of my extra ws font. -- Redefining the names with "where" so far results in following error:

myWorkspaces = [ 
                 "1"
               , "2"
               , "3"
               , "4"
               , "5"
               , "6"
               , "7"
               , "8"
               , "9"  
               ]
             where 
                1 = "^fn(" ++ wsFont ++ ")1"
                2 = "^fn(" ++ wsFont ++ ")2"
                3 = "^fn(" ++ wsFont ++ ")3"
                4 = "^fn(" ++ wsFont ++ ")4"
                5 = "^fn(" ++ wsFont ++ ")5"
                6 = "^fn(" ++ wsFont ++ ")6"
                7 = "^fn(" ++ wsFont ++ ")7"
                8 = "^fn(" ++ wsFont ++ ")8"
                9 = "^fn(" ++ wsFont ++ ")9"

myLayoutHook = avoidStruts $ smartBorders $ (tiled ||| Mirror tiled ||| Circle ||| Grid ||| Full) $ onWorkspace "5" gimped
        where
                tiled   = ResizableTall nmaster delta ratio []
                nmaster = 1
                ratio   = 1/2
                delta   = 3/100
                gimped  = withIM (0.11) (Role "gimp-toolbox") $
                          reflectHoriz $
                          withIM (0.15) (Role "gimp-dock") Full
$ xmonad --recompile
Error detected while loading xmonad configuration file: /home/meee/.xmonad/xmonad.hs

xmonad.hs:60:9:
    No instance for (Read (l0 Window))
      arising from a use of `xmonad'
    Possible fix: add an instance declaration for (Read (l0 Window))
    In the expression: xmonad
    In the expression:
        xmonad
      $   withUrgencyHook NoUrgencyHook
        $   defaultConfig
              {modMask = myModMask, terminal = "terminal", borderWidth = 1,
               normalBorderColor = "#222222", focusedBorderColor = "#3399ff",
               workspaces = myWorkspaces, layoutHook = myLayoutHook,
               manageHook = manageDocks <+> myManageHook
                        <+>
                          manageHook defaultConfig,
               logHook = myLogHook status, startupHook = myStartupHook}
          `additionalKeysP`
            myKeys
    In the expression:
      do { status <- spawnPipe myDzenStatus;
           conky <- spawnPipe myDzenConky;
           pipe <- spawnPipe "xmobar /home/meee/.xmonad/xxmobarrc";
             xmonad
           $   withUrgencyHook NoUrgencyHook
             $   defaultConfig
                   {modMask = myModMask, terminal = "terminal", borderWidth = 1,
                    normalBorderColor = "#222222", focusedBorderColor = "#3399ff",
                    workspaces = myWorkspaces, layoutHook = myLayoutHook,
                    manageHook = manageDocks <+> myManageHook
                             <+>
                               manageHook defaultConfig,
                    logHook = myLogHook status, startupHook = myStartupHook}
               `additionalKeysP`
                 myKeys }

xmonad.hs:60:18:
    No instance for (LayoutClass l0 Window)
      arising from a use of `withUrgencyHook'
    Possible fix:
      add an instance declaration for (LayoutClass l0 Window)
    In the expression: withUrgencyHook NoUrgencyHook
    In the second argument of `($)', namely
      `withUrgencyHook NoUrgencyHook
     $   defaultConfig
           {modMask = myModMask, terminal = "terminal", borderWidth = 1,
            normalBorderColor = "#222222", focusedBorderColor = "#3399ff",
            workspaces = myWorkspaces, layoutHook = myLayoutHook,
            manageHook = manageDocks <+> myManageHook
                     <+>
                       manageHook defaultConfig,
            logHook = myLogHook status, startupHook = myStartupHook}
       `additionalKeysP`
         myKeys'
    In the expression:
        xmonad
      $   withUrgencyHook NoUrgencyHook
        $   defaultConfig
              {modMask = myModMask, terminal = "terminal", borderWidth = 1,
               normalBorderColor = "#222222", focusedBorderColor = "#3399ff",
               workspaces = myWorkspaces, layoutHook = myLayoutHook,
               manageHook = manageDocks <+> myManageHook
                        <+>
                          manageHook defaultConfig,
               logHook = myLogHook status, startupHook = myStartupHook}
          `additionalKeysP`
            myKeys

xmonad.hs:170:17:
    No instance for (Num [Char])
      arising from the literal `1'
    Possible fix: add an instance declaration for (Num [Char])
    In the pattern: 1
    In a pattern binding: 1 = "^fn(" ++ wsFont ++ ")1"
    In an equation for `myWorkspaces':
        myWorkspaces
          = ["1", "2", "3", ....]
          where
              1 = "^fn(" ++ wsFont ++ ")1"
              2 = "^fn(" ++ wsFont ++ ")2"
              3 = "^fn(" ++ wsFont ++ ")3"
              4 = "^fn(" ++ wsFont ++ ")4"
              ....

xmonad.hs:187:45:
    The first argument of ($) takes one argument,
    but its type `Choose
                    ResizableTall
                    (Choose (Mirror ResizableTall) (Choose Circle (Choose Grid Full)))
                    a0'
    has none
    In the second argument of `($)', namely
      `(tiled ||| Mirror tiled ||| Circle ||| Grid ||| Full)
     $ onWorkspace "5" gimped'
    In the second argument of `($)', namely
      `smartBorders
     $   (tiled ||| Mirror tiled ||| Circle ||| Grid ||| Full)
       $ onWorkspace "5" gimped'
    In the expression:
        avoidStruts
      $   smartBorders
        $   (tiled ||| Mirror tiled ||| Circle ||| Grid ||| Full)
          $ onWorkspace "5" gimped

Please check the file for errors.

Beside this my desktop looks quite nice, a screenie is soon to come. smile

Last edited by nexus7 (2011-10-17 21:19:02)


we are Arch.
you will be assimilated!
resistance is futile!

Offline

Board footer

Powered by FluxBB