Now Reading
weblog/timers.md at primary · madprops/weblog · GitHub

weblog/timers.md at primary · madprops/weblog · GitHub

2023-05-17 02:00:31

Currently I have been utilizing timers each day.

By that I imply timeouts, for instance 20 minutes:

  • Begin at 20 minutes

  • Slowly goes all the way down to 0

But it surely principally is sensible if I add a visible widget for it.

So I constructed one baked into my wm:

This seems on the panel as soon as I begin a timer.

It is going to replace each second.

Finally it goes into seconds:

Then it reaches 0 and disappears.

Actions

I can map a perform as an motion for when the timer is finished.

It may be a easy “Timer Ended” message, or an motion like “droop the pc”.

Now I do not droop the pc instantly, I activate a 60 or 90 minute timer.

Which supplies me time to return and verify one thing with out having to show the pc on.

Time to Assume

I have been utilizing timers earlier than releasing new variations of software program.

Earlier than, I might publish just about instantly pondering there’s nothing extra to do.

However now I begin a timer relying on how assured I’m concerning the adjustments.

The larger the change the upper the timer.

And I will not think about releasing the model till the timer ends.

This offers me time to check the applying and discover flaws or lacking issues.

And it really occurs fairly often, that I discover issues so as to add or polish.

Mouse Wheel

An attention-grabbing function I added to the timer widget, that I really use so much.

I can use the mousewheel when hovering the widget to extend or lower the timer.

It will increase or decreases by 5 minutes.

And it’ll spherical to the closest 5 minute step.

As an example: 3 minutes -> 5 minutes -> 10 minutes -> quarter-hour.

It permits me to regulate how a lot I am prepared to attend for one thing.

Is determined by my judgment if a timer ought to enhance or lower.

The minimal is 1 minute, it will not go beneath it with the mousewheel.

Center Click on

Center clicking the widget cancels the timer.

A number of Timers

Any variety of timers may be began.

So long as they’ve a distinct identify:

See Also

Counters

The timer widget/library additionally helps “counters”.

These are the other. They begin at 0 and go upwards.

They do not finish or run a perform, they simply maintain going till stopped.

Code

Some code of how I begin the timers with my wm:

perform auto_suspend(minutes)
  autotimer.start_timer("Droop", minutes, perform() 
    droop() 
  finish)
finish

perform timer(minutes)
  autotimer.start_timer("Timer", minutes, perform() 
    msg("Timer ended") 
  finish)
finish

perform counter()
  autotimer.start_counter("Counter")
finish

Different Makes use of

It is also helpful for measuring non-computer actions.

Like ready for meals or drinks to be prepared.

Beginning Timers

Since my wm may be known as by way of a particular program, I could make a python script to start out timers.

I made a script that makes it straightforward to detect if I would like hours, minutes, or seconds.

So I can simply begin a 20 minute timer, or a 5 second timer.

And I can do it instantly from my launcher:

Mounted Width

Like I normally do with my widgets, I attempt to maintain a non-dynamic width on them.

1.5 hrs, 30 minutes, 05 secs, all of them occupy the identical width.

So when altering items there is not any motion within the panel.

I do that through the use of the identical variety of characters with a monospace font.

Repo

The code for autotimer is here.

The python script is here.

Source Link

What's Your Reaction?
Excited
0
Happy
0
In Love
0
Not Sure
0
Silly
0
View Comments (0)

Leave a Reply

Your email address will not be published.

2022 Blinking Robots.
WordPress by Doejo

Scroll To Top