最小化到 gnome 面板
我有一个用 python 编写的应用程序,我希望它能够“最小化”到 gnome 面板,就像 gnome 的 rhytmbox 最小化到面板一样。这很容易做到吗?
我已经运行了 此处 中的示例,但未能使它们中的任何一个正常工作,并且这些示例似乎不正是我要找的。有什么好的起点吗?
I have an application written in python, I would like it to be able to "minimize" to the gnome panel, much like how gnome's rhytmbox minimizes to the panel. Is it easily possible to do this?
I've run the examples from here but failed to get any of them working and those don't seem to be exactly what I'm looking for. Any good places to start?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
链接的示例展示了如何编写面板小程序,这已经有一段时间了。相反,您可能想要创建一个 gtk.StatusIcon。状态图标要求用户有一个系统托盘,但考虑到它们的广泛使用几乎涵盖了每个人。
获得状态图标后,最小化到面板就很简单了:
activate
信号处理程序中;并window-state-event
,拦截 iconify 更改,以便您可以隐藏窗口而不是显示在任务栏中当然,使用这样的状态图标并不是真的从 UI 角度推荐,但它是目前最实用的解决方案。
The examples linked show how to write panel applets, which have been somewhat discouraged for a while now. Instead, you probably want to create a gtk.StatusIcon. Status icons require the user to have a system tray, but given their widespread use that covers just about everyone.
Once you've got your status icon, minimizing to the panel is a simple matter of:
activate
signal handler; andwindow-state-event
on your window, intercepting iconify changes so that you can hide your window instead of it being shown in the taskbarOf course, using a status icon like this isn't really recommended from a UI point of view, but it is the most pragmatic solution currently.