ActivityWatch / activitywatch

The best free and open-source automated time tracker. Cross-platform, extensible, privacy-focused.
https://activitywatch.net/
Mozilla Public License 2.0
11.32k stars 512 forks source link

[UI]: launching on tray icon doesn't check for existing tabs or PWA #1063

Open PetbkA opened 1 month ago

PetbkA commented 1 month ago

Describe the bug

As being seen in browser's omnibox, AW supports turning into Progressive Web App.

The problem is that the tray icon can't open AW as PWA - it still opens it as browser tab, whether PWA or browser tab has been already opened or not.

The same with browser tabs - double-clicking tray icon always opens new AW tab, even if it's tab has been already opened.

To Reproduce

  1. Open any of AW's pages;
  2. Double-click AW's tray icon: NOK - new AW browser tab opens instead of activating existing one;
  3. Leave one AW tab (close others) and install it's PWA;
  4. Double-click AW's tray icon: NOK - AW PWA window isn't being activated, and new browser tab opens instead;
  5. Close AW's PWA and all it's browser tab and repeat step 2: NOK - AW still opens in new browser tab.

Expected behavior

I suggest the following behavior on double-clicking AW tray icon:

PWA installed AW tab opened PWA launched Action
- - - New browser tab will be opened
- + - Browser tab will be activated. If there are several opened tabs, the latter will be activated
+ - - PWA will be launched
+ + - Browser tab will be activated. If there are several opened tabs, the latter will be activated
+ - + PWA window will be activated
+ + + PWA window will be activated