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

Toggle window visibility on tray icon click #5276

Closed
wants to merge 1 commit into from

Conversation

hiqua
Copy link
Contributor

@hiqua hiqua commented May 20, 2021

Fixes #3045.

Contributor checklist:

Description

Currently, (left) clicking the tray icon shows the window, but clicking again does not hide it. This change allows users to click again to hide the window.

Copy link
Contributor

@EvanHahn-Signal EvanHahn-Signal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs to be rebased against the latest development. Unfortunately, this file was deleted, so I think you'll need to make the change here:

if (!browserWindow.isVisible()) {
browserWindow.show();
}

I suspect this is what you'll do, but I haven't tested it:

if (browserWindow.isVisible()) {
  browserWindow.hide();
} else {
  browserWindow.show();
}

@hiqua hiqua force-pushed the tray_icon_left_click_toggle branch from 8fa8e7a to 2bcc677 Compare July 1, 2021 21:23
@hiqua
Copy link
Contributor Author

hiqua commented Jul 1, 2021

@EvanHahn-Signal from my quick test it does seem to work, thanks!

app/SystemTrayService.ts Show resolved Hide resolved
@hiqua hiqua force-pushed the tray_icon_left_click_toggle branch from 2bcc677 to 3779147 Compare July 2, 2021 14:13
@hiqua
Copy link
Contributor Author

hiqua commented Jul 6, 2021

@EvanHahn-Signal let me know if there's something else I should do before you can merge this.

Copy link
Contributor

@EvanHahn-Signal EvanHahn-Signal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something that we want to do?

On Windows, clicking the Discord tray icon doesn't toggle the app—it always shows it. Is this a common pattern on Linux or elsewhere?

@hiqua
Copy link
Contributor Author

hiqua commented Jul 6, 2021

On Windows, clicking the Discord tray icon doesn't toggle the app—it always shows it.

If we're gonna use examples, here are the (very unrepresentative) apps I use (on Linux) and that have a system tray icon. These ones are minimized when I click on the tray icon:

  • element-desktop
  • qbittorrent
  • x2go
  • simplescreenrecorder

These ones are focused if on another workspace (i3 workspace, but I guess it's the same with Gnome etc.), minimized if already in focus when I click the tray icon:

  • goldendict
  • virt-manager

So they all exhibit the behavior of this PR. I don't know about Discord as I only use it from time to time in the browser. But maybe you would prefer the second behavior, meaning:

  • if not in focus, get the focus.
  • If in focus, minimize the window.
    ?

Is this something that we want to do?

I think there's little drawback in adopting this new behavior: either people don't use it and will not even know about it, or they do and benefit from it.

In terms of impact, I can ask people from the issue to chime in. I've counted 5 users in the issue. Since it's also not such a big bother, I guess there are not that many people who voiced their preference, compared with color-related other issues.

If you're still not convinced, I can open a thread on the forum. The "bug" label on the issue led me to think this was something to be fixed, but maybe it's not?

@Mansarde
Copy link

Mansarde commented Jul 7, 2021

Just wanted to ask if it's possible to distinguish between a single mouse-click and a double-click?
Because there might be many people who double-click on the tray icon to open it, and if the new functionality were to hide the window on a second click, then people who double-click would unintentionally show then instantly hide the window again.

Yeah I know that's more of a PEBCAK problem, but I've seen many people doing this, so it might be good to be mindful of that.
Not saying they ought to be catered to, just throwing it out there. Personally I'm good with the PR and don't mind it either way. 👍

@hiqua
Copy link
Contributor Author

hiqua commented Jul 7, 2021

@Mansarde don't you think they'd just get used to it, and end up doing a single-click eventually? As of now, one click is already enough to open it, right? So you can already see the window when you're doing your second click, if your computer is fast enough.

@Mansarde
Copy link

Mansarde commented Jul 7, 2021

@hiqua I think so too, yes. Didn't mean to say we shouldn't have it because of that. Just wanted to give that perspective which I've watched happen a lot of times, even after they've learned that you usually don't need to double-click.

Personally I don't see a problem with it and am actually for it. :)

@ptandler
Copy link

ptandler commented Dec 7, 2021

Is this something that we want to do?

On Windows, clicking the Discord tray icon doesn't toggle the app—it always shows it. Is this a common pattern on Linux or elsewhere?

For me on Linux toggling would be the natural thing I would expect, as many other apps do it this way, e.g. Linux Mint's Update Notification, KeePassXC, CopyQ, and many Cinnamon extensions (e.g. notifications).

Copy link
Contributor

@indutny-signal indutny-signal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. This will be merged with the next beta release. Thank you!

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

Successfully merging this pull request may close these issues.

left-click on system tray icon should show/hide the window
7 participants