Closed Bug 954303 Opened 10 years ago Closed 10 years ago

Single click (not double click) on tray icon should toggle the Buddy List

Categories

(Instantbird Graveyard :: Contacts window, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: aleth, Assigned: clokep)

Details

Attachments

(1 file, 2 obsolete files)

*** Original post on bio 870 at 2011-06-29 14:08:00 UTC ***

Current behaviour: Double click on system tray icon opens buddy list window, and removes the system tray icon

Standard (and therefore expected) behaviour for system tray apps: Single click on tray icon shows/hides the buddy list window, i.e. acts as a toggle.

Related: Bug 954183 (bio 749) https://bugzilla.mozilla.org/show_bug.cgi?id=954183 (bio 749)
*** Original post on bio 870 at 2011-06-29 14:21:39 UTC ***

https://bugzilla.instantbird.org/attachment.cgi?id=592 is an extension I made that implements single click behavior, but the tray icon still disappears (That's a separate bug, bug 954183 (bio 749), as you pointed out).

I disagree that the "standard behavior" is a single click opening/minimizing the application. Every single application in my system tray currently shows a menu on a left or right single click and only restores when double left clicked (including a bunch of Microsoft applications, I should note). I think we should abide by this.

It's possible on Linux the expectation is different, but I recall it being the same. Is this only for Linux? (Yes I know you filled in Linux as your system, but the report is unclear whether you're asking for this change for both Windows & Linux or just Linux.)
*** Original post on bio 870 at 2011-06-29 17:32:22 UTC ***

I didn't know about the expectation for Windows, which is why I filed the bug for Linux only. Certainly on KDE 4 all the apps in the systray have the single-click-toggle behaviour (Akregator, KAlarm, Klipper, Pidgin are the ones I looked at). As far as I recall it was the same in Gnome. (Ubuntu of course does its own thing with the messaging menu.) 

It might be possible to differentiate between single/double click depending on the OS as the systray-interfacing code differs anyway at the lowest level. (Certainly not the most important systray issue though...)
*** Original post on bio 870 at 2011-06-29 17:47:28 UTC ***

Thanks for the extension btw - you should put it on the add-on site! (Of course, for now, the disappearing systray icon makes it less useful than it will be).
*** Original post on bio 870 by Kissaki <kissaki0 AT googlemail.com> at 2011-07-02 01:35:01 UTC ***

IMO if there is no useful function for single-leftclick it should use single-leftclick for show/hide.

My expectation was/is that it shows/hides on single click as nothing else happens and because most of my tray icons behave that way.

For Windows Reference: MS Security Essentials displays a menu on single leftclick which has the only option "Open", so this is probably a policy. Double leftclick will show/hide.
*** Original post on bio 870 by Sander Lepik <sander.lepik AT eesti.ee> at 2011-07-03 14:06:41 UTC ***

Why is this bug UNCONFIRMED?
*** Original post on bio 870 at 2011-07-03 14:21:42 UTC ***

(In reply to comment #4)
> IMO if there is no useful function for single-leftclick it should use
> single-leftclick for show/hide.
> 
> My expectation was/is that it shows/hides on single click as nothing else
> happens and because most of my tray icons behave that way.
> 
> For Windows Reference: MS Security Essentials displays a menu on single
> leftclick which has the only option "Open", so this is probably a policy.
> Double leftclick will show/hide.
Right, this is the same behavior I see on Windows.

(In reply to comment #3)
> Thanks for the extension btw - you should put it on the add-on site! (Of
> course, for now, the disappearing systray icon makes it less useful than it
> will be).
I'm not really interested in supporting that extension, but it should still work fine. If someone else would like to support it, I'll upload it and add them as a developer.

(In reply to comment #5)
> Why is this bug UNCONFIRMED?
Because it hadn't been confirmed yet?

My plans for this bug:
Support single vs. double click via a preference. On Linux, use single click automatically, on Windows, use double click automatically. Provide no UI to change it since we're abiding by the expected behavior (according to the operating system).
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached patch Patch v1.0 (obsolete) — Splinter Review
*** Original post on bio 870 as attmnt 730 at 2011-07-03 14:57:00 UTC ***

This implements the plan from comment 6: Linux defaults to single click, Windows defaults to double click, changeable via a hidden preference.
Attachment #8352472 - Flags: review?(florian)
Assignee: nobody → clokep
Status: NEW → ASSIGNED
*** Original post on bio 870 at 2011-07-05 10:43:44 UTC ***

Comment on attachment 8352472 [details] [diff] [review] (bio-attmnt 730)
Patch v1.0

>diff --git a/instantbird/components/mintrayr/content/mintrayr.js b/instantbird/components/mintrayr/content/mintrayr.js

>@@ -54,23 +57,30 @@ var gMinTrayR = {

>     if (aEvent.type == "TrayClick" && aEvent.button == 2) {
>+      // Handle a single right click (show context menu).
>       this.menu.showPopup(document.documentElement,
>                           aEvent.screenX, aEvent.screenY,
>                           "context", "", "bottomleft");
>     }
>-    else if (aEvent.type == "TrayDblClick" && aEvent.button == 0)
>+    else if (aEvent.type == type && aEvent.button == 0) {
>+      // Handle left click, restore (by default) on a single click in Linux and
>+      // a double click in Windows.
>       this.restore();
>+    }

2 concerns:

1. If singleclick is true and I double click the icon, what happens?
If TrayClick is fired before TrayDblClick, this is fine. If not, you are in trouble ;).

Would this code work?
    else if (aEvent.button == 0 &&
             (aEvent.type == "TrayDblClick" ||
              Services.prefs.getBoolPref("extensions.mintrayr.singleclick")))

2. If a double click is required, should a simple click open the menu, rather than do nothing? (I'm OK with taking this patch without addressing this if this uselessly complicates the code, but I think it should be at least considered).

If we want to support this, we could write:
let singleClick = Services.prefs.getBoolPref("extensions.mintrayr.singleclick");
if (aEvent.type == "TrayClick" && (aEvent.button == 2 || !singleClick))
  menu
else if (aEvent.button == 0 && (singleClick || aEvent.type == "TrayDblClick"))
  restore

Is singleClick explicit enough for the pref name, or show we make it something like singleClickRestore?


If the TrayClick event doesn't behave the same on both platforms in case of a double click, we have a bigger issue :-/.
*** Original post on bio 870 at 2011-07-05 14:31:30 UTC ***

FYI In KDE, a double click seems to act like a single click. A context menu appears on right click. Exception: Some tray apps (like Klipper) have their entire functionality in a menu (so there is no window to open) - this then also appears on single click (though I suspect it is configurable...)
Attached patch v2.0 (obsolete) — Splinter Review
*** Original post on bio 870 as attmnt 732 at 2011-07-05 17:28:00 UTC ***

(In reply to comment #8)
> 2 concerns:
> 
> 1. If singleclick is true and I double click the icon, what happens?
> If TrayClick is fired before TrayDblClick, this is fine. If not, you are in
> trouble ;).
This works OK (the icon disappears on the first click and my second click ended up on a different program).

> Would this code work?
>     else if (aEvent.button == 0 &&
>              (aEvent.type == "TrayDblClick" ||
>               Services.prefs.getBoolPref("extensions.mintrayr.singleclick")))
Yes, and this is essentially what I've ended up using because...

> 2. If a double click is required, should a simple click open the menu, rather
> than do nothing? (I'm OK with taking this patch without addressing this if this
> uselessly complicates the code, but I think it should be at least considered).
Yes, it should, but this breaks the double click code, so I haven't included the || !singleClick part (it's possible we could use a timer, etc. to show the menu if a left click is used, but that's really messy and kind of unnecessary.)

> Is singleClick explicit enough for the pref name, or show we make it something
> like singleClickRestore?
That sounds a bit better, I'll change it to that.

> If the TrayClick event doesn't behave the same on both platforms in case of a
> double click, we have a bigger issue :-/.
Hopefully it does, this will need some testing on Linux (looking at the mintrayr code, it should though).
Attachment #8352474 - Flags: review?(florian)
Comment on attachment 8352472 [details] [diff] [review]
Patch v1.0

*** Original change on bio 870 attmnt 730 at 2011-07-05 17:28:12 UTC was without comment, so any subsequent comment numbers will be shifted ***
Attachment #8352472 - Attachment is obsolete: true
Attachment #8352472 - Flags: review?(florian)
Comment on attachment 8352474 [details] [diff] [review]
v2.0

*** Original change on bio 870 attmnt 732 at 2011-07-05 18:36:11 UTC ***

Well, ok... I dislike that code both before and after the change, but that's not a valid reason to block your work here :).
Attachment #8352474 - Flags: review?(florian) → review+
*** Original post on bio 870 as attmnt 734 at 2011-07-05 19:08:00 UTC ***

Mook pointed out (on IRC) that my comment was for a different version (where a single left click would also show the menu), this only fixes the comment and thus I'm carrying the review over from Attachment 8352474 [details] [diff] (bio-attmnt 732).
Attachment #8352476 - Flags: review+
Comment on attachment 8352474 [details] [diff] [review]
v2.0

*** Original change on bio 870 attmnt 732 at 2011-07-05 19:08:44 UTC was without comment, so any subsequent comment numbers will be shifted ***
Attachment #8352474 - Attachment is obsolete: true
*** Original post on bio 870 at 2011-07-07 19:58:19 UTC ***

https://hg.instantbird.org/instantbird/rev/c7423504633e
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.1
Version: trunk → 1.0
*** Original post on bio 870 at 2011-07-08 15:02:43 UTC ***

I've uploaded the addon from Comment #1 and bumped the version to be compatible with Instantbird 1.0: https://addons.instantbird.org/en-US/instantbird/addon/291/

Remember that this add-on is ONLY needed for Instantbird <= 1.0.*, above that the preference can be used.
You need to log in before you can comment on or make changes to this bug.