在Linux中以编程方式隐藏/显示窗口 [英] Programmatically hide/show a window in Linux

查看:329
本文介绍了在Linux中以编程方式隐藏/显示窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在各地寻找解决方案.

I've been searching all over the place for a solution to this.

如何显示/隐藏(或最小化/最小化)Linux窗口.

How can I show/hide (or minimize/unminimize if you rather) Linux windows.

我对使用任何语言的任何解决方案都感兴趣.

I'm interested in any solution in any language.

如果相关,我会使用Debian,Gnome,Metacity和Compton复合管理器

I use Debian, Gnome, Metacity and Compton composite manager if they're relevant

注意:我尝试使用wmctrl,但是wmctrltoggle,hidden功能已被破坏了一段时间,并且两年内未进行更新,因此不太可能在不久的将来工作.网路上充斥着与此有关的错误报告.

Note: I tried using wmctrl but the toggle,hidden feature of wmctrl has been broken for a while and it's not been updated in two years so unlikely to work any time soon. The net is full of bug reports concerning this.

推荐答案

您可以使用 xdotool :

$ xdotool search --name "Stack Overflo"
24415619
$ xdotool windowminimize 24415619

基本上,您首先会找到一个窗口(按标题,按活动状态等),该窗口为您提供其ID.然后,您调用命令.查找窗口的方法有很多,请参见联机帮助页.

Basically, you first find a window (by title, by active state etc.), which gives you its ID. Then you invoke commands. There are many ways to find a window, see the manpage.

xdotool可以作为软件包在Debian,Ubuntu和Fedora中租借.

xdotool is available as a package in at lease Debian, Ubuntu and Fedora.

注意:从此答案中偷偷偷窃: https://superuser.com/questions/186748/如何隐藏控制台或最小化x11-window-from-console

Note: Shamelessly stolen from this answer: https://superuser.com/questions/186748/how-to-hide-or-minimize-x11-window-from-console

这篇关于在Linux中以编程方式隐藏/显示窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆