Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show remaining time on tray mouse hover #3091

Open
Tracked by #3110
9z0 opened this issue Mar 19, 2024 · 16 comments
Open
Tracked by #3110

Show remaining time on tray mouse hover #3091

9z0 opened this issue Mar 19, 2024 · 16 comments

Comments

@9z0
Copy link

9z0 commented Mar 19, 2024

Problem Statement

I want to quickly know exactly how much time remains until the session/break ends

❔ Possible Solution

Show in a line below session title on mouse hover on the tray.

⤴️ Describe alternatives you've considered

I have to open the app.

Copy link

Thank you very much for opening up this issue! I am currently a bit overwhelmed by the many requests that arrive each week, so please forgive me, if I fail to respond personally. I am still very likely to at least skim read your request and I'll probably try to fix all (real) bugs if possible and I will likely review every single PR being made (please, give me a heads up if you intent to do so) and I will try to work on popular requests (please upvote via thumbs up on the original issue) whenever possible, but trying to respond to every single issue over the last years has been kind of draining and I need to adjust my approach for this project to remain fun for me and to make any progress with actually coding new stuff. Thanks for your understanding!

@johannesjo
Copy link
Owner

If someone wants to tackle this here is the electron documentation for it:
https://www.electronjs.org/docs/latest/api/tray

Copy link

This issue has not received any updates in 90 days. Please comment, if this still relevant!

@github-actions github-actions bot added the Stale label Jul 21, 2024
@9z0
Copy link
Author

9z0 commented Jul 23, 2024

Not stale

@github-actions github-actions bot removed the Stale label Jul 25, 2024
Copy link

This issue has not received any updates in 90 days. Please comment, if this still relevant!

@github-actions github-actions bot added the Stale label Nov 22, 2024
@panoramix360
Copy link
Contributor

Is this ticket available to work with?

Just to understand, the idea is to show the time when you mouse-over the Super Productivity Icon on the system tray?

This probably needs to behave different depending on the environment.

I don't think in MacOS you will be able to see something when mouse-over the icon, we could just show the timer there together with the name of the task being worked on.

Can you describe a little more the idea behind it?

I can try working on it.

@johannesjo
Copy link
Owner

@panoramix360 that is great to hear! Not sure if this is possible for most platforms. We're already using setTooltip for platforms other than mac, but that does not work everywhere (anywhere?).

https://www.electronjs.org/docs/latest/api/tray

@panoramix360
Copy link
Contributor

@johannesjo, just to understand:

On Mac

  • Show a timer on the tray icon on the top when you begin a timer, right?

On other envs

  • Add just a tooltip to show the current time

Is the above correct?

@johannesjo
Copy link
Owner

Each platform behaves differently @panoramix360 and the electron apis don't work everywhere.

The relevant code is in electron/indicator.ts.

@panoramix360
Copy link
Contributor

Going back to work on this, happy new Year!

@tegridyfarmer
Copy link

Showing the remaining minutes/hours in the icon could also be an idea.
I am curious what other people think of this idea.

@panoramix360
Copy link
Contributor

hey @johannesjo and @tegridyfarmer

I just built this really fast as a proof of concept, is that something close to what you were looking for?

Screen.Recording.2025-02-03.at.21.23.22.mov

@tegridyfarmer
Copy link

Yes that looks great!

@johannesjo
Copy link
Owner

This is great @panoramix360 ! How did you achieve that and what OS are you on?

@panoramix360
Copy link
Contributor

panoramix360 commented Feb 4, 2025

hey! Glad that you liked it!

This is on the MacOS environment, I still need to test in other environments, but I believe they will need to work differently.

But for the MacOS, I did a really fast POC adding a setInterval when the Tray is created, that runs on each 1000ms until the countdown is over, don't think this will impact too much performance either, it's simple:

updateTray();

  const timer = setInterval(() => {
    countdown--;
    updateTray();

    if (countdown <= 0) {
      clearInterval(timer);
      tray.setTitle('Countdown finished!');
    }
  }, 1000);

  // eslint-disable-next-line prefer-arrow/prefer-arrow-functions
  function updateTray(): void {
    const minutes = Math.floor(countdown / 60);
    const seconds = countdown % 60;
    tray.setTitle(
      `Time left: ${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`,
    );
  }

I didn't integrated this yet with the Pomodoro timer of the tasks.

I wanted to get your feedback first before implementing a more robust solution.

Should I finish the implementation connecting this up with the timer of the tasks? Is there any other timer in the application?

I'm thinking of adding empty strings in the suffix and prefix of the timer so we don't see the text "jumping" too much, but I'll need to try this out.

Other envs

For the other envs, what I can try to do is update the tooltip in each second with the countdown, they don't have a title to update like MacOS, as you can see on the docs:

Image

@johannesjo
Copy link
Owner

johannesjo commented Feb 5, 2025

This is on the MacOS environment

Ah alright! Some confusion on my part, since I somehow thought this would also apply to linux and was surprised this works. But no problem. I am also very happy with improving this for macos only!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants