Nested X11 sessions are possible with Xephyr, see this example from the wikipedia page:
This is independent of the "base" WM (XMonad), since it's just another X11 client for it to take care of. That said, I have no idea about accelerated graphics in Xephyr, i.e. if Compiz is usable this way...
This failed. XMonad works as expected, but applications do not receive pressed keys. I mean, I use winkey as modKey on 5th workspace, and altkey on other workspaces. I used to switch workspaces with modKey+number. When I press Alt+2 on 5th workspace, XMonad does nothing (which is correct), and application does nothing (which is wrong). Chrome does not switch to 2nd tab, and so on.
Okay, so I managed to do it, using XMonad.Actions.PerWorkspaceKeys.
Related configuration:
import XMonad.Actions.PerWorkspaceKeys
workspaceModkeys = [ (mod1Mask, map show ([1..4] ++ [6..9])) -- use Alt as modkey on all workspaces
, (mod4Mask, ["5"]) -- save 5th (use Win there)
]
modifiedKeysList conf =
[ ((0, xK_Return), spawn $ XMonad.terminal conf) -- launch a terminal
, ((shiftMask, xK_c ), kill) -- close focused window
]
unmodifiedKeys conf =
[ ((0, xF86XK_AudioPlay ), spawn "mpc toggle")
, ((0, xF86XK_AudioStop ), spawn "mpc stop")
]
keysList conf = concat (map modifyKey (modifiedKeysList conf)) ++ (unmodifiedKeys conf)
modifyKey :: ((KeyMask, KeySym), X()) -> [((KeyMask, KeySym), X())]
modifyKey k = map (f k) workspaceModkeys
where
f ((mask, key), action) (mod, workspaces) = ((mask .|. mod, key), bindOn (map (\w -> (w, action)) workspaces))
myKeys conf = M.fromList $ keysList conf
main = xmonad $ defaultConfig {
keys = myKeys
}
List modifiedKeys will use modifier (in this example — Winkey on 5th workspace, and left Alt on all others), list unmodifiedKeys is used as is.
Still might look into window-specific keys later, but I'm done for now.
Best Answer
Yes. There are two ways to achieve it:
A trick to reorder your workspaces (assuming your left screen is the primary screen, you can use
xrandr -q
to check)workspaces = ["2:mail", "3:web", "4:dev", "5", "6", "7", "8:chat", "9", "10", "1:db"] associatedKeySyms = [xK_2 .. xK_9] ++ [xK_0, xK_1]
The key here is the order ofassociatedKeySyms
, since xmonad does not care the names for your workspaces. If you do not display the workspace names on your status bar, this will work. An even simpler way is to just changeassociatedKeySyms
without changingworkspaces
. However, if you do need to display the workspace names (you may want to see "1:db" comes first and associated withmod+1
), then you need to follow the next solution.Basically you need to hack
StackSet
inXMonad.StackSet
(https://github.com/xmonad/xmonad/blob/master/src/XMonad/StackSet.hs) to manipulate the binding between screens and workspaces. You need to write the code into astartupHook
in your config file so that it will be executed when xmonad is loaded.You may also need
XMonad.Actions.PhysicalScreens
if you want to specify right or left screens instead of screen IDs.I just start using xmonad, and I haven't done exactly what you want. I have similar needs, yet not only at xmonad startup. I try to hack both the startup procedure and the rescreen procedure (new monitor connected/disconnected), and hope you find some pieces of my configuration useful when you write yours. https://github.com/subbyte/subXMonad