2011-03-16 124 views
4

我可以使用在Ubuntu上運行wine的wmctrl關閉窗口嗎?使用wmctrl關閉窗口

對於背景:

$ wmctrl -m 
Name: compiz 
Class: N/A 
PID: N/A 
Window manager's "showing the desktop" mode: OFF 

另外:

$ wmctrl -l 
0x0240a3be -1 mjol N/A 
0x02000003 0 mjol Top Expanded Edge Panel 
0x0200004c 0 mjol Bottom Expanded Edge Panel 
0x01e00024 0 mjol x-nautilus-desktop 
0x04800253 0 mjol using wmctrl to close windows - Stack Overflow - Google Chrome 
0x03c0c8c3 0 mjol Terminal 
0x03c53f25 0 mjol Terminal 
0x04400001 0 mjol Untitled - SketchUp 
0x04400003 0 mjol Instructor 
0x04400009 0 mjol SketchUp 

我想關閉該窗口是最後一個:

0x04400009 0 mjol SketchUp 

我已經試過如下:

$ wmctrl -c "SketchUp" 

$ wmctrl -c 0x04400009 

$ wmctrl -i 0x04400009 

$ wmctrl -c -i 0x04400009 

但沒有任何工作。

回答

6

也許有點晚,但現在首先看到。 閱讀wmctrl的信息,它說在actions之前的正確語法是'options',並且-i是一個選項,-c是一個動作。嘗試wmctrl -i -c 0x04400009

0

the man page,您應該選擇窗口首先使用選擇選項,如-r-a,爲例:

$ wmctrl -l  
0x01800006 0 hostname Terminal - byobu 

$ wmctrl -a Terminal 

這裏確實選擇(並引發+焦點由於-a)的終端窗口。

然後你可以使用一個調整大小/移動選項,如-e gravity,X,Y,width,height

至於你的問題,我只是測試這一點:

$ wmctrl -l        
0x01800006 0 machine_hostname - byobu 
0x06800002 0 moe Microsoft Excel - Classeur1 

和Excel(在葡萄酒顯然運行)正常關閉,當我進入

$ wmctrl -c Microsoft 

大量的額外信息here