GJ.*_*GJ. 16 linux gnome window-manager ubuntu
我有一个特定的工作环境,有几十个打开的 Windows。如何以编程方式或使用命令行将具有已知名称/标题的窗口置于前面?
好吧,在sudo apt-get install wmctrl-ing之后,您可以使用这个 bash 脚本:
#! /bin/bash
WINTITLE="Mail/News" # Main Thunderbird window has this in titlebar
PROGNAME="mozilla-thunderbird" # This is the name of the binary for t-bird
# Use wmctrl to list all windows, count how many contain WINTITLE,
# and test if that count is non-zero:
if [ `wmctrl -l | grep -c "$WINTITLE"` != 0 ]
then
wmctrl -a "$WINTITLE" # If it exists, bring t-bird window to front
else
$PROGNAME & # Otherwise, just launch t-bird
fi
exit 0
Run Code Online (Sandbox Code Playgroud)
我在这里找到的