You are not logged in.

#1 2013-12-29 11:16:13

blubbb
Member
Registered: 2013-09-26
Posts: 59

Xmonad: dynamicLogDzen

Hello guys

I tried setting up a basic status bar using this tutorial

http://tombuntu.com/index.php/2009/03/19/adding-a-dzen2-statusbar-to-xmonad/

However when compiling Xmonad I get this error:

xmonad.hs:90:11:
    Not in scope: `dynamicLogDzen'
    Perhaps you meant `dynamicLog' (imported from XMonad.Hooks.DynamicLog)

Please check the file for errors.

So if I understood that right, I need to have the dynamicLogDzen also imported from somewhere. However, I don't find anything which I forgot to import hmm

Thanks you for reading and I really hope someone could take some time and help me out(again)




my config file:

import XMonad  
import Graphics.X11.ExtraTypes.XF86  
import XMonad.Util.EZConfig  
import Data.Monoid
import System.Exit
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Dzen 
import qualified XMonad.StackSet as W
import qualified Data.Map        as M


main = do
    xmonad $ defaultConfig
			{ terminal 		= myTerminal
			, focusFollowsMouse	= myFocusFollowsMouse 
			, borderWidth		= myBorderWidth
			, workspaces		= myWorkspaces
			, normalBorderColor	= myNormalBorderColor
			, focusedBorderColor	= myFocusedBorderColor
			, modMask 		= mod4Mask
			, layoutHook		= myLayout
			, manageHook		= myManageHook
			, logHook		= myLogHook
			, startupHook		= myStartupHook
			} 
	`additionalKeysP`
	[("<XF86MonBrightnessUp>", spawn "xbacklight +20")
	,("<XF86MonBrightnessDown>", spawn "xbacklight -20")
	,("<XF86AudioRaiseVolume>", spawn "amixer set Master 5%+")
	,("<XF86AudioLowerVolume>", spawn "amixer set Master 5%-")
	,("<XF86AudioMute>", spawn "amixer set Master toggle")
	]

myTerminal	= "xterm"

--Width of the border in pixels:
myBorderWidth	= 1


--The default number of workspaces and their names. The names can also be strings like
--myWorkspaces=["irc", "2", "3", "programming"] + map show[4..9]
--the number of workspaces is determined by the lenght of this list-
myWorkspaces	= ["1", "2", "3", "4", "5", "6", "7", "8", "9"]


--Border color of focused and unfocused windows
myNormalBorderColor	= "#dddddd"
myFocusedBorderColor	= "#ff0000"

--Focus follows mouse pointer?
myFocusFollowsMouse :: Bool
myFocusFollowsMouse = True





--Layouts: You can specify and transform your layouts by modifying these
--Restart layout bindings with mod-short-space(with mod-q) as xmonad preserves your old layout settings by default

--The available layouts. Note that each layout is separated by ||| which denotes layout choice
myLayout = avoidStruts (tiled ||| Mirror tiled ||| Full) ||| Full
	where
			--default tiling algorithm partitions the screen into two
		tiled = Tall nmaster delta ratio
			--the default number of windows in the master pane	
		nmaster = 1
			--default proportion of screen occupied by the master pane	
		ratio = 1/2
			--percent of screen to increment by when resizing panes
		delta = 3/100





--window rules:
--when manageing new windows do always float this programms:
myManageHook = composeAll
	[ className =? "Gimp"	--> doFloat]

 
--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
-- >myLogHook=return() for nothing
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 to nothing:
myStartupHook=return()

Offline

#2 2013-12-29 16:56:42

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

Re: Xmonad: dynamicLogDzen

You don't need dynamicLogHook at all. Just define the contents of myLogHook somewhere. See this.

Offline

#3 2013-12-29 17:30:07

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: Xmonad: dynamicLogDzen

That tutorial is almost five years old. If you look at the documentation skottish linked to, you'll see that you can use

dynamicLogWithPP dzenPP

instead.

Offline

#4 2014-01-01 16:02:05

blubbb
Member
Registered: 2013-09-26
Posts: 59

Re: Xmonad: dynamicLogDzen

Raynman wrote:

That tutorial is almost five years old. If you look at the documentation skottish linked to, you'll see that you can use

dynamicLogWithPP dzenPP

instead.


So do you have an advice where I could find an easy to understand but comprehensive tutorial? Since the bare documentation is a very difficult to understand for me.


When I used Xmonad with the above config file(dynamicLog instead of dynamicLogDzen) I had problem with the screen brightness, the keys wouldn't get recognized however the volume keys worked flawless. Any ideas what it could be?

And then another problem showed up(with the above config file): When terminating xmonad with mod-shift-q I had to left-click on the bar to shut down the x-server. So I thought why not just poweroff? Well when I did this, upon restarting I directly got the black screen(after I logged in) and couldn't do anything there. Only pressing the power button until the laptop shut down did help. Afterwars I had to start the x server(and xmonad) myself again(as I normally do) and it worked again without any problems. Anyone got an idea why this happens?


And last but not least: How to shut down the laptop? First terminate xmonad and dzen and then shut it down via a command or directly from xmonad with shutdown or poweroff? Is there a command which should be prefered above the other for a normal shutdown?

Offline

#5 2014-01-02 04:21:11

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

Re: Xmonad: dynamicLogDzen

This is very basic and it's for xmobar, but hopefully it gets you to the point where the documentation and other more complex setups start to make sense. I didn't define myLogHook anywhere, but simply did it all in logHook:

...snip...

, logHook = dynamicLogWithPP xmobarPP
               { ppCurrent = xmobarColor "#ffffff" "#000000" . pad
               , ppVisible = xmobarColor "#333333" "#000000" . pad
               , ppLayout  = xmobarColor "#ffffff" "#000000" . pad . pad
               , ppTitle   = xmobarColor "#ffffff" "#000000" . pad 
               , ppSep     = ""
               , ppWsSep   = ""
               , ppOutput  = hPutStrLn h
               } 

Offline

#6 2014-01-02 10:42:57

blubbb
Member
Registered: 2013-09-26
Posts: 59

Re: Xmonad: dynamicLogDzen

skottish wrote:

This is very basic and it's for xmobar, but hopefully it gets you to the point where the documentation and other more complex setups start to make sense. I didn't define myLogHook anywhere, but simply did it all in logHook:

...snip...

, logHook = dynamicLogWithPP xmobarPP
               { ppCurrent = xmobarColor "#ffffff" "#000000" . pad
               , ppVisible = xmobarColor "#333333" "#000000" . pad
               , ppLayout  = xmobarColor "#ffffff" "#000000" . pad . pad
               , ppTitle   = xmobarColor "#ffffff" "#000000" . pad 
               , ppSep     = ""
               , ppWsSep   = ""
               , ppOutput  = hPutStrLn h
               } 

Thanks a lot for your reply, I'll try it out as soon as I can!
Would this be whitout a special config file for xmobar? Or what would I have to write in there so that this example would work?

Best regards
Blubb

Offline

#7 2014-01-02 14:15:26

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

Re: Xmonad: dynamicLogDzen

xmobar's defaults should work, but if you want to use dzen2, refer back to the documentation that I posted before. All references to xmobar can be replaced with dzen2 in my example above. You'll still need to start either somewhere in your xmonad.hs file. In my case xmobar is started like this:

main = do
   h <- spawnPipe "xmobar ~/.config/xmobar/xmobarrc"

...snip...

The equivalent dzen2 start line may be somewhat more complex.

Last edited by skottish (2014-01-02 14:16:19)

Offline

#8 2014-01-02 17:50:46

blubbb
Member
Registered: 2013-09-26
Posts: 59

Re: Xmonad: dynamicLogDzen

skottish wrote:

xmobar's defaults should work, but if you want to use dzen2, refer back to the documentation that I posted before. All references to xmobar can be replaced with dzen2 in my example above. You'll still need to start either somewhere in your xmonad.hs file. In my case xmobar is started like this:

main = do
   h <- spawnPipe "xmobar ~/.config/xmobar/xmobarrc"

...snip...

The equivalent dzen2 start line may be somewhat more complex.

Ah ok, so if I don't define anything xmobar directly got it's default, good to know.

May I ask you, what

[...]
h <- spawnPipe [...]

does?

(why there is an "h" especially^.^)





(and I'll definitly try it out, but can't right now, maybe tomorrow.)

Offline

#9 2014-01-02 17:57:10

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

Re: Xmonad: dynamicLogDzen

From the Usage section of the documentation that I linked to:

Xmonad.Hooks.DynamicLog wrote:

If you use spawnPipe, be sure to redefine the ppOutput field of your pretty-printer as in the example above; by default the status will be printed to stdout rather than the pipe you create.

Then see my original code to see how it was implemented.

Last edited by skottish (2014-01-02 17:57:28)

Offline

#10 2014-01-03 10:40:05

blubbb
Member
Registered: 2013-09-26
Posts: 59

Re: Xmonad: dynamicLogDzen

skottish wrote:

From the Usage section of the documentation that I linked to:

Xmonad.Hooks.DynamicLog wrote:

If you use spawnPipe, be sure to redefine the ppOutput field of your pretty-printer as in the example above; by default the status will be printed to stdout rather than the pipe you create.

Then see my original code to see how it was implemented.


Great, thank you sir big_smile

Offline

#11 2014-01-03 20:27:00

blubbb
Member
Registered: 2013-09-26
Posts: 59

Re: Xmonad: dynamicLogDzen

skottish wrote:

This is very basic and it's for xmobar, but hopefully it gets you to the point where the documentation and other more complex setups start to make sense. I didn't define myLogHook anywhere, but simply did it all in logHook:

...snip...

, logHook = dynamicLogWithPP xmobarPP
               { ppCurrent = xmobarColor "#ffffff" "#000000" . pad
               , ppVisible = xmobarColor "#333333" "#000000" . pad
               , ppLayout  = xmobarColor "#ffffff" "#000000" . pad . pad
               , ppTitle   = xmobarColor "#ffffff" "#000000" . pad 
               , ppSep     = ""
               , ppWsSep   = ""
               , ppOutput  = hPutStrLn h
               } 

So I finally tried this out, however it didn't work as expected:

xmonad.hs:15:4:
    The last statement in a 'do' block must be an expression
      h <- spawnPipe "xmobar ~/.config/xmobar/xmobarrc" xmonad
           $ defaultConfig
               {terminal = myTerminal, focusFollowsMouse = myFocusFollowsMouse,
                borderWidth = myBorderWidth, workspaces = myWorkspaces,
                normalBorderColor = myNormalBorderColor,
                focusedBorderColor = myFocusedBorderColor, modMask = mod4Mask,
                layoutHook = myLayout, manageHook = myManageHook,
                logHook = myLogHook, startupHook = myStartupHook}
           `additionalKeysP`
             [("<XF86MonBrightnessUp>", spawn "xbacklight +20"),
              ("<XF86MonBrightnessDown>", spawn "xbacklight -20"),
              ("<XF86AudioRaiseVolume>", spawn "amixer set Master 5%+"),
              ("<XF86AudioLowerVolume>", spawn "amixer set Master 5%-"), ....]

xmonad.hs:15:9: Not in scope: `spawnPipe'

xmonad.hs:96:30:
    Not in scope: `hPutStrLn'
    Perhaps you meant `putStrLn' (imported from Prelude)

xmonad.hs:96:40: Not in scope: `h'

Please check the file for errors.

and here's the config file I used:

import XMonad  
import Graphics.X11.ExtraTypes.XF86  
import XMonad.Util.EZConfig  
import Data.Monoid
import System.Exit
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Dzen 
import qualified XMonad.StackSet as W
import qualified Data.Map        as M


main = do

   h <- spawnPipe "xmobar ~/.config/xmobar/xmobarrc"

    xmonad $ defaultConfig
			{ terminal 		= myTerminal
			, focusFollowsMouse	= myFocusFollowsMouse 
			, borderWidth		= myBorderWidth
			, workspaces		= myWorkspaces
			, normalBorderColor	= myNormalBorderColor
			, focusedBorderColor	= myFocusedBorderColor
			, modMask 		= mod4Mask
			, layoutHook		= myLayout
			, manageHook		= myManageHook
			, logHook		= myLogHook
			, startupHook		= myStartupHook
			} 
	`additionalKeysP`
	[("<XF86MonBrightnessUp>", spawn "xbacklight +20")
	,("<XF86MonBrightnessDown>", spawn "xbacklight -20")
	,("<XF86AudioRaiseVolume>", spawn "amixer set Master 5%+")
	,("<XF86AudioLowerVolume>", spawn "amixer set Master 5%-")
	,("<XF86AudioMute>", spawn "amixer set Master toggle")
	]

myTerminal	= "xterm"

--Width of the border in pixels:
myBorderWidth	= 1


--The default number of workspaces and their names. The names can also be strings like
--myWorkspaces=["irc", "2", "3", "programming"] + map show[4..9]
--the number of workspaces is determined by the lenght of this list-
myWorkspaces	= ["1", "2", "3", "4", "5", "6", "7", "8", "9"]


--Border color of focused and unfocused windows
myNormalBorderColor	= "#dddddd"
myFocusedBorderColor	= "#ff0000"

--Focus follows mouse pointer?
myFocusFollowsMouse :: Bool
myFocusFollowsMouse = True





--Layouts: You can specify and transform your layouts by modifying these
--Restart layout bindings with mod-short-space(with mod-q) 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 algorith 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:
--when manageing new windows do always float this programms:
myManageHook = composeAll
	[ className =? "Gimp"	--> doFloat]

 
--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
myLogHook = dynamicLogWithPP xmobarPP
               { ppCurrent = xmobarColor "#ffffff" "#000000" . pad
               , ppVisible = xmobarColor "#333333" "#000000" . pad
               , ppLayout  = xmobarColor "#ffffff" "#000000" . pad . pad
               , ppTitle   = xmobarColor "#ffffff" "#000000" . pad 
               , ppSep     = ""
               , ppWsSep   = ""
               , ppOutput  = hPutStrLn h
               } 


--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 to nothing:
myStartupHook=return()

Offline

#12 2014-01-03 21:48:52

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

Re: Xmonad: dynamicLogDzen

You need at least to import XMonad.Util.Run. Hopefully then will the first error go away.

I *thought* that xmobar would run without a config and I now think that I'm wrong. The path that I gave you for xmobarrc is not the default. The default is ~/.xmobarrc, but I find having it as ~/.config/xmobar/xmobarrc to be cleaner. Anyway, this is my boring xmobarrc. It requires ttf-dejavu and xmonad-x11-xft:

Config { font = "xft:DejaVu Sans:size=8:antialias=true"
       , bgColor = "black"
       , fgColor = "white"
       , position = Bottom
       , lowerOnStart = True
       , commands = [ Run Date "%a %b %d %Y %l:%M" "date" 600
                    , Run StdinReader ]
       , sepChar = "%"
       , alignSep = "}{"
       , template = "%StdinReader% }{ %date%"
       }

Last edited by skottish (2014-01-03 21:51:20)

Offline

#13 2014-01-03 22:18:50

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: Xmonad: dynamicLogDzen

When you get any 'not in scope' errors, use hoogle to find the module containing the declaration. hPutStrLn is in the base libraries, so that is easy to find. To also search in xmonad and xmonad-contrib, you have to tell hoogle to include those packages in the search. For example, to find spawnPipe: http://www.haskell.org/hoogle/?hoogle=s … +%2Bxmonad.

(But of course the final error is because you bind 'h' in one function and try to use it in another.)

Offline

#14 2014-01-05 15:58:30

blubbb
Member
Registered: 2013-09-26
Posts: 59

Re: Xmonad: dynamicLogDzen

so are these two lines conficting? How would I solve them? Simply by renaming? I thought it needed to be the same "h"?


h <- spawnPipe "xmobar ~/.config/xmobar/xmobarrc"

ppOutput  = hPutStrLn h

Offline

#15 2014-01-05 23:34:45

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

Re: Xmonad: dynamicLogDzen

blubbb wrote:

so are these two lines conficting? How would I solve them? Simply by renaming? I thought it needed to be the same "h"?


h <- spawnPipe "xmobar ~/.config/xmobar/xmobarrc"

ppOutput  = hPutStrLn h
me and the documentation that I originally posted wrote:

You need at least to import XMonad.Util.Run

hPutStrLn and spawnPipe are both defined there. Re-read the 'Usage' section from the documention.

Offline

#16 2014-01-06 17:29:59

blubbb
Member
Registered: 2013-09-26
Posts: 59

Re: Xmonad: dynamicLogDzen

that's what I did and I get this error:

Error detected while loading xmonad configuration file: /home/wolf/.xmonad/xmonad.hs

xmonad.hs:15:4:
    The last statement in a 'do' block must be an expression
      h <- spawnPipe "xmobar ~/.config/xmobar/xmobarrc" xmonad
           $ defaultConfig
               {terminal = myTerminal, focusFollowsMouse = myFocusFollowsMouse,
                borderWidth = myBorderWidth, workspaces = myWorkspaces,
                normalBorderColor = myNormalBorderColor,
                focusedBorderColor = myFocusedBorderColor, modMask = mod4Mask,
                layoutHook = myLayout, manageHook = myManageHook,
                logHook = myLogHook, startupHook = myStartupHook}
           `additionalKeysP`
             [("<XF86MonBrightnessUp>", spawn "xbacklight +20"),
              ("<XF86MonBrightnessDown>", spawn "xbacklight -20"),
              ("<XF86AudioRaiseVolume>", spawn "amixer set Master 5%+"),
              ("<XF86AudioLowerVolume>", spawn "amixer set Master 5%-"), ....]

xmonad.hs:96:40: Not in scope: `h'

Please check the file for errors.   

Offline

#17 2014-01-06 18:37:42

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

Re: Xmonad: dynamicLogDzen

Post all of your current xmonad.hs file.

Offline

#18 2014-01-07 17:37:19

blubbb
Member
Registered: 2013-09-26
Posts: 59

Re: Xmonad: dynamicLogDzen

import XMonad  
import Graphics.X11.ExtraTypes.XF86  
import XMonad.Util.EZConfig  
import Data.Monoid
import System.Exit
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Dzen 
import qualified XMonad.StackSet as W
import qualified Data.Map        as M
import XMonad.Util.Run

main = do

   h <- spawnPipe "xmobar ~/.config/xmobar/xmobarrc"

    xmonad $ defaultConfig
			{ terminal 		= myTerminal
			, focusFollowsMouse	= myFocusFollowsMouse 
			, borderWidth		= myBorderWidth
			, workspaces		= myWorkspaces
			, normalBorderColor	= myNormalBorderColor
			, focusedBorderColor	= myFocusedBorderColor
			, modMask 		= mod4Mask
			, layoutHook		= myLayout
			, manageHook		= myManageHook
			, logHook		= myLogHook
			, startupHook		= myStartupHook
			} 
	`additionalKeysP`
	[("<XF86MonBrightnessUp>", spawn "xbacklight +20")
	,("<XF86MonBrightnessDown>", spawn "xbacklight -20")
	,("<XF86AudioRaiseVolume>", spawn "amixer set Master 5%+")
	,("<XF86AudioLowerVolume>", spawn "amixer set Master 5%-")
	,("<XF86AudioMute>", spawn "amixer set Master toggle")
	]

myTerminal	= "xterm"

--Width of the border in pixels:
myBorderWidth	= 1


--The default number of workspaces and their names. The names can also be strings like
--myWorkspaces=["irc", "2", "3", "programming"] + map show[4..9]
--the number of workspaces is determined by the lenght of this list-
myWorkspaces	= ["1", "2", "3", "4", "5", "6", "7", "8", "9"]


--Border color of focused and unfocused windows
myNormalBorderColor	= "#dddddd"
myFocusedBorderColor	= "#ff0000"

--Focus follows mouse pointer?
myFocusFollowsMouse :: Bool
myFocusFollowsMouse = True





--Layouts: You can specify and transform your layouts by modifying these
--Restart layout bindings with mod-short-space(with mod-q) 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 algorith 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:
--when manageing new windows do always float this programms:
myManageHook = composeAll
	[ className =? "Gimp"	--> doFloat]

 
--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
myLogHook = dynamicLogWithPP xmobarPP
               { ppCurrent = xmobarColor "#ffffff" "#000000" . pad
               , ppVisible = xmobarColor "#333333" "#000000" . pad
               , ppLayout  = xmobarColor "#ffffff" "#000000" . pad . pad
               , ppTitle   = xmobarColor "#ffffff" "#000000" . pad 
               , ppSep     = ""
               , ppWsSep   = ""
               , ppOutput  = hPutStrLn h
               } 


--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 to nothing:
myStartupHook=return()

Offline

#19 2014-01-07 19:26:40

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

Re: Xmonad: dynamicLogDzen

Change

myLogHook = dynamicLogWithPP xmobarPP

to

myLogHook = dynamicLogWithPP $ xmobarPP

and see if it compiles.

***EDIT***

I went back and double checked, and apparently that it isn't what I did to fix the compile issue. One thing that you can do for sure that will work is to move all of the logHook stuff to main. So instead of having logHook = myLogHook, you can have this:

 , logHook       = dynamicLogWithPP xmobarPP
                     { ppCurrent = xmobarColor "#ffffff" "#000000" . pad
                     , ppVisible = xmobarColor "#333333" "#000000" . pad
                     , ppLayout  = xmobarColor "#ffffff" "#000000" . pad . pad
                     , ppTitle   = xmobarColor "#ffffff" "#000000" . pad 
                     , ppSep     = ""
                     , ppWsSep   = ""
                     , ppOutput  = hPutStrLn h
                     }

Last edited by skottish (2014-01-07 20:47:36)

Offline

#20 2014-01-12 19:15:12

blubbb
Member
Registered: 2013-09-26
Posts: 59

Re: Xmonad: dynamicLogDzen

skottish wrote:

Change

myLogHook = dynamicLogWithPP xmobarPP

to

myLogHook = dynamicLogWithPP $ xmobarPP

and see if it compiles.

***EDIT***

I went back and double checked, and apparently that it isn't what I did to fix the compile issue. One thing that you can do for sure that will work is to move all of the logHook stuff to main. So instead of having logHook = myLogHook, you can have this:

 , logHook       = dynamicLogWithPP xmobarPP
                     { ppCurrent = xmobarColor "#ffffff" "#000000" . pad
                     , ppVisible = xmobarColor "#333333" "#000000" . pad
                     , ppLayout  = xmobarColor "#ffffff" "#000000" . pad . pad
                     , ppTitle   = xmobarColor "#ffffff" "#000000" . pad 
                     , ppSep     = ""
                     , ppWsSep   = ""
                     , ppOutput  = hPutStrLn h
                     }

Ok, finally I found time to retry it and I still get this error:

[wolf@arch ~]$ xmonad --recompile
Error detected while loading xmonad configuration file: /home/wolf/.xmonad/xmonad.hs

xmonad.hs:15:4:
    The last statement in a 'do' block must be an expression
      h <- spawnPipe "xmobar ~/.config/xmobar/xmobarrc" xmonad
           $ defaultConfig
               {terminal = myTerminal, focusFollowsMouse = myFocusFollowsMouse,
                borderWidth = myBorderWidth, workspaces = myWorkspaces,
                normalBorderColor = myNormalBorderColor,
                focusedBorderColor = myFocusedBorderColor, modMask = mod4Mask,
                layoutHook = myLayout, manageHook = myManageHook,
                logHook = dynamicLogWithPP
                            (xmobarPP
                               {ppCurrent = xmobarColor "#ffffff" "#000000" . pad,
                                ppVisible = xmobarColor "#333333" "#000000" . pad,
                                ppLayout = xmobarColor "#ffffff" "#000000" . pad . pad,
                                ppTitle = xmobarColor "#ffffff" "#000000" . pad, ppSep = "",
                                ppWsSep = "", ppOutput = hPutStrLn h}),
                startupHook = myStartupHook}
           `additionalKeysP`
             [("<XF86MonBrightnessUp>", spawn "xbacklight +20"),
              ("<XF86MonBrightnessDown>", spawn "xbacklight -20"),
              ("<XF86AudioRaiseVolume>", spawn "amixer set Master 5%+"),
              ("<XF86AudioLowerVolume>", spawn "amixer set Master 5%-"), ....]

xmonad.hs:34:46: Not in scope: `h'

Please check the file for errors.                                

and this was the configfile I used:

import XMonad  
import Graphics.X11.ExtraTypes.XF86  
import XMonad.Util.EZConfig  
import Data.Monoid
import System.Exit
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Dzen 
import qualified XMonad.StackSet as W
import qualified Data.Map        as M
import XMonad.Util.Run

main = do

   h <- spawnPipe "xmobar ~/.config/xmobar/xmobarrc"

    xmonad $ defaultConfig
			{ terminal 		= myTerminal
			, focusFollowsMouse	= myFocusFollowsMouse 
			, borderWidth		= myBorderWidth
			, workspaces		= myWorkspaces
			, normalBorderColor	= myNormalBorderColor
			, focusedBorderColor	= myFocusedBorderColor
			, modMask 		= mod4Mask
			, layoutHook		= myLayout
			, manageHook		= myManageHook
			, logHook		= dynamicLogWithPP xmobarPP
                     { ppCurrent = xmobarColor "#ffffff" "#000000" . pad
                     , ppVisible = xmobarColor "#333333" "#000000" . pad
                     , ppLayout  = xmobarColor "#ffffff" "#000000" . pad . pad
                     , ppTitle   = xmobarColor "#ffffff" "#000000" . pad 
                     , ppSep     = ""
                     , ppWsSep   = ""
                     , ppOutput  = hPutStrLn h
                     }
			, startupHook		= myStartupHook
			} 
	`additionalKeysP`
	[("<XF86MonBrightnessUp>", spawn "xbacklight +20")
	,("<XF86MonBrightnessDown>", spawn "xbacklight -20")
	,("<XF86AudioRaiseVolume>", spawn "amixer set Master 5%+")
	,("<XF86AudioLowerVolume>", spawn "amixer set Master 5%-")
	,("<XF86AudioMute>", spawn "amixer set Master toggle")
	]

myTerminal	= "xterm"

--Width of the border in pixels:
myBorderWidth	= 1


--The default number of workspaces and their names. The names can also be strings like
--myWorkspaces=["irc", "2", "3", "programming"] + map show[4..9]
--the number of workspaces is determined by the lenght of this list-
myWorkspaces	= ["1", "2", "3", "4", "5", "6", "7", "8", "9"]


--Border color of focused and unfocused windows
myNormalBorderColor	= "#dddddd"
myFocusedBorderColor	= "#ff0000"

--Focus follows mouse pointer?
myFocusFollowsMouse :: Bool
myFocusFollowsMouse = True





--Layouts: You can specify and transform your layouts by modifying these
--Restart layout bindings with mod-short-space(with mod-q) 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 algorith 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:
--when manageing new windows do always float this programms:
myManageHook = composeAll
	[ className =? "Gimp"	--> doFloat]

 
--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
--myLogHook = dynamicLogWithPP xmobarPP
--               { ppCurrent = xmobarColor "#ffffff" "#000000" . pad
--               , ppVisible = xmobarColor "#333333" "#000000" . pad
--               , ppLayout  = xmobarColor "#ffffff" "#000000" . pad . pad
--               , ppTitle   = xmobarColor "#ffffff" "#000000" . pad 
--               , ppSep     = ""
--               , ppWsSep   = ""
--               , ppOutput  = hPutStrLn h
--               } 


--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 to nothing:
myStartupHook=return()

Offline

#21 2014-01-12 20:26:00

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

Re: Xmonad: dynamicLogDzen

I really hope that you enjoy xmonad. You've certainly worked hard to get this far! And the solution may give you a wee bit of a headache...

See the little indentation of space between the h and xmonad in the beginning of the do block? That's what's causing your problem right now. For real. Line up the "xmonad $ defaultConfig" with the "h <-" line above it all the way down to right above "`additionalKeysP`". Haskell is very peculiar in regards to whitespace.

**EDIT**

To put it less wordy, align the vertical indentation of the "xmonad $ defaultConfig" block with the line above it.

Last edited by skottish (2014-01-13 01:39:33)

Offline

#22 2014-01-13 06:43:04

blubbb
Member
Registered: 2013-09-26
Posts: 59

Re: Xmonad: dynamicLogDzen

skottish wrote:

I really hope that you enjoy xmonad. You've certainly worked hard to get this far! And the solution may give you a wee bit of a headache...

See the little indentation of space between the h and xmonad in the beginning of the do block? That's what's causing your problem right now. For real. Line up the "xmonad $ defaultConfig" with the "h <-" line above it all the way down to right above "`additionalKeysP`". Haskell is very peculiar in regards to whitespace.

**EDIT**

To put it less wordy, align the vertical indentation of the "xmonad $ defaultConfig" block with the line above it.

Thank you Scottish, I do really enjoy xmonad even in the very basic form. Before I tried xmonad I had lxde, xfce, gnome and kde. None of them was "fancy" enough. When I first used xmonad I found out that I didn't want a fancy DE instead I just wanted something which is useful and not totally blown up. There's just one thing which I don't like about it: When I have three windows on one desktop and the master windows vertically oriented and the other two are horizontally oriented, then I can only adjust the width of the master window which is vertically. But if I wanted to adjust the height of one of the two windows which are horizontal ordered I can't. Is this normal or is there a way to do this?


Unfortunatly the solution you provided didn't work that much, I still this error:

Error detected while loading xmonad configuration file: /home/wolf/.xmonad/xmonad.hs

xmonad.hs:14:4:
    The last statement in a 'do' block must be an expression
      h <- spawnPipe "xmobar ~/.config/xmobar/xmobarrc" xmonad
           $ defaultConfig
               {terminal = myTerminal, focusFollowsMouse = myFocusFollowsMouse,
                borderWidth = myBorderWidth, workspaces = myWorkspaces,
                normalBorderColor = myNormalBorderColor,
                focusedBorderColor = myFocusedBorderColor, modMask = mod4Mask,
                layoutHook = myLayout, manageHook = myManageHook,
                logHook = dynamicLogWithPP
                            (xmobarPP
                               {ppCurrent = xmobarColor "#ffffff" "#000000" . pad,
                                ppVisible = xmobarColor "#333333" "#000000" . pad,
                                ppLayout = xmobarColor "#ffffff" "#000000" . pad . pad,
                                ppTitle = xmobarColor "#ffffff" "#000000" . pad, ppSep = "",
                                ppWsSep = "", ppOutput = hPutStrLn h}),
                startupHook = myStartupHook}
           `additionalKeysP`
             [("<XF86MonBrightnessUp>", spawn "xbacklight +20"),
              ("<XF86MonBrightnessDown>", spawn "xbacklight -20"),
              ("<XF86AudioRaiseVolume>", spawn "amixer set Master 5%+"),
              ("<XF86AudioLowerVolume>", spawn "amixer set Master 5%-"), ....]

xmonad.hs:31:46: Not in scope: `h'

Please check the file for errors.

using this config file:

import XMonad  
import Graphics.X11.ExtraTypes.XF86  
import XMonad.Util.EZConfig  
import Data.Monoid
import System.Exit
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Dzen 
import qualified XMonad.StackSet as W
import qualified Data.Map        as M
import XMonad.Util.Run

main = do
   h <- spawnPipe "xmobar ~/.config/xmobar/xmobarrc" xmonad $ defaultConfig
			{ terminal 		= myTerminal
			, focusFollowsMouse	= myFocusFollowsMouse 
			, borderWidth		= myBorderWidth
			, workspaces		= myWorkspaces
			, normalBorderColor	= myNormalBorderColor
			, focusedBorderColor	= myFocusedBorderColor
			, modMask 		= mod4Mask
			, layoutHook		= myLayout
			, manageHook		= myManageHook
			, logHook		= dynamicLogWithPP xmobarPP
                     { ppCurrent = xmobarColor "#ffffff" "#000000" . pad
                     , ppVisible = xmobarColor "#333333" "#000000" . pad
                     , ppLayout  = xmobarColor "#ffffff" "#000000" . pad . pad
                     , ppTitle   = xmobarColor "#ffffff" "#000000" . pad 
                     , ppSep     = ""
                     , ppWsSep   = ""
                     , ppOutput  = hPutStrLn h
                     }
			, startupHook		= myStartupHook
			}`additionalKeysP`
	[("<XF86MonBrightnessUp>", spawn "xbacklight +20")
	,("<XF86MonBrightnessDown>", spawn "xbacklight -20")
	,("<XF86AudioRaiseVolume>", spawn "amixer set Master 5%+")
	,("<XF86AudioLowerVolume>", spawn "amixer set Master 5%-")
	,("<XF86AudioMute>", spawn "amixer set Master toggle")
	]

myTerminal	= "xterm"

--Width of the border in pixels:
myBorderWidth	= 1


--The default number of workspaces and their names. The names can also be strings like
--myWorkspaces=["irc", "2", "3", "programming"] + map show[4..9]
--the number of workspaces is determined by the lenght of this list-
myWorkspaces	= ["1", "2", "3", "4", "5", "6", "7", "8", "9"]


--Border color of focused and unfocused windows
myNormalBorderColor	= "#dddddd"
myFocusedBorderColor	= "#ff0000"

--Focus follows mouse pointer?
myFocusFollowsMouse :: Bool
myFocusFollowsMouse = True





--Layouts: You can specify and transform your layouts by modifying these
--Restart layout bindings with mod-short-space(with mod-q) 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 algorith 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:
--when manageing new windows do always float this programms:
myManageHook = composeAll
	[ className =? "Gimp"	--> doFloat]

 
--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
--myLogHook = dynamicLogWithPP xmobarPP
--               { ppCurrent = xmobarColor "#ffffff" "#000000" . pad
--               , ppVisible = xmobarColor "#333333" "#000000" . pad
--               , ppLayout  = xmobarColor "#ffffff" "#000000" . pad . pad
--               , ppTitle   = xmobarColor "#ffffff" "#000000" . pad 
--               , ppSep     = ""
--               , ppWsSep   = ""
--               , ppOutput  = hPutStrLn h
--               } 


--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 to nothing:
myStartupHook=return()

Offline

#23 2014-01-13 14:52:44

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

Re: Xmonad: dynamicLogDzen

Maybe I didn't explain myself too well:

main = do
   h <- spawnPipe "xmobar ~/.config/xmobar/xmobarrc" 

   xmonad $ defaultConfig
                { terminal 		= myTerminal
		, focusFollowsMouse	= myFocusFollowsMouse 
		, borderWidth		= myBorderWidth
		, workspaces		= myWorkspaces
		, normalBorderColor	= myNormalBorderColor
...and the rest...

Offline

#24 2014-01-13 15:05:13

blubbb
Member
Registered: 2013-09-26
Posts: 59

Re: Xmonad: dynamicLogDzen

skottish wrote:

Maybe I didn't explain myself too well:

main = do
   h <- spawnPipe "xmobar ~/.config/xmobar/xmobarrc" 

   xmonad $ defaultConfig
                { terminal 		= myTerminal
		, focusFollowsMouse	= myFocusFollowsMouse 
		, borderWidth		= myBorderWidth
		, workspaces		= myWorkspaces
		, normalBorderColor	= myNormalBorderColor
...and the rest...

I'm really sorry, maybe it's my bad english but I still didn't get what's different from your notation to mine and what I have to change sad

Offline

#25 2014-01-13 16:22:29

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

Re: Xmonad: dynamicLogDzen

In the xmonad.hs file that you posted here:

https://bbs.archlinux.org/viewtopic.php … 1#p1370101

Simply delete one space from in front of "xmonad $ defaultConfig" so that it's lined up with the line above it. I can compile and run your version with this one change.

Offline

Board footer

Powered by FluxBB