How to Display Date and Time in the active window title?

Esben Mose Hansen kde at mosehansen.dk
Thu Feb 3 17:29:21 GMT 2005


On Thursday 03 February 2005 08:51, Markus Tacker wrote:
>    Hoi List,
>
>    I just want KDE to add the current date an time to my active window's
>    title bar.
>
>    Is this possible and how do i do it?

Well, a cron script and dcop should be able to do it, but not elegantly. I 
couldn't find an easy way to determine which window is active, but you can 
query indivudual windows easily enough:


esben at spurv mydvd $ sleep 3; dcop kmail 'kmail-mainwindow#1' isActiveWindow
true
esben at spurv mydvd $ sleep 3; dcop kmail 'kmail-mainwindow#1' isActiveWindow
false
esben at spurv mydvd $                                      

And setting the caption to include the current timestamp is easy as 1-2-3:

Get caption for kmail-mainwindow#1:
$ dcop kmail 'kmail-mainwindow#1' caption

Set caption for kmail-mainwindow#1
$ dcop kmail 'kmail-mainwindow#1' setCaption "My new caption"

Set caption to current date
$ dcop kmail 'kmail-mainwindow#1' setCaption $(date -u)

Append current date to caption:
$ dcop kmail 'kmail-mainwindow#1' setCaption "$(dcop kmail 
'kmail-mainwindow#1' caption) $(date -u)" 


If you are up for it, it should be doable. 

Cute idea, though. Consider adding it as a feature request to KWin.

-- 
regards. Esben
___________________________________________________
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.




More information about the kde mailing list