我正在撰寫一個打開鉻標簽的腳本。我需要一個關閉該選項卡的命令。
uj5u.com熱心網友回復:
Xdotool - 視窗
xdotool 是從終端或腳本中使用的實用程式,用于手動執行鍵盤、滑鼠和視窗輸入(請參閱 Xdotool – 鍵盤和 Xdotool – 滑鼠文章)。這些命令還可用于制作許多 xdotool 命令的腳本以創建大型任務。后面的文章將介紹 xdotool 控制桌面操作的能力。
xdotool 的語法取決于所使用的命令。第一個但非常強大的命令是“搜索”。語法如下:
搜索 [選項] 模式
搜索命令有助于查找系統上的特定視窗。
有十二個可供搜索的選項,它們是:
--class class_name – name of the window's class
--classname classname_name – name of the window's classname
--name name – title of the window
--maxdepth N – recursive search for window, default is -1 meaning infinite (all child windows too) and 0 means top windows only, depth of 1 or more can get most windows
--onlyvisible – results show only windows which are visible which have the IsViewable state
--pid PID_NUM – process ID number of the window
--screen N – number of the monitor on which the window is open (0 is first monitor, but defaults to all available screens)
--desktop N – number of the desktop or workspace
--limit N – maximum number of results to display. Default is no limit (--limit 0)
--all – requires that all conditions for a match are met when multiple options are specified
--any – requires that any condition is true when specifying multiple options
--sync – halt all commands until previous commands produce results
注意:要查找類和類名,請在終端中使用命令“xprop”。鍵入后,滑鼠游標會更改以允許用戶單擊視窗。選擇后,“xprop”會顯示有關所選視窗的資訊。標有“WM_CLASS(STRING)”的行顯示了兩個條目。第一個條目稱為實體或類名,第二個是類名。兩者可能相同,除非與 Gedit 一樣:
uj5u.com熱心網友回復:
嘗試這個:
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/504696.html