flameshot-org / flameshot

Powerful yet simple to use screenshot software :desktop_computer: :camera_flash:
https://flameshot.org
GNU General Public License v3.0
24.93k stars 1.6k forks source link

'App Launcher' not listing any apps and also not launching either (Xorg) #1868

Open TouchOdeath opened 3 years ago

TouchOdeath commented 3 years ago

Flameshot version Flameshot v0.10.1 (Flatpak) Compiled with Qt 5.15.3

Describe the bug Take a screenshot, click 'App Launcher'. Bug#1. No apps are listed Bug#2. After I fix Bug#1, the second bug is, when clicking an app, it literally does nothing.

To Reproduce

  1. Install Zorin OS 16 Core
  2. Open 'gnome-software' and install latest version of flameshot from the store.
  3. /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=flameshot org.flameshot.Flameshot gui
  4. Click 'App Launcher'
  5. There are no apps to pick from. So we must fix.
    cp /usr/share/applications/org.gnome.eog.desktop ~/.local/share/applications/
  6. /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=flameshot org.flameshot.Flameshot gui
  7. Click 'App Launcher'
  8. The app that I copied is showing up now. When I click on it, it does nothing. The command thats in org.gnome.eog.desktop is:
    TryExec=eog
    Exec=eog %U

At this point it could be the 'Image Viewer' application and not Flameshot. Fair enough, lets test this.

  1. Launch 'gnome-software' and install 'Ristretto'
    cp /usr/share/applications/ristretto.desktop ~/.local/share/applications/
  2. /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=flameshot org.flameshot.Flameshot gui
  3. Click 'App Launcher'
  4. Click 'Ristretto Image Viewer'
  5. Nothing happens.

Inside ristretto.desktop is:

Exec=ristretto %F

Expected behavior I expect 'Image Viewer' to open with the screenshot that I took already open inside this app.

System Information System: Host: *** Kernel: 5.11.0-27-generic x86_64 bits: 64 Desktop: Gnome 3.38.4 Distro: Zorin OS 16 Graphics: Device-1: NVIDIA driver: nvidia v: 470.57.02 Device-2: AMD Renoir driver: amdgpu v: kernel Display: server: X.Org 1.20.11 driver: amdgpu,ati,nvidia unloaded: fbdev,modesetting,nouveau,vesa resolution: 1920x1080~60Hz OpenGL: renderer: NVIDIA GeForce GTX 1650/PCIe/SSE2 v: 4.6.0 NVIDIA 470.57.02

Failed to get user: User ID 0 is not logged in or lingering

Monitors: 1 0: +*eDP-1-0 1920/344x1080/194+0+0 eDP-1-0

01:00.0 VGA compatible controller: NVIDIA Corporation Device 1f99 (rev a1) 05:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Renoir (rev c7)

-display
description: VGA compatible controller product: NVIDIA Corporation vendor: NVIDIA Corporation physical id: 0 bus info: pci@0000:01:00.0 version: a1 width: 64 bits clock: 33MHz capabilities: pm msi pciexpress vga_controller bus_master cap_list rom configuration: driver=nvidia latency=0 resources: irq:82 memory:fb000000-fbffffff memory:b0000000-bfffffff memory:c0000000-c1ffffff ioport:f000(size=128) memory:fc000000-fc07ffff
-display description: VGA compatible controller product: Renoir vendor: Advanced Micro Devices, Inc. [AMD/ATI] physical id: 0 bus info: pci@0000:05:00.0 version: c7 width: 64 bits clock: 33MHz capabilities: pm pciexpress msi msix vga_controller bus_master cap_list configuration: driver=amdgpu latency=0 resources: irq:43 memory:d0000000-dfffffff memory:e0000000-e01fffff ioport:c000(size=256) memory:fc500000-fc57ffff

Linux *** 5.11.0-27-generic #29~20.04.1-Ubuntu SMP Wed Aug 11 15:58:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Other Thoughts Without the '%U' or '%F' the apps don't show in the list. Which is good because Flameshot has to pass the image as an argument to the application.

mmahmoudian commented 3 years ago

I'm not sure if %U is correct use since it should be in file:// format as explained here. Please try changing the %U to %F for the eog and see if it works.

There is also a chance that this is because of the Flatpak packaging and permissions. I'll try to reproduce that

mmahmoudian commented 3 years ago

I can confirm that the flatpak version of Flameshot does not read the .desktop files in /usr/share/applications/. I can also confirm that regardless of %U or %F in the .desktop file, the flatpak does not open the file in eog

mmahmoudian commented 3 years ago

I also checked snap and it has worse issue. it does not even read the ~/.local/share/applications

image

TouchOdeath commented 3 years ago

Thank you for the reply. After reading your post, I decided to install the appimage. https://github.com/flameshot-org/flameshot/releases/download/v0.10.1/Flameshot-0.10.1.x86_64.AppImage

The AppImage does list all my apps, which is an improvement. When I try to open it with an 'Image program', it does nothing.

Below is my log:

xyz@zorin:~$ /home/xyz/Downloads/Flameshot-0.10.1.x86_64.AppImage Run experimental self-contained bundle QApplication: invalid style override passed, ignoring it. Available styles: Windows, Fusion QSettings::value: Empty key passed QSettings::value: Empty key passed QSettings::setValue: Empty key passed QSettings::value: Empty key passed QSettings::setValue: Empty key passed Failed to get information about the latest version. "Host api.github.com not found" Failed to get information about the latest version. "Host api.github.com not found" QPainter::begin: Paint device returned engine == 0, type: 2 QPainter::setRenderHint: Painter must be active to set rendering hints QPainter::setCompositionMode: Painter not active QPainter::translate: Painter not active QPainter::setPen: Painter not active QPainter::setBrush: Painter not active QPainter::setBrush: Painter not active Gtk-Message: 10:59:20.959: Failed to load module "canberra-gtk-module" Gtk-Message: 10:59:20.960: Failed to load module "canberra-gtk-module"

(eog:10593): Gtk-WARNING **: 10:59:21.138: Could not load a pixbuf from icon theme. This may indicate that pixbuf loaders or the mime database could not be found.

(eog:10593): EOG-WARNING **: 10:59:21.138: Couldn't load icon: Failed to load /usr/share/icons/Zorin/512x512/status/image-loading.png: Unrecognized image file format

(eog:10593): EOG-WARNING : 10:59:21.138: Couldn't load icon: Failed to load /usr/share/icons/Zorin/512x512/status/image-missing.png: Unrecognized image file format Gtk:ERROR:../../../../gtk/gtkiconhelper.c:494:ensure_surface_for_gicon: assertion failed (error == NULL): Failed to load /usr/share/icons/Zorin/16x16/status/image-missing.png: Unrecognized image file format (gdk-pixbuf-error-quark, 3) Bail out! Gtk:ERROR:../../../../gtk/gtkiconhelper.c:494:ensure_surface_for_gicon: assertion failed (error == NULL): Failed to load /usr/share/icons/Zorin/16x16/status/image-missing.png: Unrecognized image file format (gdk-pixbuf-error-quark, 3)

When it gets to this part:

Gtk-Message: 10:59:20.959: Failed to load module "canberra-gtk-module"

I just clicked on the 'image program' to open the screenshot.

TouchOdeath commented 3 years ago

I also tested Ristretto, I get the same error messages minus the 'eog' warnings. It does the same thing which is... nothing.

philus88 commented 2 years ago

On Windows the the windows for app selections is empty too. where does flameshot look for installed apps in windows environment. using Beta 11 image

resp3ct commented 2 years ago

I can also confirm, on Win11, the app selection list is empty.


Flameshot v11.0.0 (ad1bf28) Compiled with Qt 5.15.2 winnt: 10.0.22000 windows: 10


Windows 11 Version 21H2 (OS Build 22000.706)


I've tried running as administrator with no change.

image

drennalls commented 2 years ago

I'm on Windows 10 and ran into the same thing. After looking at the code applauncherwidget.cpp and desktopfileparse.cpp then confirming with procmon, I realized things are currently coded for *nix.. So flameshot is populating the dialog based on .desktop files in <HOME>/.local/share/applications.

So as a hack/workaround you can create a %USERPROFILE%\.local\share\applications folder and a .desktop file for each of the apps you want in the list. However one additional gotcha is flameshot will pass a unix path (forward slashes) to the app specified in the Exec line of the .desktop file. So you need to specify a wrapper script in the .desktop file and have the wrapper fix the path before launching the real app. Currently I have two .desktop files one for mspaint and one to launch whatever the default app is for images. This works, however the apps listed don't have any icons.

For reference below are my .desktop and wrapper .cmd files. NOTE: Initially I tried things with a single wrapper .cmd thinking all of the Exec line would get used and only %f would be replaced, but that's not the case and onlty the first string in the line (split by spaces) is used when launching an app.

%USERPROFILE%\.local\share\applications\default.desktop

[Desktop Entry]
Comment=Default
Exec=C:/Users/drennall/Documents/bin/flameshot-defaultapp.cmd %f
Icon=todo
Name=Default
Terminal=false
Type=Application
Categories=Graphics;
C:\Users\drennall\.local\share\applications>

flameshot-defaultapp.cmd

:: usage: flameshot-defaultapp <file to be opened>
::    The filename supplied by flameshot will have forward slashes, so just convert to backslashes before launching the app
:: See https://ss64.com/nt/syntax-replace.html for string replace syntax
set file_path=%1
set win_file_path=%file_path:/=\%
%win_file_path%

%USERPROFILE%\.local\share\applications\mspaint.desktop

[Desktop Entry]
Comment=Microsoft Paint
Exec=C:/Users/drennall/Documents/bin/flameshot-mspaint.cmd %f
Icon=list-add
Name=Paint
Terminal=false
Type=Application
Categories=Graphics;

flameshot-mspaint.cmd

:: usage: flameshot-mspaint <file to be opened>
::    The filename supplied by flameshot will have forward slashes, so just to convert to backslashes before launching the app
:: See https://ss64.com/nt/syntax-replace.html for string replace syntax
set file_path=%1
set win_file_path=%file_path:/=\%
mspaint %win_file_path%

...with all of the above I get the dialog shown below, where "Default" ends up launching MS Photos and "Paint" launches mspaint. image

HTH someone else.

resp3ct commented 2 years ago

I can confirm, this workaround allows me to open screenshots in Paint as well (I'm on Win11). Thanks @drennalls

borgmanJeremy commented 2 years ago

@drennalls Are you familiar enough with windows to know where Flameshot should look for apps instead?

drennalls commented 2 years ago

@borgmanJeremy sadly, no, I'd have to do some digging. I'm really a Linux guy who is forced to use Windows because of work requirements, and I try to use the same tools on Windows that I use on Linux where possible (like flameshot) 😄.

resp3ct commented 2 years ago

@drennalls Are you familiar enough with windows to know where Flameshot should look for apps instead?

I'm no coder so I'll only chime in enough to say file extensions and their associated available programs are listed in the registry here: \HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts For example: .png files shown below image

Ultrabenosaurus commented 2 years ago

Representing Manjaro Plasma, I'm having the same issue.

image

I use the Flatpak release (currently 12.1.0) from Manjaro's Add / Remove Software GUI and never had any programs showing in the Open With dialogue. I've been using Flameshot for a while, but only now got around to investigating and stumbled on this thread. After trying a symlink of ln -s /usr/share/applications/pinta.desktop ~/.local/share/applications/pinta.desktop and still having no icons I deleted that and just copied the .desktop which does show Pinta in the dialogue:

image

However, clicking this does nothing.

Here are the contents of pinta.desktop ignoring all the localised Name and Comment lines:

[Desktop Entry]
Version=1.0
Name=Pinta
...
TryExec=pinta
Exec=pinta %F
Icon=pinta
StartupNotify=false
StartupWMClass=Pinta
Terminal=false
Type=Application
Categories=Graphics;2DGraphics;RasterGraphics;GTK;
...
MimeType=image/bmp;image/gif;image/jpeg;image/jpg;image/pjpeg;image/png;image/svg+xml;image/tiff;image/x-bmp;image/x-gray;image/x-icb;image/x-ico;image/x-png;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-xbitmap;image/x-xpixmap;image/x-pcx;image/x-targa;image/x-tga;image/openraster;
ChamDK commented 6 months ago

https://ss64.com/nt/syntax-replace.html

Thanks, one could wonder why it is not fixed yet, however please note if a path is used with spaces, it will not work. I had to place my cmd in c:\path_with_no_spaces\flameshot-defaultapp.cmd