Skip to content

nemo-view.c: Check all selected files before showing "Open With <app>" - #3853

Open
Fantu wants to merge 1 commit into
linuxmint:masterfrom
Fantu:open-with-mixed-selection
Open

Fantu wants to merge 1 commit into
linuxmint:masterfrom
Fantu:open-with-mixed-selection

Conversation

@Fantu

@Fantu Fantu commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

real_update_menus() shows the default application at the top of the context menu ("Open With ") only when every selected file opens in an external application. The loop over the selection read selection->data instead of l->data, so only the first selected file was checked.

Since show_app is also what reset_open_with_menu() uses as filter_default (#2350), a wrong value affects both the top item and the "Open With" submenu.

How to reproduce

  1. In Preferences > Behavior, select "Run executable text files when they are opened"
  2. In a folder, create a.sh (not executable) and b.sh (executable), sharing the same default application (e.g. gedit), and use the list view so that a.sh is listed first
  3. Select both files and open the context menu

Before:

  • the top item is "Open With gedit", but activating it opens a.sh in gedit and runs b.sh
  • gedit is missing from the "Open With" submenu, so there is no direct way to open both files in it
  • with the executable file listed first the menu is correct, so the result depends on the order of the selection

After:

  • the top item is "Open" and gedit is listed in the "Open With" submenu, whatever the order
  • choosing gedit there opens both files in it, without running anything
  • with two non-executable files nothing changes: "Open With gedit" at the top and gedit not repeated in the submenu

Testing

Tested in a VM on Debian unstable with nemo 6.6.4, rebuilt with only this change (the code is the same on master): both orders of the selection, "Open With > gedit" on the mixed selection, and two non-executable files as a regression check.

I found it while checking about Debian bug #946870, the single-file case already fixed by #2350.

real_update_menus() shows the default application at the top of the
context menu ("Open With <app>") only when every selected file opens in
an external application, but the loop over the selection read
selection->data instead of l->data, so only the first file was checked.

With "Run executable text files when they are opened" enabled and a
selection of files sharing the same default application, where the first
file opens in the application and another one is executable, the menu
showed "Open With <app>", but activating it ran the executable file
instead of opening it. Since show_app is also passed to
reset_open_with_menu() as filter_default (linuxmint#2350), the default
application was missing from the "Open With" submenu too. With the
executable file first in the selection, the menu was already correct.

Assisted-by: Claude Code:claude-opus-5-5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant