Conky: Display window title

When using a tiling window you often want to hide the title bar of windows to achive a nicer look and save some space. But at the same time you don’t want to miss important information which sometimes is only exposed through the name of a window which is displayed in the title bar by default. In i3 you can modify your status bar with conky, so why don’t display it there?

The following conky command will return the name of the currently selected window.

1${exec xprop -id $(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}') | awk '/_NET_WM_NAME/{$1=$2="";print}' | tr -s ' ' | awk '{print substr($0, 3, length($0) - 3)}'} 

Build into a complete conky script it will look like this:

 1out_to_x no
 2own_window no
 3out_to_console yes
 4double_buffer no
 5background no
 6update_interval 0.15
 7use_spacer left
 8
 9## Stuff after 'TEXT' will be formatted on screen
10TEXT
11[{"full_text": " "},
12  {"full_text": " ${exec xprop -id $(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}') | awk '/_NET_WM_NAME/{$1=$2="";print}' | tr -s ' ' | awk '{print substr($0, 3, length($0) - 3)}'} ", "name":"window"},
13  {"full_text": " ${time %a %d.%m.%y  %H:%M}","color":"\#6AFFD8 ", "name":"time"},
14  {"full_text": " "}
15],

Result:

Conky Window Title Result

Do you have questions? Send an email to max@maxammann.org