element-hq / element-web

A glossy Matrix collaboration client for the web.
https://element.io
Apache License 2.0
10.74k stars 1.89k forks source link

Impossible to interact with the tray icon and thus to quit the app (desktop version based on electron) (and weird icon issue) #3133

Closed ArchangeGabriel closed 1 year ago

ArchangeGabriel commented 7 years ago

When I start riot, I’ve got a strange behaviour. I either start it from within a terminal or using the desktop entry added by this .desktop file.

When starting a first time, it doesn’t work. A window is added to task manager if using the desktop entry, but then disappears without anything else happening; while using the terminal results in this:

Starting auto update with base URL: null
Auto update not supported on this platform
Unhandled exception TypeError: Error processing argument at index 0, conversion failure from /usr/lib/riot/electron/src/../img/riot.png
    at TypeError (native)
    at Object.exports.create (/usr/lib/riot/electron/src/tray.js:63:16)
    at App.electron.app.on (/usr/lib/riot/electron/src/electron-main.js:199:10)
    at emitTwo (events.js:111:20)
    at App.emit (events.js:191:7)

(electron:21415): Gdk-WARNING **: gdkwindow-x11.c:5573 drawable is not a native X11 window

(electron:21415): Gdk-WARNING **: gdkwindow-x11.c:5573 drawable is not a native X11 window

(electron:21415): Gdk-WARNING **: gdkwindow-x11.c:5573 drawable is not a native X11 window

And then nothing happens, I have to Ctrl+C to get out of it.

Then, on a second attempt, seems become very weird. If the previous attempt was from the terminal, then it doesn’t work as above. However, if the previous failed attempt was from the desktop entry, then it does work whether trying from the terminal or the desktop entry.

After this, it goes back to square one. So, I have a work-around for now (just launch it twice from the desktop entry), but this is far from ideal and could confuse people if I’m not the only one affected.

ArchangeGabriel commented 7 years ago

OK, I’ve partly fixed it, the issue was the missing riot.png file. Adding it made it work (so sorry for the noise about this part), however it also enabled a tray icon that can’t be interacted with and makes Ctrl+Q the only way to exit the app (closing the window results in a tray icon staying indefinitely with means of interaction). Should I open a new issue or is #2799 somehow already tracking that?

dbkr commented 7 years ago

Yep, this does sounds like problems caused by the new tray icon. I suspect it's not allowing interaction with the tray icon which means you don't get the menu / app focusing behaviour when you click the tray icon.

What desktop environment are you using? Can you interact with other tray icons in your desktop environment, and if so in what way?

ArchangeGabriel commented 7 years ago

I’m running KDE’s Plasma 5… I can definitively interact with other tray icons, they all have different behaviours but most of them have left and right-click menus (plus hover display, which Riot does have too, displaying a pixelized icon with “electron” as text, see the attached picture).

tray-hover

ArchangeGabriel commented 7 years ago

Another user reported the same issue, on Plasma 5 too.

kbg commented 7 years ago

I had the same issues on Plasma 5. Installing the libappindicator-gtk3 package on Arch Linux solved this problem for me.

I am now able to interact with the tray icon using the right mouse button. Unfortunately this also introduced an issue rendering the icon: When libappindicator-gtk3 is installed, only the upper left corner of the riot icon is displayed in the system tray. If I remove the libappindicator-gtk3 package (and restart the riot app), the full icon is shown again, but it cannot be interacted with.

In case this is a packaging issue: I built the Riot Desktop package using the build script from AUR, which currently uses version 0.9.7 of riot-web.

ArchangeGabriel commented 7 years ago

Hum indeed, using libappindicator-gtk3 allows to interact with the icon, but then its rendering is wrong.

t3chguy commented 6 years ago

I fixed this for myself on KDE Neon (Ubuntu + Plasma) by using equivs-control to make a dummy libappindicator1 and installing it

MurzNN commented 6 years ago

@t3chguy can you describe more detaily how to fix this problem on Ubuntu with KDE5?

t3chguy commented 6 years ago

@MurzNN install https://riot.ovh/_matrix/media/v1/download/riot.ovh/RrwsYrxMcIyHWjfhpxxWtvEN over libappindicator1, this is a dummy package I made using equivs-control, you are free to make your own if you don't trust mine. It provides libappindicator1 at an inflated version to replace any installed with a no-op package.

MurzNN commented 6 years ago

@t3chguy thanks, it helps! At now tray icon looks and works well on Ubuntu 14.04 with KDE 4.14! Also solves the problem on Ubuntu 16.04+ with KDE5 too.

z3ntu commented 6 years ago

Can confirm that removing libappindicator3-gtk makes the icon look not-zoomed in but the resolution of the tray icon is very bad and looks pretty ugly it's current form.

ArchangeGabriel commented 6 years ago

I confirm too that removing libappindicator3-gtk now results in a working tray icon but very blurred. At least we can interact with it and the notification badge works.

ArchangeGabriel commented 6 years ago

Apparently blurry tray icon for electron apps under KDE is a common bug, not specific to Riot (and I can confirm I also have this issue with other apps). Same goes for wrong size when libappindicator is installed. For instance https://github.com/cozy-labs/cozy-desktop/issues/990.

MurzNN commented 6 years ago

In cozy-labs/cozy-desktop#990 there are workaround that solve this KDE bug:

I have patched the code to use a 22*22 icon size when KDE environment is detected.

Maybe Riot can do the same thing?

MurzNN commented 5 years ago

Quck fix for Riot Electron app tray icon in Kubuntu (Ubuntu KDE) and Debian Linux systems:

mv /usr/lib/x86_64-linux-gnu/libappindicator.so.1.0.0 /usr/lib/x86_64-linux-gnu/libappindicator.so.1.0.0_off

This will work until libappindicator1 package will be upgraded/reinstalled

lazToum commented 5 years ago

on Arch, plasma 5.13 with libappindicator-gtk3: XDG_CURRENT_DESKTOP=Unity riot-desktop

mnn commented 5 years ago

Got same issue - icon is a purple box (and left click does nothing, not sure if that is correct behaviour). @lazToum's workaround seems to work (at least when launching from a console), I'll modify the autostart file and hopefully it will fix the issue for good.

MurzNN commented 5 years ago

@lazToum workaround solve the problem only with icon size, but left click on tray icon is still broken (shows Show/Hide, Quit menu like in right click, instead of immediately show-hide app). So most comfortable solution is removing or replacing via dummy package all libappindicator* packages, or remove manually /usr/lib/x86_64-linux-gnu/libappindicator*.so.1 files.

shirishag75 commented 5 years ago

would having ayatana-appindicator help in anyway instead of libappindicator ? https://github.com/AyatanaIndicators/libayatana-appindicator. See https://wiki.debian.org/Ayatana/IndicatorsTransition

t3chguy commented 5 years ago

It's not something we get control of, it's something electron-builder specifies

akontsevich commented 5 years ago

XDG_CURRENT_DESKTOP=Unity riot-desktop

@lazToum where to set this?

saligari commented 5 years ago

@akontsevich run that command: XDG_CURRENT_DESKTOP=Unity riot-desktop to run Riot client and get the correct displaying icon.

akontsevich commented 5 years ago

@ChrisP4 it solves only icon look but does not fix tray behavior on mouse click. Also DE session manager does not store exact app command to rerun and icon still ugly on next DE start on session restore.

532910 commented 5 years ago

without XDG_CURRENT_DESKTOP: image

with XDG_CURRENT_DESKTOP=Unity: image

532910 commented 5 years ago

Enlightenment 22.4

Pointedstick commented 5 years ago

This is working properly for me now in KDE Plasma 5.15 with Riot 1.0.1. Can anyone confirm?

akontsevich commented 5 years ago

@Pointedstick, what works for You? For me in KDE Plasma 5.15 with Riot 1.0.1 works only with right mouse click - opens context menu, left mouse to show main window does not work.

z3ntu commented 5 years ago

Both works for me with Plasma 5.15.1 and Riot 1.0.1 on Arch Linux

ArchangeGabriel commented 5 years ago

With or without appindicator?

akontsevich commented 5 years ago

Probably they does not use libappindicator. Does not work for me with libappindicator1 - forced to use for acestreamengine. Many distributions use patched libappindicator, hope openSUSE will patch or replace it as well.

z3ntu commented 5 years ago

I do not have appindicator installed (only the gtk2 version)

ArchangeGabriel commented 5 years ago

@akontsevich Then your issue is https://bugs.archlinux.org/task/59652.

dos1 commented 5 years ago

The correct way to have system tray icon properly working is to use Electron 5.0 or later and have libappindicator installed (but making sure that it doesn't use any patches that actually break it, like it's the case with Arch right now). Also, the app itself shouldn't have any special behavior when it detects KDE, like scaling down the icon to 22x22 - this was "helping" with old buggy Electron (or very old KDE), but now it just makes the icon blurry.

There were multiple bugs in various places that were hindering the usability of systray icons in Electron apps, so you have to make sure all of these pieces are covered.

532910 commented 5 years ago
% dpkg -l | grep libappindicator   
ii  gir1.2-appindicator3-0.1:amd64        0.4.92-7                             amd64        Typelib files for libappindicator3-1
ii  libappindicator1:amd64                0.4.92-7                             amd64        allow applications to export a menu into the panel
ii  libappindicator3-1:amd64              0.4.92-7                             amd64        allow applications to export a menu into the panel -- GTK3 version
dos1 commented 5 years ago

@532910 Your issue seems to be separate and I'd suspect a bug in Enlightenment there. Do other, non-electron apps that use libappindicator work with E?

532910 commented 5 years ago

xfce4-panel: no icon trayer: no icon but volumeicon-alsa works everywhere

dos1 commented 5 years ago

Neither trayer nor xfce4-panel seem to support indicators, so as soon as there's any registrar running it's expected that there won't be any icon displayed there, as it won't fallback to XEmbed (and even if it fallbacks, it will be shown only in one panel at a time).

[edit] With xfce4-panel seems like you can use xfce4-indicator-plugin

t3chguy commented 2 years ago

Are people still experiencing this?

ArchangeGabriel commented 1 year ago

It works for me both with and without libappindicator installed (though with libappindicator, both right and left click open the menu, while without it right click is the menu and left shows/hides element).

weeman1337 commented 1 year ago

Thank you for opening an issue. Unfortunately I wasn’t able to reproduce it. If you keep experiencing this defect, please update your description with steps/screenshots/video/more details and add a comment with @weeman1337 to let me know that it’s ready to be reopened.