桌面集成应用程序(类似桌面小部件)
我目前正在考虑为我的个人系统编写一个桌面集成应用程序,它的行为应该类似于通常的桌面小部件引擎(screenlet、gdesklet、google gadgets)。它应该让我对来自互联网的有关我的系统的不同信息有一个完整的概述,并且最终应该在我的桌面上可视化它们。它应该集中我所有日常必要的信息。
最简单的方法肯定是为已知的桌面小部件引擎之一编写自己的小部件,但我更愿意从头开始编写它。因此,我目前正在寻找一些实现提示,如何在桌面上构建一个全局视图,该视图没有由窗口管理器装饰边框、标题栏和其他内容,并且没有背景颜色。当需要 compiz 时,不需要特殊的透明度 X% 效果。
一个很好的例子是 conky 和额外的 libcario 支持绘图。我还会选择更大的 GUI 工具包,例如 GTK+ 或 QT。直接使用更复杂的 X11 API 接口也是一种选择。优选的语言是 C 和 C++。
如果有人能够分享他的知识,如果他在该领域已经有一些类似的经验,我会很高兴。
i'm currently playing with the idea writing a desktop-integrated application for my personal system, which should act similar like usual desktop widget engines (screenlets, gdesklets, google gadgets). It should give me a complete overview about different information about my system, from the internet and should finally visualize them on my desktop. It should centralized all my daily necessary information.
The easiest way would be surely to write my own widgets for one of the known desktop widget engines, but i would prefer to write it from the scratch. Therefore i'm currently looking for some implementation hints, how i can build a global view on the desktop that is not decorated with borders, titlebars and something else by the window manager and has no background color. Special transparency X% effects are not necessary, where compiz would be needed.
A good example for that would be conky with additional libcario support for drawing. I would also choose a bigger gui toolkit like GTK+ or QT. Direct Use for the more complex X11 API Interface would be also an option. Preferable languages are C and C++.
I would be glad if someone could share his knowledge if he has already some similar experiences in that field.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有两种方法可以构建无边框窗口:(1)完全绕过窗口管理器,以及(2)使用窗口管理器。
第一个很简单,但有限制(您必须自己管理窗口拖动和虚拟桌面上的放置)。这是通过使用
override-redirect
标志创建一个窗口来完成的。第二种方法涉及设置窗口属性(如
xprop
中),称为 WM 提示。如果您想使用原始 Xlib 来完成此操作,则需要为此研究ICCCM。大多数工具包(如 gtk+)都有用于设置 WM 提示的 API。对于简单的是或否“透明度”,有
XShape
API(这在技术上是一个扩展,即 X11 的可选部分,但它几乎无处不在)。或者,您可以创建一个背景设置为None
的窗口(但是,这种方法可能会在合成窗口管理器(即 Compiz)方面出现问题)。或者您可以完全避开应用程序窗口并直接在(虚拟)根窗口上绘制。大概 libcairo 会让你做同样的事情,但我不熟悉它。希望这有帮助。
There are two ways to build a borderless window: (1) completely bypassing the window-manager, and (2) using the window manager.
The first one is simple, but limiting (you'll have to manage e.g. window dragging and placement on virtual desktops yourself). It's done by creating a window with the
override-redirect
flag.The second method involves setting window properties (as in
xprop
) known as WM hints. If you want to do it with raw Xlib, you need to study ICCCM for that. Most toolkits like gtk+ have APIs for seting WM hints.For simple yes-or-no "transparency" there is the
XShape
API (this is technically an extension, that is, an optional part of X11, but it is present just about everywhere). Or you can just create a window with background set toNone
(this approach however can have issues with compositing window managers, i.e. Compiz). Or you can just eschew application windows altogether and paint directly on the (virtual) root window. Presumably libcairo would let you do the same, but I'm not familiar with it.Hope this helps.
你没有说你的目标操作系统是哪个,但我假设是 Linux 发行版。
首先,您的窗口管理器必须支持无边框和未装饰的窗口。
然后你需要选择语言(c和c++完全不同)。如果您选择
c++,那么 Qt 似乎是一个显而易见的选择。
对于 Qt,创建无边框窗口很容易: 用Qt制作无边框窗口
You didn't say which OS you are targeting, but I am assuming a linux distro.
First of all your window manager has to support borderless and undecorated windows.
Then you need to choose the language (c and c++ are completely different). If you opt for
c++, then the Qt seams like an obvious choice.
For Qt, it is easy to create a borderless window : Making a borderless window with for Qt