Programmaticaly在Linux中隐藏/显示窗口
问题描述:
我一直在寻找解决这个问题的所有地方。Programmaticaly在Linux中隐藏/显示窗口
如何显示/隐藏(或最小化/取消最小化,如果你宁愿)Linux的窗口。
我对任何语言的任何解决方案感兴趣。
我使用Debian,侏儒,Metacity的和康普顿复合经理,如果他们相关
注:我尝试使用wmctrl
但wmctrl
的toggle,hidden
功能已被打破了一段时间,它不是两个更新几年如此之久不太可能在短时间内工作。网络充满了有关这方面的错误报告。
答
您可以使用xdotool:
$ xdotool search --name "Stack Overflo"
24415619
$ xdotool windowminimize 24415619
基本上,你先找到一个窗口(按标题,由活动状态等),它给你的ID。然后你调用命令。有很多方法可以找到一个窗口,请参阅联机帮助页。
xdotool作为租赁Debian,Ubuntu和Fedora的软件包提供。
注:从这个答案无耻被盗:https://superuser.com/questions/186748/how-to-hide-or-minimize-x11-window-from-console
答
也许你可以尝试这样的事情。它使用xsltool建议的@sleske。我使用xbinkeys将脚本绑定到鼠标按钮。
#!/bin/bash
file=/tmp/last_active_window
if [[ -s $file ]] ; then
xdotool windowmap `cat $file`
cat /dev/null > $file
else
wid=`xdotool getactivewindow`
xdotool windowunmap $wid
echo $wid > $file
fi
Mundo酷,花了几分钟把我的头围绕它。 – thebunnyrules 2017-12-21 08:09:41