[xmonad] detecting multi-head and other newbie questions

Mike Linksvayer ml at gondwanaland.com
Sat Apr 9 04:01:19 CEST 2011


Hi,

Thanks for xmonad; it's my first attempt to use a tiling WM, and is
mostly easy, enjoyable, and very fast. I have a few questions that I
haven't been able to answer with a bit of searching and trying. I'm
using Ubuntu 10.10 and the package xmonad 0.9.1-2build2.

...

http://www.haskell.org/haskellwiki/Xmonad/Frequently_asked_questions#Multi_head_or_xinerama_troubles

   ghc -e Graphics.X11.Xinerama.compiledWithXinerama

Output is True.

   ghc -e "Graphics.X11.openDisplay [] >>= Graphics.X11.Xinerama.getScreenInfo"

Output is

   [Rectangle {rect_x = 0, rect_y = 0, rect_width = 1280, rect_height = 800}]

However, /usr/bin/gnome-display-properties also sees a 1680x1050
external monitor (but can't activate it when running from xmonad;
works fine in GNOME).

The xmonad FAQ says (given above) "there may be a problem with your X
server configuration."

I'm not that keen to mess with X configuration, which I haven't had to
do in many years, and I'd like it to continue just working if I ever
go back to GNOME. I've never modified anything in /etc/X11 on this
machine ... I guess I don't know how monitor
autodetection/configuration works, nor what accomplishes that (X?
GNOME?), thus am completely clueless as to what approach to take to
getting it to work under xmonad. Any hint would be much appreciated.

...

Is it possible to make xmobar auto-hide?

...

Many examples such as
http://www.haskell.org/haskellwiki/Xmonad/Config_archive/John_Goerzen%27s_Configuration#Configuring_Related_Utilities
suggest starting related programs in .xsession or .xinitrc but
http://www.haskell.org/haskellwiki/Xmonad/Using_xmonad_in_Ubuntu#Configuration_notes
suggets putting them in xmonad.hs which seems cleaner to me. I've done
this, though sometimes after reloading xmonad with mod-q, applets no
longer appear in trayer, though they're still running. Is there a
"right way" that I'm missing?

FWIW, here is my xmonad.hs

import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.Run(unsafeSpawn)
import XMonad.Util.EZConfig(additionalKeys)
import System.IO

myManageHook = composeAll
    [ className =? "Gimp"      --> doFloat
    , className =? "Vncviewer" --> doFloat
    ]

main = do
    xmproc <- spawnPipe "/usr/bin/xmobar /home/cclearn/.xmobarrc"
    unsafeSpawn "if [ -x /usr/bin/trayer ] ; then trayer --edge top
--align right --SetDockType true --SetPartialStrut true --expand true
--width 10 --transparent true --tint 0x191970 --height 12 & fi"
    unsafeSpawn "if [ -x /usr/bin/nm-applet ] ; then nm-applet
--sm-disable & fi"
    unsafeSpawn "if [ -x /usr/bin/gnome-power-manager ] ; then
gnome-power-manager & fi"
    unsafeSpawn "if [ -x /usr/bin/xscreensaver ] ; then xscreensaver & fi"
    xmonad $ defaultConfig
        { manageHook = manageDocks <+> myManageHook -- make sure to
include myManageHook definition from above
                        <+> manageHook defaultConfig
        , layoutHook = avoidStruts  $  layoutHook defaultConfig
        , logHook = dynamicLogWithPP $ xmobarPP
                        { ppOutput = hPutStrLn xmproc
                        , ppTitle = xmobarColor "green" "" . shorten 50
                        }
        , modMask = mod4Mask     -- Rebind Mod to the Windows key
        } `additionalKeys`
        [ ((mod4Mask .|. shiftMask, xK_z), spawn "xscreensaver-command -lock")
        , ((controlMask, xK_Print), spawn "sleep 0.2; scrot -s")
        , ((0, xK_Print), spawn "scrot")
        ]



Thanks,
Mike



More information about the xmonad mailing list