Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening a single file opens all files using specific desktop entries #2771

Open
zsugabubus opened this issue Jun 18, 2021 · 8 comments
Open

Comments

@zsugabubus
Copy link
Contributor

zsugabubus commented Jun 18, 2021

 * 5.0.1
 * Windowed
 * Arch Linux
 * 64 bit

Issue
Opening a single file, either:

  • Passes many filenames to a single program. (E.g. %F)
  • Starts many programs with single filenames. (E.g. %u)

So basically clicking on a single file behaves like I'd open all files in the directory.

Steps to reproduce

  1. Pick a desktop entry file that has Exec=...%F or %u specifiers. (grep %[Fu] -r /usr/share/applications).
  2. Open a file with this program and you should face with the above mentioned issue.

Expected behaviour
Only a single program is started with the only selected filename.

Other information
I have updated from 4.8.4, where it worked well.

I noticed this issue with a custom feh.desktop file that has Exec=feh %F. Previously it opened only the selected files (or a single file when I had clicked on a single file), but now it opens all files in the directory.

I deleted my custom desktop file so it used /usr/share/applications/feh.desktop that has Exec=feh %u. Now clicking on a single file opens separate feh processes for each picture in the directory.

@bleck9999
Copy link

bleck9999 commented Jun 18, 2021

Can reproduce on arch with nemo 5.0.1, with Exec=feh --start-at %u it opens a seperate process for each file though changing it to Exec=feh %F fixed the issue for me.

@mtwebster
Copy link
Member

Can you try running the following command:

gsettings set org.nemo.preferences image-viewers-with-external-sort "[]"

and try to reproduce.

Nemo was changed to allow the sort order in nemo to be maintained when passing multiple files to the image viewer here: 3cb59f8

It seems to fix feh for me (the default is ['xviewer', 'feh', 'sxiv']).

The behavior you're reporting is actually how our xviewer works (and how I expect it to) when opening a single image in a folder, but we shouldn't change existing behavior for other programs.

@bleck9999
Copy link

After running the command only the selected image is opened, even after reverting the .desktop file for feh.

@mtwebster
Copy link
Member

So I'm curious, why is the new behavior an issue? It's not actually using any more memory (it doesn't load images until they're selected).

I'm somewhat disinclined to change this back, particularly if it is really undesirable for someone, it can be disabled anyhow.

@bleck9999
Copy link

Because without changing the desktop entry or the image-viewers-with-external-sort setting it would spawn ~200 windows to open every image in the folder when I only wanted to open one image or pass an excessive amount of arguments to one process.
Personally I'm fine with just using gsettings to disable it, but for what it's worth when using sxiv with external sort enabled it only has the requested image as an argument whether using %F or %u, so this behaviour seems to be specific to feh (for example in a folder with 4 jpg files with %F then it's invoked as feh /tmp/tmp.T5h8T7Lvmr/1.jpg /tmp/tmp.T5h8T7Lvmr/2.jpg /tmp/tmp.T5h8T7Lvmr/3.jpg /tmp/tmp.T5h8T7Lvmr/4.jpg and with %u it's invoked in 4 processes; feh /tmp/tmp.T5h8T7Lvmr/1.jpg, feh /tmp/tmp.T5h8T7Lvmr/2.jpg etc. creating a seperate window for each one)
The behaviour when trying to open a single image with %u is functionally equivalent to selecting every image in the folder and opening with feh, which is undesirable.

mtwebster added a commit that referenced this issue Jun 18, 2021
viewer launch if its commandline supports multiple files.

As a result of #2705, when
a single image file is selected and launched, the full file list
for the current directory is appended for certain viewers.

This is a problem if the viewer's desktop file  Exec line doesn't
support multiple files, as it can cause multiple instances of
a program to launch when that was not the intent.

Only apply this new behavior if the Exec line accepts multiple
files (%U and %F).

ref: #2771
@mtwebster
Copy link
Member

With 8b9cdfc, I've made this new behavior only apply if the command line accepts a list of files (%F or %U), otherwise the old behavior is kept.

Since only the selected image is loaded even when receiving an entire file list, I've left that behavior alone, as it's essentially the same as previous behavior.

@bleck9999
Copy link

👍 Works as expected with %u and external sorting enabled.

@zsugabubus
Copy link
Contributor Author

Thanks for the quick feedback and fix. Now I understand that is not a bug but a (great) feature.

At first, it was just strange and I thought this behavior is not specific to images but to all kind files.

After all, I think it is good that feh %u does not spawn a few hundred processes accidentally, so this issue report worth something at least. For my part, issue can be closed. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants