(Ruby || Python) 窗口管理器
我想用这些语言中的任何一种(最好是 ruby)制作一个窗口管理器。老实说,我不知道从哪里开始,只是我需要加载某种 X 模块。因此,如果有人有线索,如果你能为我指明正确的方向,那就太好了。谢谢
I want to make a window manager in either of these languages (Preferably ruby). I honestly have no idea where to start except that I will need some kind of X module to load. So if anyone has a clue it would be great if you could point me in the right direction. Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
XCB 是 X 的下一代 API,使用 XML 格式定义 X 协议并生成与脚本的特定语言绑定。它在概念上与 SWIG 类似,只不过它不是描述 C API,而是描述 X 协议。
目前,存在 C 和 Python 的绑定。理论上,Ruby 移植只需编写一个从 XML 协议定义语言到 Ruby 的转换器即可。生成的 Ruby 代码可以包装 C API,也可以用纯 Ruby 实现有线协议(我推荐后者)。
与阻塞 I/O 相关的传统 Xlib 相比,该 API 显然具有一些固有的优势。奇怪的是,它还有一个 Windows 端口。
http://xcb.freedesktop.org/
http://xcb.freedesktop.org//XcbPythonBinding/
http://xcb.freedesktop.org//win32port/
XCB, the next gen API for X uses an XML format to define X protocols and generates specific language bindings with a script. It's similar in concept to SWIG except that instead of describing C APIs, it describes X protocols.
Currently, bindings exist for C and Python. A Ruby port would theoretically be only a matter of writing a translator from the XML protocol definition language to Ruby. The generated Ruby code could either wrap the C API or implement the wire protocol in pure Ruby (I recommend the latter).
The API apparently has some inherent advantages over the legacy Xlib related to blocking I/O. It also has a Windows port, oddly enough.
http://xcb.freedesktop.org/
http://xcb.freedesktop.org//XcbPythonBinding/
http://xcb.freedesktop.org//win32port/
您是否看过http://ruby-xlib-wrap.sourceforge.net/。这似乎为 XLib 提供了 Ruby 绑定。
在尝试编写窗口管理器之前,您可能想尝试使用 XWindows。
为什么不从桌面开始,这样您可以获得一些经验。
Have you looked at http://ruby-xlib-wrap.sourceforge.net/. This appears to provide Ruby bindings for XLib.
You may want to experiment with using XWindows before trying to write a window manager.
Why not start with a desktop, so you can get some experience.
注意:
1)Awesome不是用lua编写的,而是用C编写的。它使用Lua作为脚本/配置接口。
2)Qtile和Samurai-X是两个用python编写的wm。
3)Subtle是一个使用ruby作为脚本语言的wm。
Qtile 和 Subtle 都是平铺窗口管理器。
Note:
1) Awesome is not written in lua, it's written in C. It uses Lua as a scripting/config interface.
2) Qtile and Samurai-X are two wm's are written in python.
3) Subtle is a wm that uses ruby as a scripting language.
Qtile and Subtle are both tiling window managers.
不是 Ruby 或 Python,但这些窗口管理器也是用很酷的语言编写的:awesome (Lua) 和 XMonad (Haskell)。也许你可以窥视它们的内部结构并了解它们是如何工作的。
Not Ruby or Python, but these window managers are also written in cool languages: awesome (Lua) and XMonad (Haskell). Maybe you can peek inside their internals and see how they work.