如何使用 Python 检查哪个窗口管理器正在运行?
我想检查用户正在使用哪个窗口管理器(如 GNOME 或 KDE 等)。我该怎么做?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我想检查用户正在使用哪个窗口管理器(如 GNOME 或 KDE 等)。我该怎么做?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
你不能。程序没有一个中心位置来注册自己来说“嗨,我是窗口管理器”。
例如,我正在运行 xmonad。我只需在我的
~/.xsession
文件中调用xmonad
以及其他几个程序来启动它,以便在我登录时启动它。你无法真正察觉到这一点。You can't. There is no central place where a program registers itself to say "hi, I'm the window manager".
For instance, I'm running xmonad. I simply start this by calling
xmonad
in my~/.xsession
file along with a couple of other programs to have it start when I login. You cannot really detect that.由于您显然使用的是 Linux,因此您可以使用 wmctrl -m 或 inxi -Sxx。
Since you're apparently using linux, you could use wmctrl -m or inxi -Sxx.