AppImageCommunity / AppImageUpdate

AppImageUpdate lets you update AppImages in a decentral way using information embedded in the AppImage itself.
https://appimage.org
MIT License
561 stars 56 forks source link

"Run app" for CLI apps #31

Open probonopd opened 6 years ago

probonopd commented 6 years ago

When you update a CLI app (desktop file has Terminal=true), then "Run app" should open the app in a terminal.

wget https://download.opensuse.org/repositories/home:/nandub:/MyAppImages/AppImage/aria2-latest-x86_64.AppImage
# Run AppImageUpdate GUI on the just downloaded AppImage
# "Run app" --> Nothing happens in the GUI

Note that this particular AppImage has True instead of true:

me@host:~$ /home/me/Downloads/aria2-1.24.0-1.1.Build12.15.glibc2.17-x86_64.AppImage --appimage-extract '*.desktop'
squashfs-root/aria2.desktop
me@host:~$ cat squashfs-root/aria2.desktop 
[Desktop Entry]
Type=Application
Name=Aria2
Exec=aria2c
Icon=aria2
Categories=Network;Download Manager
Comment=aria2 is a lightweight multi-protocol & multi-source, cross platform download utility operated in command-line. It supports HTTP/HTTPS, FTP, SFTP, BitTorrent and Metalink
Terminal=True

me@host:~$ desktop-file-validate squashfs-root/aria2.desktop 
squashfs-root/aria2.desktop: error: value "Network;Download Manager" for string list key "Categories" in group "Desktop Entry" does not have a semicolon (';') as trailing character
squashfs-root/aria2.desktop: error: value "True" for boolean key "Terminal" in group "Desktop Entry" contains invalid characters, boolean values must be "false" or "true"
TheAssassin commented 6 years ago

@probonopd how can we efficiently extract that bit of information to make it available to AppImageUpdate? I guess one has to mount the AppImage and extract the .desktop file. Is there an easier way?

probonopd commented 6 years ago

It should be possible to extract the relevant code from appimaged I guess.

TheAssassin commented 6 years ago

We really need to refactor that code as well, and provide a "libappimage", I guess.

probonopd commented 6 years ago

Quite possibly.

TheAssassin commented 6 years ago

I guess I'll extract the code to shared.c for now, then I just need to consume that file.

TheAssassin commented 6 years ago

Rethinking this, I don't think the approach of opening an AppImage in a terminal is a good idea per se. The problem is that tools which expect arguments etc. will cause the terminal to collapse immediately, without showing any useful error message or something alike to the user.

How about just opening a terminal in the right directory? Maybe (but that's a big maybe) you could already "pre-type" the command, so a user just has to hit "enter". But we need a shell around the application which will stay open in the background.

Also, the button will have to be renamed to "Launch terminal" etc.

probonopd commented 6 years ago

Opening a terminal that already has $PATH set, and printing a clear message in the opened terminal would probably be the best way to go, but for the short run it would be sufficient for me if the button appeared only for GUI apps, that is, in all cases in which we do not positively find Terminal=true in the desktop file (which can be either Terminal=false or no Terminal= or no desktop file at all, and possibly other situations).

TheAssassin commented 6 years ago

The problem with all these approaches begins with the fact that there is no cross-platform way of opening a terminal. I guess that's again something to add to libDE.

probonopd commented 6 years ago

Another argument then for

it would be sufficient for me if the button appeared only for GUI apps