Add Linux tray menu; Fix tray window position; Fix AppImage APP icon #695
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Linux 的系统托盘有点奇怪,和其他系统不一样,没有右键,左键,双击等动作,只有一个动作(这里)。不单独配置的话,不管怎么点击,都是一个内容菜单。
再点击这个选项,动作就是其他系统的左键点击。(其他动作的点击行为都一样)
长这样:
所以把 Linux 下的菜单改成了这样:
第一个选项,是打开弹出窗口(也就是其他系统的左键单击),其余选项与其他系统保持一致。
getPosition()
在 Linux 中获得的 x, y 只会等于 0,每次点击 tray icon 的菜单,只会显示在屏幕的左上角(用两个屏幕的话,实在是有点太难受)。const tray_bounds = tray.getBounds()
在 Linux 中不生效,无法拿到 tray icon 的位置,好像 Linux 中的 tray 弹窗不能和其他系统一样,刚好显示在 tray icon 的附近,没办法获得到位置。这里我按照了 Jetbrains Toolbox 在 Linux 中弹窗的方式,每次都显示在系统托盘图标的一端。
比如在 KDE 中,会靠近图标显示在右下角(状态栏在上方的话,就会靠近图标在上方显示):
最后点击弹窗显示位置如下:
以上修改,均在 gnome,KDE,xfce 三种主流桌面环境进行了测试。