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

[ Feature Request ] Split Left click and Right click action #23

Open
shugen002 opened this issue Jul 12, 2022 · 14 comments
Open

[ Feature Request ] Split Left click and Right click action #23

shugen002 opened this issue Jul 12, 2022 · 14 comments

Comments

@shugen002
Copy link

By split left right click action , we can do other action on left click not just open the menu but such as show/hide window.

@andydotxyz
Copy link
Member

On many OS it is assumed that the menu will appear from left click.
I wonder if this is perhaps possibly a request to have a single action instead of a menu?
Many apps that want to do both put the window toggle in the menu so both can be done.
Toggling a window visibility with a single tap is the job of your OS app switcher / taskbar isn't it?

@shugen002
Copy link
Author

On many OS it is assumed that the menu will appear from left click.

Sorry about that , I work at window desktop enviroment most of time , I didn't notice the appearance difference in MacOS and Linux.

But looks MacOS is also support handle left right click (sources: https://www.electronjs.org/docs/latest/api/tray#event-right-click-macos-windows)

I wonder if this is perhaps possibly a request to have a single action instead of a menu?

Yes , but not exactly.

I plan do this:

single left click: do nothing

dourble left click: open Browser with our WebUI

right click: show a menu include Open WebUI and Quit and other common action

Toggling a window visibility with a single tap is the job of your OS app switcher / taskbar isn't it?

I agree that , but in my developing experence , some user still request hide window into tray , and many app (such as telegram, steam) support hide into tray when click the close button.

@shugen002
Copy link
Author

@davidnewhall
Copy link

On many OS it is assumed that the menu will appear from left click.

MacOS and Windows differ in this regard. On Windows, you usually open the menu by right clicking the icon, and a left click open a window (as opposed to a menu). On macOS, left clicking is expected to open the menu, and right clicking menu items on macOS is hit-and-miss. Some open a menu, and some do nothing. Very few will open a window without clicking an item in a menu. I don't use Linux as a desktop, so I have no idea what sort of behaviors exist there.

All that said, it's desirable for the app developer to control these behaviors, so we can keep our apps consistent with the users' expectations.

As an app dev, I'd even love to see a third control-option for double-click. I'll try to put some time into this, but can't promise much. I have only had one user ask for the ability to split right/left click on Windows, so it's not super high priority.

@heaxo
Copy link

heaxo commented Jan 15, 2024

I think it's necessary

@andydotxyz
Copy link
Member

On macOS, left clicking is expected to open the menu, and right clicking menu items on macOS is hit-and-miss. Some open a menu, and some do nothing. Very few will open a window without clicking an item in a menu.

This is same with my findings

All that said, it's desirable for the app developer to control these behaviors, so we can keep our apps consistent with the users' expectations.

I think it's necessary

These statements feel subjective. We are trying to juggle consistency for all your users whilst being consistent with the OS. I'm not sure that implementing differently for each platform leading to content that may not be accessible to some is the right way to go? Would users of something platform-agnostic like this library really expect to write OS-specific code into their apps for controlling menus?

@davidnewhall
Copy link

Would users of something platform-agnostic like this library really expect to write OS-specific code into their apps for controlling menus?

If you don't your users will complain about how your app feels 'weird'. No way around it. If you're good with telling your users "tuff" then don't worry about writing OS-specific code.

fwiw, I've since switched to another systray fork that allows me to define all of these behaviors in my own code my own way. Works brilliantly.

@Jacalz
Copy link
Member

Jacalz commented Jan 20, 2024

See fyne-io/fyne#4491 (comment) for a relevant discussion.

@andydotxyz
Copy link
Member

Would users of something platform-agnostic like this library really expect to write OS-specific code into their apps for controlling menus?

If you don't your users will complain about how your app feels 'weird'. No way around it. If you're good with telling your users "tuff" then don't worry about writing OS-specific code.

fwiw, I've since switched to another systray fork that allows me to define all of these behaviors in my own code my own way. Works brilliantly.

There is a big distance between not adding APIs that won't work on some platforms and telling users "tough luck".
As @Jacalz points out we are having a discussion about how to do it in a way that meets platform expectations without encouraging developers to accidentally break functionality on some platforms.

@gschafra
Copy link

gschafra commented Jun 4, 2024

Has anyone see this PR from the upstream repo? IMHO I think this might be the way to go to allow devs to implement the behaviour as needed/wished, don't you?

@andydotxyz
Copy link
Member

The PR you linked to only works on Windows (where the clicks are often different) but not on macOS (where most apps have the same action) or Linux (where right click is not supported).

Don't we want to be able to have an API that works everywhere consistently?

@zquestz
Copy link

zquestz commented Nov 12, 2024

@andydotxyz I am confused, on Linux only right click works for my app... I can't seem to figure out how to get left click mapped to anything...

Even just foregrounding the app would be better than the current behavior.

@andydotxyz
Copy link
Member

I can't seem to figure out how to get left click mapped to anything...

There is not one generic "Linux" system, we have implemented a spec and the systems showing the tray can behave how they want. We do not implement the left or right click signals, we set the menu only.
Typically a system that sees only a menu but no tap handlers will show that menu on any interaction - at least that is my understanding.

Perhaps your system tray has configuration?

@zquestz
Copy link

zquestz commented Nov 25, 2024

Just using Cinnamon, by default only right click shows the menu, while every single other systray item I have does respond to both left and right click, Fyne systrays only work with right click with left click doing nothing. =\

That is why I forked the systray code, and added Activate support, now left click does my custom action (showing a window) and left click shows the menu. This seems to be working consistently with all Linux systems I have tried it on.

The action bound to left click is also setup in the menu, so for systems (Mac), where everything brings up the menu, functionality is not impacted.

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

No branches or pull requests

7 participants