Ranger – open_with without suspending

When I open a file into ranger with a GUI application not listed in the rifle.conf file (i.e. using the open_with command), the ranger terminal window gets “suspended” until I close the GUI app.

For this reason, I’d like to have a way to open files with a specific application, but still get the ability to navigate the files in the ranger terminal.

This is the default behaviour when you open the same file with one of the application listed in the rifle.conf file.

Is there any way to achieve the goal?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Try open_with with the f or t flag:

open_with [application] [flags] [mode]

Open the selected files with the given application, unless it is omitted, in which case the default application is used. flags
change the way the application is executed and are described in their
own section in this man page. The mode is a number that specifies
which application to use. The list of applications is generated by the
external file opener “rifle” and can be displayed when pressing “r” in
ranger.

Note that if you specify an application, the mode is ignored.

Flags give you a way to modify the behavior of the spawned process. They are used in the commands :open_with (key “r”) and :shell
(key “!”).

 f   Fork the process.  (Run in background)
 c   Run the current file only, instead of the selection
 r   Run application with root privilege (requires sudo)
 t   Run application in a new terminal window

Method 2

You can see here: Ranger, open file freeze the terminal

The accepted answer there is:

It seems to be, based on an sample rifle.conf file I found, that you’d need the f flag to ask Ranger to Fork the program, make it run in the background:

ext png, flag f = viewnior "<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f8dcb8">[email protected]</a>"

Method 3

I have solved the issu by adding & at the end.

ext png, flag f = viewnior "<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="745034">[email protected]</a>" &

The “&” force the program to be run in th backgournd.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x