Re: [dev] Find window with dmenu

From: Andreas Amann <>
Date: Tue, 12 Feb 2013 16:40:55 +0100

On Tue, Feb 12, 2013 at 10:36:27AM +0100, Thomas Dean wrote:

> all the unwanted windows in the list. See the attached scripts. Does anyone
> know a solution for this? Is there an existing tool that lists all
> "visible" windows along with their id?

the ids of visible windows is stored in the _NET_CLIENT_LIST property of the
root window and can be accessed with "xprop -root _NET_CLIENT_LIST"

The followning script lets you select one with dmenu and then focus it:


declare -i active_id
declare -i win_id

winlist=$(xprop -root _NET_CLIENT_LIST|cut -d "#" -f 2|tr "," " ")
count=$(echo $winlist|wc -w)
active_id=$(xprop -root _NET_ACTIVE_WINDOW|awk -F' ' '{ print $NF }')
foo=$(for i in $winlist; do
        if [ $win_id -eq $active_id ]; then
                focustag=" "

        win_class=$(xprop -id ${win_id} WM_CLASS | cut -d'"' -f2)
        win_title=$(xprop -id ${win_id} WM_NAME | cut -d'=' -f2-)
        printf "%10.10s${focustag}| %60.60s | 0x%7.7x\n" "${win_class}" "${win_title}" "${win_id}"
done |sort| dmenu -i -l $count)

if [ $? -eq 0 ]; then
        xdotool windowactivate $(echo $foo | awk -F'|' '{ print $NF }')
Received on Tue Feb 12 2013 - 16:40:55 CET

This archive was generated by hypermail 2.3.0 : Thu Feb 21 2013 - 19:19:39 CET