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.
Notice: this answer is based on my understanding of traditional X11. It is possible that this has changed with the introduction of compositing, in which case the following is wrong, but I believe it's still correct.
No, it's not possible to record what's happening on an inactive workspace.
When a workspace is "nonactive" (not shown), the windows it contains are all unmapped. The applications aren't getting expose events and therefore they aren't actually drawing anything (If an application draws a tree in a forest that isn't displayed anywhere, does the tree really exist?).
For your use case, I recommend that you run the application inside an Xvnc
server and record that. Example with auto-started session:
# Launch VNC server
vncserver -geometry 1024x768 :10
# Launch a viewer so you can see what you're doing in there
xvncviewer :10
Raw example (start Xvnc
directly, no security on VNC connections):
# Start VNC server
Xvnc -geometry 1024x768 :10 &
# Launch a viewer so you can see what you're doing in there
xvncviewer :10 &
# Set your display to the VNC server
DISPLAY=:10
# Launch the desired application in there as well as the recorder
xterm & # whatever your application is
xmonad & # if you want a window manager
my-screen-recorder &
Best Answer
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...