MaartenBaert / ssr

SimpleScreenRecorder, a screen recorder for Linux
http://www.maartenbaert.be/simplescreenrecorder/
GNU General Public License v3.0
2.52k stars 287 forks source link

ssr systray icons error on Linux Mint 18.3 #613

Open ghost opened 6 years ago

ghost commented 6 years ago

Hi, I'm using a Linux Mint 18.3 Sylvia with xfce, I correctly installed simplescreenrecorder from your repo and everything worked perfectly, in the xfce panel systray appeared the correct icons. Then I installed gradio with flatpak and the systray ssr icons stopped working, in their place appears a generic icon (the squared one):

http://imgur.com/lvbnCZ2l.png

If it helps, I put the installed packages for gradio, I've also tried to remove everything but without success:

mintualbox ~ # flatpak list Ref Options
de.haeckerfelix.gradio/x86_64/stable system,current org.gnome.Platform/x86_64/3.24 system,runtime

mintualbox ~ # flatpak uninstall de.haeckerfelix.gradio/x86_64/stable Uninstalling de.haeckerfelix.gradio/x86_64/stable Uninstalling de.haeckerfelix.gradio.Locale/x86_64/stable mintualbox ~ # flatpak uninstall org.gnome.Platform/x86_64/3.24 Uninstalling org.gnome.Platform/x86_64/3.24 Uninstalling org.gnome.Platform.Locale/x86_64/3.24 mintualbox ~ # flatpak list EMPTY mintualbox ~ #

There is a way to fix this problem? Thanks!

trebmuh commented 6 years ago

Related/duplicate https://github.com/MaartenBaert/ssr/issues/566 ?

ghost commented 6 years ago

Quite different! In that post speaking about Ubuntu 17.10, my system is Linux Mint 18.3 with xfce.

Anyway, it seems that there is no apparent solution, the problem seems to be related to Qt. The fact remains that only installing gradio with flatpak occurs that problem in my system. Waiting for same strange fix.... Greetings

MaartenBaert commented 6 years ago

This is a different issue, usually this is the result of a misconfiguration of the icon theme. The icon theme is supposed to fall back to the default 'hicolor' theme for missing icons. This is where the default SSR icons can be found. This requires adding a configuration line to the index.theme file:

[Icon Theme]
(...)
Inherits=hicolor
(...)

Alternatively they can provide their own icons for SSR, but ideally they should do both.

ghost commented 6 years ago

My used icon theme "Papirus" already includes "hicolor" in the Inherits instruction:

[Icon Theme] Name=Papirus Comment=Papirus icon theme for Arc/Arc Darker Inherits=breeze,ubuntu-mono-dark,gnome,hicolor

anyway, I repeat that everything worked well before I proceeded to install gradio from the flatpak (also tested in a virtualbox machine to replicate the error). I really don't understand how a flatpak application affects the proper functioning of another application like simplescreenrecorder.

MaartenBaert commented 6 years ago

I think the problem is that also includes 'breeze' and 'gnome', one of which is probably creating some kind of conflict because of something that was installed by org.gnome.Platform, or de.haeckerfelix.gradio (less likely IMHO). Can you provide a list of files for org.gnome.Platform and de.haeckerfelix.gradio?

FYI, in initially ignored the fact that you installed gradio because it is very common for icon problems to show up only once the icon cache is updated. Since not all applications do this properly, sometimes problems only show up when you install or uninstall something completely unrelated. In case it helps, the icon cache can be updated manually by running:

sudo gtk-update-icon-cache -t -f /usr/share/icons/hicolor

This only updates the 'hicolor' theme, if the problem is caused by some other theme then you may have to update those as well. Note that this will probably not solve the problem, but it may make the problem appear without installing gradio, which would indicate that gradio isn't the cause of the problem.

To be clear, I still don't know whether this is caused by org.gnome.Platform, de.haeckerfelix.gradio, or something unrelated that just happens to show up once the icon theme is updated. Seeing the file lists for these two packages should help me figure that out.

I really don't understand how a flatpak application affects the proper functioning of another application like simplescreenrecorder.

System tray icons are loaded from the system-wide icon theme, they are not built into SSR itself. SSR installs icon files in the correct place, and if your icon theme(s) are configured correctly and the caches are up-to-date, the system tray should be able to find the right icons automatically. Those may be the default icons provided by SSR or a special icon for SSR provided by the theme. However if things aren't configured properly, the icon may not show up at all, even when there is nothing wrong with SSR or its files.

ghost commented 6 years ago

Hi, I tried your tip about to recreate the icon cache for set hicolor, but no luck :-(

This is the list of installed flatpak packages:

de.haeckerfelix.gradio/x86_64/stable - system,current org.freedesktop.Platform.GL.nvidia-384-90/x86_64/1.4 - system,runtime org.gnome.Platform/x86_64/3.24 - system,runtime org.gtk.Gtk3theme.Adapta-Nokto/x86_64/3.22 - system,runtime

If it can help, this is my Linux Mint configuration:

Linux Mint 18.3 Sylvia x86_64 DE: Xfce WM: Xfwm4 WM Theme: Adapta-Nokto Theme: Adapta-Nokto [GTK2], Mint-X [GTK3] Icons: Papirus-Adapta-Nokto [GTK2], Mint-X [GTK3]

System tray icons are loaded from the system-wide icon theme, they are not built into SSR itself. SSR installs icon files in the correct place, and if your icon theme(s) are configured correctly and the caches are up-to-date, the system tray should be able to find the right icons automatically. Those may be the default icons provided by SSR or a special icon for SSR provided by the theme. However if things aren't configured properly, the icon may not show up at all, even when there is nothing wrong with SSR or its files.

Yes, I perfectly know that system tray icons are loaded from the system-wide icon theme (in papirus theme there are in 16x16/panel, 22x22/panel, 24x24/panel folders simplescreenrecorder-error.svg, simplescreenrecorder-idle.svg, simplescreenrecorder-panel.svg, simplescreenrecorder-paused.svg) and they worked properly as expected before gradio. I also recreate the icon cache for the whole Papirus theme and it's variants, same error.

Thank you so much for the help.

MaartenBaert commented 6 years ago

I need to have the list of files inside the packages, not just the name of the packages. I don't use flatpak myself so I can't easily get this list. I've been reading a bit and it seems that flatpak does some tricks with icons in order to make them work inside the sandbox. I suspect that this has something to do with it. Could you show me the output of the following commands?

tree /var/lib/flatpak
tree ~/.local/share/flatpak

First install the tree command with sudo apt-get install tree if you don't have it already (it's a tiny command line tool).

If you uninstall gradio, does that fix the problem, or is it permanent?

ghost commented 6 years ago

If you uninstall gradio, does that fix the problem, or is it permanent?

In the VM I also tried to completely remove gradio and related packages in the flatpak environment, but same error.

So, there are two files, tree command result for /var/lib/flatpak (flatpak-tree-var-lib.txt) and ~/.local/share/flatpak (flatpak-tree-local.txt)

flatpak-tree-local.txt flatpak-tree-var-lib.txt

I'm very sorry for all this, I started to use ssr many time ago and I think it's an excellent program, easy to use. Icon status in systray is essential when you capture a desktop and I would not give it up! :-)

MaartenBaert commented 6 years ago

Edit: tl;dr please run XDG_DATA_DIRS=/usr/share simplescreenrecorder and tell me whether that helps :).

Hmm, I think this is a compatibility problem between your system tray and flatpak. Flatpak is essentially installing a new version of the hicolor icon theme, so there are now two hicolor directories that applications should check when searching for icons:

/var/lib/flatpak/exports/share/icons/hicolor
/usr/share/icons/hicolor

Flatpak accomplishes this by adding /var/lib/flatpak/exports/share to the XDG_DATA_DIRS environment variable. Applications are supposed to search all possible data directories for icon themes. According to the icon theme specification:

Icons and themes are looked for in a set of directories. By default, apps should look in $HOME/.icons (for backwards compatibility), in $XDG_DATA_DIRS/icons and in /usr/share/pixmaps (in that order). Applications may further add their own icon directories to this list, and users may extend or change the list (in application/desktop specific ways). In each of these directories themes are stored as subdirectories. A theme can be spread across several base directories by having subdirectories of the same name. This way users can extend and override system themes.

I am guessing that your system tray isn't implementing this correctly. It finds the hicolor theme at /var/lib/flatpak/exports/share/icons/hicolor and subsequently ignores the second hicolor theme at /usr/share/icons/hicolor. I'm not entirely sure where this is implemented though. When I run SSR on my machine (Arch Linux, Xfce, Qt5) with a similarly modified XDG_DATA_DIRS through strace, I can see it attempts to open the icon file in all possible locations, and eventually decides to load the one in /usr/share/icons/hicolor/24x24/apps/simplescreenrecorder-idle.png, which is correct. However if I recompile with Qt4, it only searches in the first hicolor directory and then gives up, which is wrong. Instead of searching all hicolor directories, it searches all paths in XDG_DATA_DIRS until it finds the first hicolor directory and then ignores the rest. So this is a Qt4 bug.

I'm not entirely sure whether this also applies to Ubuntu though, because they have their own system tray implementation (called appindicator) which works differently. It's worth a try though.

Are you able to compile from source? If so, you can install Qt5 from the Ubuntu repositories and compile with ./simple-build-and-install as described in the README file. If you only have Qt5 development packages installed (not Qt4), the script should auto-detect that and use it. However you will be using a much older version of Qt5 than what I'm using, and I recall that early versions of Qt5 had a lot of problems with the system tray to begin with, so maybe this is not a great idea.

If you don't want to compile with Qt5, you could also manually change XDG_DATA_DIRS back to the normal value when launching SSR:

XDG_DATA_DIRS=/usr/share simplescreenrecorder

You can edit the desktop file at /usr/share/applications/simplescreenrecorder.desktop to do this automatically:

[Desktop Entry]
(...)
Exec=env XDG_DATA_DIRS=/usr/share simplescreenrecorder --logfile
(...)

Note that this will be overwritten whenever SSR is updated, so it's not perfect.

ghost commented 6 years ago

Ok, I will give a look, testing all in a VM, and then I will let you know...

My goal is to recreate a new virtual machine with Linux Mint 18.3 and verify step by step everything we have discussed so far, to finally reach a solution to the problem

ghost commented 6 years ago

And finally....THE SOLUTION!!!!

As just you said, flatpak interferes with the operation of all programs that search for icons in standard paths.

Anyway, your solution XDG_DATA_DIRS=/usr/share simplescreenrecorder works like a charm!

Exec=env XDG_DATA_DIRS=/usr/share simplescreenrecorder --logfile

Every time that there is and ssr update I'll have to remember to modify simplescreenrecorder.desktop, but this solution seems to me the most immediate, avoiding the compilation of your software.

Thanks Maarten Baert for make me find the final solution! Greetings.

rcrx commented 5 years ago

This appears to still be a problem in Mint 19.2 and the above fix (XDG_DATA_DIRS=/usr/share simplescreenrecorder) does not seem to correct the issue.