SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2015-09-07 13:13:04

ghorvath
#! Member
Registered: 2015-05-20
Posts: 53

[Solved] Midnight Commander should open files in background

I am using Midnight commander (mc) to have a 2-panel file manager. I can open any file by simply pressing ENTER on them. However, when I do this, then Midnight Commander shows the shell output, and I cannot use mc anymore, until I close the program which opened the file. E.g. I open a doc file, then it starts libreoffice, and I cannot use mc for browsing until libreoffice is not closed.

However if libreoffice is already running, then I can open any doc file and will get mc back and can open new doc files with it. I asked around and some people told me that this is the default behaviour of their Midnight Commander (even for starting the program they get mc back for browsing). I even managed to get my hands on an ini file they use, but using that file as configuration file, it still did not let me get back to mc when I opened a first doc file and libreoffice started running.
(This other guy is also running debian jessie (with xfce, not bl), and has the same version of mc as I use: 3:4.8.13-3)

Does anyone know why this is happening?

Last edited by ghorvath (2015-09-11 15:58:36)

Offline

Be excellent to each other!

#2 2015-09-07 16:04:53

ostrołęk
CB Member
Registered: 2015-08-13
Posts: 110

Re: [Solved] Midnight Commander should open files in background

Offline

#3 2015-09-07 16:42:28

brontosaurusrex
#! Red Menace
Registered: 2012-06-15
Posts: 1,643

Re: [Solved] Midnight Commander should open files in background

Offline

#4 2015-09-09 07:07:43

ghorvath
#! Member
Registered: 2015-05-20
Posts: 53

Re: [Solved] Midnight Commander should open files in background

#!/bin/bash
nohup xdg-open "$@" >/dev/null &

Last edited by ghorvath (2015-09-09 11:00:50)

Offline

#5 2015-09-09 18:30:30

brontosaurusrex
#! Red Menace
Registered: 2012-06-15
Posts: 1,643

Re: [Solved] Midnight Commander should open files in background

It appears that selecting 'commands/Edit extension file' and adding '&' to 'open' lines (and probably the dev/null part as well) might be a path worth investigating.

Last edited by brontosaurusrex (2015-09-09 18:31:17)

Offline

#6 2015-09-10 16:52:04

ghorvath
#! Member
Registered: 2015-05-20
Posts: 53

Re: [Solved] Midnight Commander should open files in background

export DE=xfce && mc

Offline

#7 2015-09-10 21:24:23

brontosaurusrex
#! Red Menace
Registered: 2012-06-15
Posts: 1,643

Re: [Solved] Midnight Commander should open files in background

@ghorvath: I see, quite an effort so far.

Offline

#8 2015-09-10 21:39:43

twoion
Emerald Caffeine
From: 星界
Registered: 2012-05-11
Posts: 1,648

Re: [Solved] Midnight Commander should open files in background

Offline

#9 2015-09-11 12:20:33

ghorvath
#! Member
Registered: 2015-05-20
Posts: 53

Re: [Solved] Midnight Commander should open files in background

If anyone is interested, I have found a workaround. Mount the necessary directory of your sftp server with sshfs to somewhere locally, and then you can browse it in mc as if it were a local directory, and mc would behave (provided you start with defining variable DE) as you would expect. It is still interesting, though, why setting variable DE does not work always in Bunsenlabs without this hack.

How can I mark this thread solved?

Edit: Ok, in the end I have found the reason why it was not always working. I was using sometimes sftp on servers which are only ssh-servers but not sftp servers. And then it failed. However, when I used a simple shell connection to these servers, then everything really works as intended (provided one defines the DE variable before starting mc).

That is, the solution: start mc with

export DE=xfce && mc

(you might as well put a line into ~/.bash_aliases) and then use shell connections instead of sftp connections whenever possible. Then (as far as I can tell) you can open files by pressing ENTER and you always get mc back, as well. The workaround is not needed anymore, but it might be nice to have anyway.

Last edited by ghorvath (2015-09-13 07:26:00)

Offline

#10 2015-09-11 13:12:45

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: [Solved] Midnight Commander should open files in background

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: bleh

Debian Logo