You are not logged in.

#1 2014-04-07 21:06:00

crazzyfool
Member
Registered: 2014-04-07
Posts: 33

XMonad - workspace order issue

Hi,

I'm trying to fix a minor issue/annoyance with my XMonad configuration but could use some help.

I have 3 monitors connected to the one card.  Two DVI connectors and one HDMI.  Xorg pretty much worked out-the-box, except the screens were logically in the wrong order in relation the their positioning.  When moving the mouse, the order would be as shown below:

[2]  [1*]  [3]

* = denotes the middle monitor should be the primary display (HDMI).

I fixed that with the below command first.  Then later with /etc/X11/xorg.conf.

xrandr --output HDMI-0 --auto --primary --output DVI-D-0 --right-of HDMI-0 --output DVI-I-1 --left-of HDMI-0

That was fine but the XMonad {w,e,r} key bindings were also in the wrong order.  I fixed that with the following in my ~/.xmonad/xmonad.hs configuration.

[((m .|. mod4Mask, key), screenWorkspace sc >>= flip whenJust (windows . f))
        | (key, sc) <- zip [xK_w, xK_e, xK_r] [1,0,2]                      -- was [0..]
        , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]
]

Now the only issue is that when XMonad starts, it defaults to use the middle monitor (which is correct) but xmobar reports the below.

[1:web1] (2:web2) (3:games)

Where the middle monitor is mapped to the [1:web1] workspace.

What I'm trying to achieve is so that it defaults to:

(1:web1)  [2:web2]  (3:games)

Where the middle monitor is mapped to the [2:web2] workspace.


I know all this stuff is very fluid in XMonad and so not really an issue......it's just seems a more logical way to start the session.

Surely this is possible isn't it?!

Offline

#2 2014-04-07 21:57:12

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

Re: XMonad - workspace order issue

You could execute some actions from XMonad.Actions.CycleWS (part of xmonad-contrib) as part of your startupHook. I think you want swapNextScreen, but I'm not sure.

Offline

#3 2014-04-08 19:15:44

crazzyfool
Member
Registered: 2014-04-07
Posts: 33

Re: XMonad - workspace order issue

Thanks Raynman!  This does indeed look like it should do the job.  Unfortunately I have no idea how to use it as I don't know any Haskell.  Any idea what my startupHook might look like?  Currently, it looks like:

mystartupHook = setWName "LG3D"

Offline

#4 2014-04-08 19:44:19

crazzyfool
Member
Registered: 2014-04-07
Posts: 33

Re: XMonad - workspace order issue

I've tried to simply use it as shown below...

import XMonad.Actions.CycleWS
...
myStartupHook = (nextWS)

...and that has the desired affect.....accept that it is called every time the startupHook is, and I don't know how often that is.  I do know that it is called every time you recompile xmonad though!

Even if the above wasn't too annoying to live with, I still don't know how to also use it with the 'setWName "LG3D"' set at the same time.

Any help greatly appreciated!

Offline

#5 2014-04-08 20:57:45

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

Re: XMonad - workspace order issue

You probably mean restart instead of recompile and yes the startupHook runs during every startup (see name and documentation of XConfig). I can't think of an easy way to get around that, but it'll probably be a little less annoying if you always switch to your main screen during startup (to make it independent of the screen you're on at the time you issue the restart command).

You currently specify the order twice: once for xrandr and once for the keybindings. I found http://xmonad.org/xmonad-docs/xmonad-co … reens.html, which you can use to make the keybindings follow the order specified with xrandr. Then if you reorder the monitors, you only have to adjust the xrandr command. And it gives you viewScreen to use in the startupHook instead of the stuff from CycleWS. Then you get

import XMonad.Actions.PhysicalScreens
...
myStartupHook = setWMName "LG3D" >> viewScreen 1

(+ the keybindings from the example in the documentation). This also shows that you can combine actions with >> (do-notation could also be used instead).

Last edited by Raynman (2014-04-08 20:59:25)

Offline

Board footer

Powered by FluxBB