You are not logged in.

#1 2018-10-29 04:09:16

aleksozolins
Member
Registered: 2018-09-28
Posts: 15

Can Midnight Commander Release the Terminal Upon Opening a File?

Fellow MC Users (not sure how many of you are out there if any!),

When I launch a file to view within Midnight Commander, the panels are hidden and the terminal is hogged until I break the process with Ctrl-C or close the launched application. Is there a way to have MC release the launched app outside the terminal so that it stays useable while the file is being viewed? Hope this question is sensible.

I know you can launch any terminal command as a background process by appending &. Just wondering if there's a way to launch files like this by default in MC.

Thanks in advance for any help!

Last edited by aleksozolins (2018-10-29 04:15:04)

Offline

#2 2018-10-29 11:55:13

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: Can Midnight Commander Release the Terminal Upon Opening a File?

man page of mc has lots of info, the section "screen selector" may interest you.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2018-10-29 12:37:31

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,412
Website

Re: Can Midnight Commander Release the Terminal Upon Opening a File?

Please read the relevant page on the wiki.


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#4 2018-10-29 14:21:18

aleksozolins
Member
Registered: 2018-09-28
Posts: 15

Re: Can Midnight Commander Release the Terminal Upon Opening a File?

Thanks for the help. I've made the script and exported and that seems to work with some file types, however I'm having some trouble with preferred apps now. For instance, if I select a PDF I'm presented with "/usr/lib/mc/ext.d/doc.sh: xpdf: line 106: xpdf: command not found".

xdg-open opens PDFs in evince just fine.

If I modift the doc.sh file and change the entry in line 107 from "acroread" to "evince", I'm still presented the same error.

Is there a way to just do away with MC_XDG_OPEN and just default to xdg-open?

Thanks again for the help.

Offline

#5 2018-10-29 14:47:36

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,522
Website

Re: Can Midnight Commander Release the Terminal Upon Opening a File?

Did you use the exact nohup-open script in the wiki?  That still uses xdg open.

What happens if you run `nohup xdg-open /path/to/a_document.pdf &` on the command line?

Last edited by Trilby (2018-10-29 14:50:55)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#6 2018-10-29 15:11:52

aleksozolins
Member
Registered: 2018-09-28
Posts: 15

Re: Can Midnight Commander Release the Terminal Upon Opening a File?

Running that from the command line works perfectly.

Confused now. I don't believe I changed a thing except for quitting and restarting MC. MC is back to using XDG-Open properly, but the Terminal instance is being held again. I used the same exact script as in the wiki in my ~/bin directory. I ran the export command from the terminal. I'm sure I'm missing something obvious.

Offline

#7 2018-10-31 23:04:31

seth
Member
Registered: 2012-09-03
Posts: 50,996

Re: Can Midnight Commander Release the Terminal Upon Opening a File?

The xdg-open call in doc.sh (please do not edit the file, changes will be overridden) blocks (probably for a reason) and do_open_action is not called, because there's xdg-open.
You could probably export MC_XDG_OPEN to some wrapper script that calls

xdg-open "$@" &

to for it

Online

Board footer

Powered by FluxBB