I have a small application listed below which simply makes an x window and a small window inside of it. I later plan to make an experimental IDE where all the toolbars and menus are subwindows and one can choose whatever window manager one wants to manage them.
What I would like to do is startup an xmonad instance and make it not reparent and control windows from the root window but to reparent and control windows inside my application's window.
Is this possible?
P.S. Here's the app.
module Main where
import Graphics.X11.Xlib
y f = w where w = f w
main = do
display <- openDisplay ""
let screen = defaultScreen display
root <- rootWindow display screen
mainWindow <- createSimpleWindow
display
root
0 0 100 100
1
(blackPixel display screen)
(whitePixel display screen)
setTextProperty display mainWindow "Subwindows" wM_NAME
subWindow <- createSimpleWindow
display
mainWindow
0 0 100 100
1
(whitePixel display screen)
(blackPixel display screen)
mapWindow display subWindow
mapWindow display mainWindow
y $ \loop -> allocaXEvent $ \eventPointer -> do
nextEvent display eventPointer
event <- get_EventType eventPointer
case () of
_ | event == expose -> loop
| otherwise -> return ()
In principle "just" a matter of replacing all hardcoded root window references in xmonad with a window ID that could be specified on startup. But unless xmonad already has that feature, you'd surely have to hack on the xmonad code to add it.
You could run your whole own X server and pretend your window is a root window - like Xephyr or Xnest. That's surely much harder than adding the xmonad feature to use a non-root window, but it has the advantage that it would work with any window manager.
Another approach could be to just yank code out of xmonad and paste it into your app...