Tiling window managers and multi head setup: Gnome style workspace

4

4

I just switched from metacity to xmonad and I am very impressed by the tiling window manager concept. But I thing bothers me: In gnome a "workspace" was composed of all of my three monitors, but with xmonad every physical screen has it´s own workspace (e.g. when I press mod+1 only one screen changes his workspace).

Is there a tiling window manager which implements the gnome (metacity) workspace concept? Can xmonad link all physical screens into one workspace somehow?

Flow

Posted 2010-09-24T10:50:25.123

Reputation: 997

Answers

3

XMonad cannot use all three screens as a single workspace but nor would you want it to. I think you just need to know how to navigate your screens better. I have a setup that I quite like and you can see the config file for that setup in the XMonad section of the Haskell Wiki. Everything I will show will come from stuff in my own config on my machine (though that is not necessarily what is on that page I linked to).

There are two xmonad-contrib libraries that make multi-head navigation not only bearable but a wonderful godsend and they are CycleWS and TagWindows.

CycleWS allows you to cycle through the workspaces on different physical screens (with prevScreen and nextScreen) and it also allows you to move windows between screens easily (with shiftPrevScreen and shiftNextScreen). That means that even though you have different workspaces on each screen that each one can share the windows between them. Unless you want one window to span across every screen that you have then you are fine. Here is how my xmonad.hs uses the CycleWS commands:

-- Alt + Ctrl Left / Right makes the view go left and right
, ((altMask .|. controlMask, xK_Left       ), prevScreen >> windowCenter)
, ((altMask .|. controlMask, xK_Right      ), nextScreen >> windowCenter)
, ((altMask .|. controlMask, xK_Down       ), shiftPrevScreen)
, ((altMask .|. controlMask, xK_Up         ), shiftNextScreen)
, ((altMask .|. controlMask .|. shiftMask, xK_Down       ), shiftPrevScreen >> prevScreen >> windowCenter)
, ((altMask .|. controlMask .|. shiftMask, xK_Up         ), shiftNextScreen >> nextScreen >> windowCenter)

[Note: windowCenter = warpToWindow (1 % 6) (1 % 6) ]

TagWindows is awesome, especially the viewOnScreen function which lets you call up any tagged program on any of your screens right to the front though I had to do a little hacking to get that working to my liking. Here are the keys that I use:

, ((myModMask,                 xK_g  ), tagPrompt defaultXPConfig (withFocused . addTag))
, ((myModMask .|. shiftMask,   xK_g  ), tagDelPrompt defaultXPConfig)
, ((altMask,                   xK_g  ), tagPrompt defaultXPConfig (`withTaggedGlobalP` gotoWindow))

And here is where the gotoWindow function is defined:

-- Warning: This gotoWindow function assumes you made your workspaces
-- with the 'withScreens' function from XMonad.Layout.IndependentScreens    
gotoWindow :: Window -> WindowSet -> WindowSet
gotoWindow window ws = case S.findTag window ws of
                           Just i -> viewOnScreen (screenIdFromTag i) i ws
                           Nothing -> ws
    where
        screenIdFromTag :: WorkspaceId -> ScreenId
        screenIdFromTag = S . read . takeWhile (/= '_')

And that should allow you to nail multi-headed awesomeness in your XMonad config file. Feel free to ask me more questions in the comments if you have any. I hope this helps.

Robert Massaioli

Posted 2010-09-24T10:50:25.123

Reputation: 744

"XMonad cannot use all three screens as a single workspace but nor would you want it to. " That's pretty opinionated. :) Say you have 3 small monitors with resolution 1366×768, you fire up a shell on the leftmost and then print 100 500-character lines. They would wrap. In the interest of reading it easier, you might want to extend the shell across two or three monitors temporarily. You can float it, but then you lose a lot of tiling goodness. I think there's a lot of value of being able to do one workspace across all monitors. – steady rain – 2015-04-17T17:00:39.373

I have downvoted this answer for the same reason given by steady rain; it is a perfectly valid thing to want. – user76871 – 2016-07-13T06:04:57.810