You are not logged in.
Hello,
I'm quite new to xmonad (and am loving it), and need some help with setting up xmobar. The xmonad entry in the wiki helped me setup xmobar right, although the section describing how to make space for it was not very descriptive (at least for a newbie who doesn't know haskell.)
I'm supposed to "Wrap your layouts with avoidStruts from XMonad.Hooks.ManageDocks for automatic dock/panel/trayer spacing" with the following two lines of code:
layoutHook = avoidStruts (tiled Tall ||| ...
manageHook = manageHook defaultConfig <+> manageDocks
Where is this in relation to the rest of my xmonad.hs? Is it in the main section? Do I have to put anything else in my xmonad.hs or is there anything thats "obvious" that I also need to know?
Any help would be greatly appreciated, and I'm sorry if its a silly question.
Last edited by opothehippo (2009-08-23 01:29:10)
Arch x86_64 | XMonad
Offline
It belongs in the main block, but sometimes layouthook and managehook will have an exteneded config where it would look something like
layoutHook = myLayout
and myLayout is defined later. It depends on your config. Are you starting from someone else's config?
Offline
there's two ways to do it. you can put your layoutHook right inside main {} or you can call it by it's name in main then define it below. this is best explained as an example:
right in main
main = do
xmonad $ defaultConfig
{ terminal = "urxvt"
, layoutHook = avoidStruts $ Tall ||| Wide
, manageHook = manageHook defaultConfig <+> manageDocks
}
by calling functions
main = do
xmonad $ defaultConfig
{ terminal = myTerminal
, layoutHook = myLayout
, manageHook = myManageHook
}
myTerminal = "urxvt"
myLayout = avoidStruts $ Tall ||| Wide
myManageHook = manageHook defaultsConfig <+> manageDocks
hope this clarifies it. i prefer to call functions; that way as things get complicated, main stays nice and clean while you can have separate destinct functional sections for each of your options.
//github/
Offline
Hi, I was in the same position as you quite recently (and am now a happy xmonad user). Here is my xmonad.hs for reference:
--
-- XMonad Haskell Configuration File
-- - verify code syntax with 'ghci xmonad.hs'
-- - compile with 'xmonad --recompile' or 'ghc --make xmonad.hs'
--
-- Hopefully this is good base on which to build.
--
-- Changed from defaultConfig:
-- - use Mod4 as modMask, i.e. Super key
-- - allow use of status bar, and start one
-- - enable mouse follows focus
-- - change terminal emulator to xterm
-- - change border width to two pixels
--
-- Changes in the future:
-- - change terminal emulator to urxvt
-- - make GIMP manageable?
-- - wrap workspaces with mouse
-- - change keybindings: application, layout
--
-- Layouts to include:
-- - Xmonad.Layout.Circle, floating circular layout
-- - Xmonad.Layout.Maximize, maximize a window (like full?)
-- - XMonad.Layout.Spiral, fibonacci sequence; cool
-- - XMonad.Layout.IM, multi-window application friendly (GIMP)
--
-- Main XMonad source code.
import XMonad
-- Allow management of dock programs.
import XMonad.Hooks.ManageDocks
-- Allow exec of programs (return handle).
import XMonad.Util.Run(spawnPipe)
-- Allow adding or removing keybindings.
import XMonad.Util.EZConfig(additionalKeys)
-- Allow Pointer-Follows-Focus.
import XMonad.Actions.UpdatePointer
-- Allow interfacing with system (get client info).
import System.IO
main = do
xmproc <- spawnPipe "/usr/bin/xmobar /home/egan/.xmobarrc"
xmonad $ defaultConfig
{ manageHook = manageDocks <+> manageHook defaultConfig
, layoutHook = avoidStruts $ layoutHook defaultConfig
, logHook = updatePointer Nearest
, borderWidth = 2
, terminal = "urxvtc"
, modMask = mod4Mask
}
Basically, you have to include the defaultConfig as well as any other modules you are using. Once you hit the main section, that first line actually launches xmobar so you don't need it in you .xinitrc. Then we define the manageHook and the layoutHook as including manageDocks and avoidStruts in addition to the default code. The logHook is only to allow pointer-follows-focus, and the rest before the } is completely optional, or you can fill in your own values. Hopefully this helps you!
Offline
Awesome, it's working now. I tried brisbin33's suggestion of defining a function, but had some errors and now use the two lines of code egan suggested. I'm not sure if it will still work in the future when I start to add some new layouts, but right now it's fine.
Thanks everyone for the speedy and helpful replies.
Arch x86_64 | XMonad
Offline