Getting the name of the top-level or focused window in KDE
Hello.
I want to send into a file the top-level window, or the focused window currently in use under KDE. Is there a way to capture such informaton at any time ? Thanks. |
I am not sure what your question is and as no-one has replied forgive me for my attempt.
If you want to capture the output of a command in a window ...generally this is achieved by Code:
command > /pathwaytosavefile/newfilename $ ls > /home/gordy/ls gordy@siduxbox:~$ cat ls 01dox 2008-08-27-09-03-31.011-VirtualBox-3329.log Desktop firefox ls |
Thank you for your reply but I'm already familiar with stream redirection.
I want to know if the focused window in KDE (or in X for that matter), say my web browser currently used to respond to you, is available by some command that would put its name into a file. Of course, it would be a background job (by cron for instance) because if I actually used the command line, I'd always have "xterm" or "konsole" on the ouput. ;-) (Using Firefox) % some_script_running_by_cron > my_file. % cat my_file Firefox. A list of the windows stack would be interesting. I found a more generic command that helped me: % ps -A | cut -c25- | sort | uniq But I need to clean up the final list by removing non-X processes. And it doesn't tell me which is the current one (i.e. top-level) used in X. Cheers. |
Maybe dcop can do what you want?
http://www.linuxformat.co.uk/wiki/in...9.tut_dcop.pdf |
I suspected that KDE had the power to do that through DCOP.
Don't know how to control it to get what I want but I'll try. Cool tutorial, BTW. Thanks. |
Perhaps this is of some use? http://www.oreillynet.com/linux/blog...y_time_go.html
The C code in its current form outputs the name of the window which has focus to standard output once a second. For example, I just ran it for a little while, and got this output: Code:
pwc101@example:~> watch_focus |
Impressive. Right on the button. The author also gives an *actual legitimate use for it* ;-)
Cheers. |
All times are GMT -5. The time now is 10:35 AM. |