[WIP] Fix opening files, as xdg-open fails for terminal programs.
#2235
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The issue
When using
rofi -show filebrowser, opening a file silently fails if the associated program is a terminal program. In my case, associatingresults in files not being open. A little digging revealed
file_browser_mode_resultinmodes/filebrowser.c, therun_in_termargument is alwaysFALSEIf I manually set it to 1, the text file is opened in Vim as I would expect. But seeing if
run_in_termshould be set would require parsing the associated programs .desktop entry.Suggestion
I suggest that instead of
xdg-open, the Gio functionlaunch_default_for_uriis used for opening regular files in their associated programs (this PR).Possible problem
Rofi only uses its
rofi-sensible-terminalscript, 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.