[英]How can I change the window xmonad reparents from?
I have a small application listed below which simply makes an x window and a small window inside of it. 我在下面列出了一个小应用程序,它只是在其中创建了一个x窗口和一个小窗口。 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.
我后来计划制作一个实验性IDE,其中所有工具栏和菜单都是子窗口,并且可以选择要管理它们的任何窗口管理器。
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. 我想做的是启动一个xmonad实例,并使其不从根窗口重现并控制窗口,而是在我的应用程序窗口中重定并控制窗口。
Is this possible? 这可能吗?
PS Here's the app. PS这是应用程序。
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. 原则上,只需将xmonad中所有硬编码的根窗口引用替换为可以在启动时指定的窗口ID即可。 But unless xmonad already has that feature, you'd surely have to hack on the xmonad code to add it.
但是,除非xmonad已经具有该功能,否则您肯定必须破解xmonad代码才能添加它。
You could run your whole own X server and pretend your window is a root window - like Xephyr or Xnest. 您可以运行自己的整个X服务器,并假装您的窗口是根窗口,例如Xephyr或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.
这肯定比添加xmonad功能使用非根窗口要困难得多,但是它具有可以与任何窗口管理器一起使用的优点。
Another approach could be to just yank code out of xmonad and paste it into your app... 另一种方法可能是仅从xmonad中提取代码并将其粘贴到您的应用中...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.