Skip to content

Conversation

@martinsifrar
Copy link
Contributor

@martinsifrar martinsifrar commented Nov 12, 2025

The issue

When using rofi -show filebrowser, opening a file silently fails if the associated program is a terminal program. In my case, associating

text/plain=nvim.desktop

results in files not being open. A little digging revealed file_browser_mode_result in modes/filebrowser.c, the run_in_term argument is always FALSE

helper_execute_command(cdir, cmd, FALSE, NULL);
                                   ^
                                   gboolean run_in_term

If I manually set it to 1, the text file is opened in Vim as I would expect. But seeing if run_in_term should be set would require parsing the associated programs .desktop entry.

Suggestion

I suggest that instead of xdg-open, the Gio function launch_default_for_uri is used for opening regular files in their associated programs (this PR).

Possible problem

Rofi only uses its rofi-sensible-terminal script, while GLib has a somewhat weird way of handling terminal selection (see https://gitlab.gnome.org/GNOME/glib/-/issues/2293), which could maybe trip up some users. Because of this, I denoted the PR as WIP.

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