53
19
The linux commandline tool wmctrl
allows you to list all windows, or all desktops, among other things. In the desktop-listing mode, the current desktop is marked with an asterisk.
I need a tool that can figure out the currently active window's title. Unfortunately, wmctrl
doesn't have a helper that does this - despite it knowing which window is currently active (see :ACTIVE:
marker).
Is there another commandline tool that can give me the window id and/or window title of the current window?
Powerful tool! Apart from getting current active window, it also has lots of other useful functionalities. – Searene – 2014-10-10T01:25:00.860
Compared to Jim Paris's answer, this has the disadvantage of a dependency to install, but it seems to run faster, particularly if xdotool is already in the disk cache. – mc0e – 2015-01-08T07:52:51.963
1If you want to manipulate the current window with
wmctrl
, you could do:wmctrl -i -r \
xdotool getwindowfocus` -e 0,10,10,-1,-1, where
-i` tells wmctrl to expect the window id rather than the window title. – fiedl – 2015-01-21T01:29:10.940