-
Notifications
You must be signed in to change notification settings - Fork 33
refactor: Update Fether menu for taskbar mode on non-macOS (add 'Quit', remove 'Close Window', remove 'Minimize') #440
refactor: Update Fether menu for taskbar mode on non-macOS (add 'Quit', remove 'Close Window', remove 'Minimize') #440
Conversation
…indow-for-taskbar-app
Note that subsequent to this PR we need to make the Fether context menu appear with a "frameless" Fether window on all OS |
I don't quite understand. Since it's frameless, there is no menu on Linux (as it doesn't work, and that's fine because there's no need for it). |
It's possible to have the context menu appear as a popup when you right-click on a "frameless" Fether window, and even have the context menu appear as a popup when you right-click on the system tray icon, as shown in this screenshot I think @axelchalon's comment #433 (comment) was referring to the fact that there wasn't a "Quit" menu item at all for Windows and Linux in the Fether menu, we only had one on macOS. I've changed this PR back to being in-progress. Previously when I used Whereas today I was able to show the context menu popup on right-click, and the items worked when using I think we need the Fether context menu on Windows and Linux, and I'm going to try and get the right-click popup context menu to work. |
14e5210
to
63a73cc
Compare
@Tbaut I've pushed commits so that on Linux and Windows if you click the system tray icon it shows a context menu. It all works on both Ubuntu Gnome OS and Linux Mint OS. There's just an issue on Windows OS where clicking the menu items in the "Edit" and "Window" sections of the menu doesn't work, and I do not understand why.... Linux Mint - clicking system tray icon toggles context menu that works Ubuntu Gnome - clicking system tray icon toggles context menu that works Windows 10 - clicking dock icon toggles Fether window that works, and balloon shows usage instructions. however whilst clicking system tray icon toggles context menu, the "Edit" and "Window" menu items don't work when you click them |
…tabs working on Windows OS
Update on Windows issue where context menu 'Edit' and 'View' menu tab menu items not working: If I configure the menu using Note that in the 'Window' menu tab, on Windows OS, I've only included "Reload" and "Toggle Developer Tools", since they are the only ones that appear to be available in Note that I've added to the "Edit" menu tab the "Undo" and "Redo" menu items too. Note that the following resources were most helpful:
|
Thanks a lot for the thorough testing. What Riot does and I believe we should do as well (keep it simple):
Let's discuss all this beforehand in an issue so that we only implement what makes a consensus. |
… and Fether in production
3c29239
to
42b4065
Compare
… so unable to toggle window show/hide as well
@Tbaut I've pushed a commit that displays the context menu when you "right-click" in the Fether window that contains the Edit, View, and Help submenus, and Quit. I know we discussed only having the Edit menu items appear when you "right-click" in the Fether window, but I think it's better also having the the View and Help submenus and Quit item there too (rather than adding confusion by making the user have to click the "tray" icon instead to access those other menu items). So on that basis I've also removed the feature that also displayed the same context menu when you clicked the "tray" icon, so now clicking the tray icon just shows/hides the Fether window as it did before. Please try it out and let me know what you think? Note that one of the main reasons why I've proposed to not rely on showing the menu when the user right-clicks on the "tray" icon, is because on Linux (i.e. Ubuntu Gnome) right-clicking on the tray icon is not supported (API docs show only support for macOS and Windows https://electronjs.org/docs/api/tray#event-right-click-macos-windows). See #422 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's great for the left click menu in Fether iindow.
Due to not being able to avoid this and the fact that right-click on the tray icon doesn't work on Linux either, I've proposed that for all OSes
One of the most important notion in UX is to not introduce a behavior that users are not used to, unless you have a really good excuse (keeping things consistent across OSes doesn't matter to users).
We should:
- Keep the behavior of hide/appear on left click for any OS that supports is (all except Linux)
- Let a "Quit" menu entry on the tray menu no matter what.
Summary:
Keep the menu as it is in the window, it's great
Linux:
- Left and right click on the tray icon shows:
- Show/Hide Fether
- Quit
Mac and Windows:
- Left click on the tray icon directly toggles Fether
- Right click on the tray show:
- Show/Hide Fether
- Quit
function showTrayBalloon (fetherApp) { | ||
const { tray } = fetherApp; | ||
|
||
pino.info('Showing Tray Balloon'); | ||
|
||
tray.displayBalloon({ | ||
content: `Press ALT in the Fether window to toggle the menu`, | ||
content: | ||
'Click to toggle Fether window. Right-click Fether window to toggle Fether menu', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Click to toggle Fether window. Right-click Fether window to toggle Fether menu', | |
'Show/Hide Fether', |
This is not true for Linux. Since it's a menu item we should keep things short and simple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How should we communicate to users that they can view the full menu by right-clicking on the Fether window?
I've since discovered that we can show the tray menu with "Show/Hide Fether" and "Quit" items by running
This works!
On macOS, when we configure the tray icon to display the context menu, it only runs the code in the 'right-click' listener when you either left-click or right-click the tray icon (i.e. 'click' and 'double-click' do not work). I think it's related to this issue. On Windows, it all works the way we want it to (i.e. the left-click the tray icon toggles Fether directory and right-click shows the context menu with "Show/Hide Fether" and "Quit" items) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
template.push({ | ||
role: 'help', | ||
submenu: [ | ||
{ role: 'about' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clicking on "about" doesn't do anything. I'd suggest to keep only one of "about" or "Learn More" and point it to https://github.com/paritytech/fether instead (as Parity.io does).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left both because I thought we should give the user the ability to view their current Fether version, and also finding out more about Parity and Fether:
- About - opens the window that shows the version information
- Learn More - opens https://www.parity.io/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see what you mean, it doesn't work because the 'about' role is only supported on macOS according to the API docs https://electronjs.org/docs/api/menu-item#roles.
I'll push an update so it only appears on macOS
Refactor Fether menu code
Add context menu that appears when you click on the system tray icon on Linux and Windows, allowing the Fether window to be "frameless" and we don't need to use ALT key to toggle it anymore. Not required for macOS since we can keep the Fether window "frameless" and use the Fether menu that appears in the taskbar
Add File > Quit to Fether menu when not using macOS, since macOS has a different File menu items
Remove the Fether menu tab "Window" entirely and associated menu items when running in taskbar mode, since we are only allowing user to either blur the window, hide and re-open it by clicking the taskbar icon, or quit
Remove adjustment of window height to in 'app-resize' since we are now using "frameless" Fether window on all OS