jtheoof / swappy

A Wayland native snapshot editing tool, inspired by Snappy on macOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

swappy desktop file is useless

bhepple opened this issue · comments

See: https://bugzilla.redhat.com/show_bug.cgi?id=1941697 which I copy here for convenience.

Description of problem:

the swappy desktopfile is useless:

TryExec=swappy
Exec=swappy -f %F
Terminal=false
Type=Application

If the app is started with this desktopfile, it starts this way:

"swappy -f "

which results in:

Mär 22 15:47:46 fedorapine sm.puri.Phosh.desktop[68835]: Für -f wird ein Argument benötigt

German for "you need an argument for -f option" .

Swappy is meant to be started after an image is taken i.e. by grim and then given to swappy as argument.

Solution:

Add a dependency for "grim" and "slurp", so those get installed along side swappy.

Change the "Exec=" to "Exec=swappy-wrap" and create: /usr/local/sbin/snappy-wrap
like this:

# cat /usr/local/sbin/swappy-wrap 
#!/bin/bash

grim -g "$(slurp)" - | swappy -f -

Now Snappy works as indented, which is also flawed, but thats a different story / bugreport.

Version-Release number of selected component (if applicable):

Name : swappy
Version : 1.3.1
Release : 1.fc35
Architecture: aarch64

The .desktop file was introduced for #35. It's mainly used to edit images with swappy directly from Nautilus (or other file managers).

The suggestion doesn't seem to make a lot of sense. It's binding swappy to grim or slurp which are not dependencies.

The following line in the .desktop file supports nautilus etc as well as doing something sensible when the app is run from a launcher such as xfce4-appfinder etc:

Exec=sh -c "if [ -n "\$*" ]; then exec swappy -f "\$@"; else grim -g "\$(slurp)" - | swappy -f -; fi" placeholder %F

I could use a wrapper as suggested by the original bug reporter, but it's less elegant.

grim and slurp are both 'soft dependencies' in the dnf/rpm/package sense if not in the binary 'ld(1)' sense.