This forum has been archived. All content is frozen. Please use KDE Discuss instead.

[SOLVED] List programs in the taskbar

Tags: None
(comma "," separated)
dmonty
Registered Member
Posts
14
Karma
0
Is there a way to get a list of programs in the taskbar from the command line?

e.g.

firefox_bin:Google - Mozilla Firefox
kate:Default Session
konsole:dmonty@vs1

If I just use `ps` I don't get the window title text.

---
User avatar
msoeken
Mentor
Posts
300
Karma
4
OS
Are you familiar with C++? Then take a look at /usr/include/taskmanager/taskmanager.h.


Image
[size=x-small]code | [url=cia.vc/stats/author/msoeken]cia.vc[/url] | [url=kde.org/support]donating KDE[/url] | [url=tinyurl.com/cto4ns]wishlist[/url][/size]
User avatar
Zarin
KDE Developer
Posts
345
Karma
8
OS
If you do not have access to Xlib directly and want to use shell commands you will need to do the following:

xprop -root | grep _NET_CLIENT_LIST(WINDOW)

Then parse that and query every window ID with:

xprop -id | grep WM_NAME(STRING)

And parse that result as well. =)

Chances there is a script around that already does this. Google.

Last edited by Zarin on Sat Feb 07, 2009 2:33 am, edited 1 time in total.
User avatar
msoeken
Mentor
Posts
300
Karma
4
OS

[SOLVED] List programs in the taskbar

Sat Feb 07, 2009 10:49 am
This prints each window of the taskbar in one line.

Code: Select all
for w in `xprop -root | grep _NET_CLIENT_LIST(WINDOW) | sed -e "s/.*# //" | sed -e "s/,//g"`
do
  xprop -id $w | grep WM_NAME(STRING) | sed -e "s/.*"(.*)"/\1/"
done


Image
[size=x-small]code | [url=cia.vc/stats/author/msoeken]cia.vc[/url] | [url=kde.org/support]donating KDE[/url] | [url=tinyurl.com/cto4ns]wishlist[/url][/size]
User avatar
Zarin
KDE Developer
Posts
345
Karma
8
OS

[SOLVED] List programs in the taskbar

Sat Feb 07, 2009 10:58 am
Hmm, that also displays windows that do not want to be displayed on the taskbar. You will need to have a condition that checks _NET_WM_STATE to see if it contains _NET_WM_STATE_SKIP_TASKBAR.

... And another one to check if WM_TRANSIENT_FOR is set as well (Transient windows are not displayed in the taskbar).

Last edited by Zarin on Sat Feb 07, 2009 11:00 am, edited 1 time in total.
dmonty
Registered Member
Posts
14
Karma
0
Perfect! This does the trick!

I love Linux support!


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]