Repository: ubuntu/gnome-shell-extension-appindicator

Issue #516: First click after startup is treated as both a single click and a double click
Created: 2024-04-05T05:02:01Z
Current behavior
After the first single click, two actions trigger:

single click -> open menu
code is confused into thinking there's a double click -> open app


Expected behavior: single click should only open menu

Code diagnosis
Looking at the code, the problem is that both vfunc_button_press_event and vfunc_button_release_event call _maybeHandleDoubleClick the first time around, so a press+release becomes a double click. But the second time, this._indicator.supportsActivation has been set to true instead of undefined, so vfunc_button_release_event doesn't trigger the double click.

  
    
      gnome-shell-extension-appindicator/indicatorStatusIcon.js
    
    
        Lines 423 to 428
      in
      03a7412
    
  
  
    

        
          
           vfunc_button_release_event(event) { 
        

        
          
               if (!this._indicator.supportsActivation) 
        

        
          
                   return this._maybeHandleDoubleClick(event); 
        

        
          
            
        

        
          
               return Clutter.EVENT_PROPAGATE; 
        

        
          
           } 
        
    
  


I can hack the code to make the issue go away with an extra this._indicator.supportsActivation !== undefined, but I'm not sure what the intent of this code was, so I'm not sure what the right fix is.
    vfunc_button_release_event(event) {
        if (this._indicator.supportsActivation !== undefined && !this._indicator.supportsActivation)
            return this._maybeHandleDoubleClick(event);

        return Clutter.EVENT_PROPAGATE;
    }

The current behavior of supportsActivation == false seems strange:

Any single click hits _maybeHandleDoubleClick in both press and release
_maybeHandleDoubleClick short circuits with return Clutter.EVENT_PROPAGATE, making the logic in vfunc_button_release_event pointless. 
  
    
      gnome-shell-extension-appindicator/indicatorStatusIcon.js
    
    
        Lines 355 to 357
      in
      03a7412
    
  
  
    

        
          
           _maybeHandleDoubleClick(event) { 
        

        
          
               if (this._indicator.supportsActivation === false) 
        

        
          
                   return Clutter.EVENT_PROPAGATE; 
        
    
  



I suspect the right fix might just be to delete the vfunc_button_release_event logic. I confirm deleting the whole function works for me, but I unfortunately don't seem to have any apps for which supportsActivation == false, so I don't know how to test it works in general.

Duplicate issue #490: Clicking the system tray icon will bring up the application.
Created: 2023-11-18T13:06:31Z
When I first clicked on the system tray icon, it always brought up the application before opening the tray menu.   But when I close the app and click the system tray icon again, it will go back to normal (only the tray menu will pop up, not the application).
Shell Version: bash 5.2.15
Extension Version: latest git
The indicator that caused the bug:

VLC
Qbittorrent
Element Desktop
Telegram Desktop
OBS Studio
Steam
...
This is true for almost all common applications with system trays.

Closing comment (2024-04-11T05:32:44Z): I believe this is the same as #516 and should be fixed by #519. (I missed this ticket earlier when filing mine.)