lxqt / lxqt-archiver

A simple & lightweight desktop-agnostic Qt file archiver
https://lxqt.github.io
GNU General Public License v2.0
38 stars 30 forks source link

only uses xterm when default program has Terminal=true #366

Open SArpnt opened 1 year ago

SArpnt commented 1 year ago

if the default program to open a file has Terminal=true in the desktop entry, lxqt-archiver will only try to use xterm as the terminal, and fail if it isn't found. there's no way to select a different terminal. (this is probably because xterm is the first entry in the libfm terminals.list)

Expected Behavior

double clicking a file should open the file in the default program, regardless of what terminal emulator is default

Current Behavior

when trying to open a file in an archive where the default program should open in a terminal, it gives an error message saying xterm couldn't be opened.

Possible Solution

ideally, use $TERMINAL to find the correct terminal emulator, and if it's unset try every option in the libfm-qt terminals.list.

if trying every terminal in the terminals.list isn't possible for some reason, then add a settings option to set the terminal emulator, since people might not know to set the $TERMINAL variable.

if no terminal is found, ideally let the user select a terminal emulator from their installed programs the same way they can select default programs to open files in pcmanfm-qt, or at least guide them to whatever settings option is available

Steps to Reproduce
  1. create a desktop entry that uses Terminal=true, such as this:
    [Desktop Entry]
    Name=Kakoune
    Exec=kak
    Terminal=true
  2. set the program as the default program for text/plain. this can be done in .config/mimeapps.list
  3. open an archive with a text file in it, then try to open the text file by double clicking, without extracting it. lxqt-archiver will try to open xterm, and fail if it can't
Context

i use kakoune as my text editor, which only runs in a terminal, so the desktop file for it has Terminal=true. i don't have xterm, i'm on wayland and my only terminal emulator is foot. i have the TERMINAL environment variable set to foot. xdg-open opens kakoune properly with a text file, pcmanfm-qt can open it after tweaking the libfm terminals.list file, but lxqt-archiver only tries xterm.

System Information
tsujan commented 1 year ago

lxqt-archiver shouldn't have offered execution of files in the first place — it does just because there's no code in it to prevent that. By definition, an archive manager is for managing archives, not executing files. The right-click menu-item also reads "View Selected Items".

The rest of this comment is for clarification.

ideally, use $TERMINAL to find the correct terminal emulator,

A long time ago, LXQt devs agreed that $TERMINAL wasn't good. In LXQt, the default terminal is set by qtxdg-mat. However, apps like pcmanfm-qt and lxqt-archiver can't use it because they aren't and shouldn't be dependent on libqtxdg (they may be used outside LXQt).

pcmanfm-qt can open it...

Because it has an option for it. Being a separate app, lxqt-archiver shouldn't read its config file.

SArpnt commented 1 year ago

i'm not executing the text file, i'm trying to view the text file in my text editor, which happens to run in a terminal. i never said that lxqt-archiver should read the pcmanfm-qt config file either.

what way am i supposed to view and edit files in an archive with various owners and permissions? if lxqt-archiver isn't supposed to do that, what is it supposed to do?

tsujan commented 1 year ago

i'm not... never said...

There was no assumption in my previous comment about what you did or said. I clarified how things are, why they are so, and where the problem is (first paragraph).

what way am i supposed to view

You could view desktop entries, instead of executing them (e.g., in terminal), by clicking "Open" in the execution dialog:

exe

But, as I said, showing this dialog is a problem in lxqt-archiver; it should have just opened the file without asking the user, as it opens a non-executable file.

and edit files in an archive

Editing files inside archives isn't supported yet (I added it to git Arqiver recently, but that code can't be used here).

EDIT:

If you mean viewing text files only by using a terminal-based editor, until this problem is fixed, there are only two ways: installing xterm (which works under Wayland too) or, provided that your terminal-based editor supports drag-and-drop, by dropping the item into it.

Actually, there are two interrelated problems, one of which may be fixed in lxqt-archiver, while the other one may be related to https://github.com/lxqt/libqtxdg/issues/264 (at least inside an LXQt session).