Project

General

Profile

Connected time

Added by Daniel Kempton about 3 years ago

I want to add a connection timer to my statusbar.

Here is the code I am using:

on *:START:{
statusbar -a duration "" "" Duration : $duration($onlineserver)
statusbar -a version "" "" Version : $version ( $+ $builddate $+ )
}

Three questions:

1. Why does duration appear after version?
2. How do I get it to update the statusbar when I change servers - ie. I am connected to more than one server at a time. The statusbar correctly reflects the correct server.
3. How do I get the statusbar to update duration?

Thanks.


Replies (1)

RE: Connected time - Added by Per Amundsen about 3 years ago

1. I am not able to reproduce duration appearing after version with this script.

2. The text you add to a Statusbar item is a fixed text, if you want a new text, you'll have to change it.
In this case you want to update the duration, so you will have to use a timer, example:

on *:START:{
  statusbar -a duration "" "" Duration : $duration($onlineserver)
  statusbar -a version "" "" Version : $version ( $+ $builddate $+ )
  .timer 0 1 updateduration
}

alias -l updateduration { statusbar -g duration $duration($onlineserver) }

Depending on what interval you set the timer to (every second in this example), you can also make it update the text when the active window changes.

Example:

on *:ACTIVE:*:updateduration
    (1-1/1)