You are not logged in.

#1 2013-03-08 22:08:33

VeXe
Member
Registered: 2013-02-13
Posts: 27

Some Inconviniency in midnight commander.

I like midnight commander so much, but there's just a couple of things, that kinda bugs me and slow me down a bit...:s

1- How can I run something in the background, (say an flv) by a-highlighting it b-F2 c-@ (do something with it) Now if I type something like 'vlc &' vlc will run both '&' and the flv (in separate vlc instances)
Now I don't want that, I wanna type vlc & and run the highlighted flv in the background. Now I could just type its name in the command line and append it with a &, but what if the file name was too long?
I'm asking this, because if you open something, like an flv in the foreground and try to open something else, it willl compalin that the terminal is busy.

2- When I highlight multiple files (say mp3 or flv) and hit enter to execute them, say with vlc, I'll get an instance for vlc running the first file, when it finishes, I'll get another for the 2nd file, etc.
I don't want that, I just want one instant running all the things I choose to run.

Now I found that to be very inconvinient.
Has anybody found a way around them?

Thanks!

Offline

#2 2013-03-14 21:14:13

VeXe
Member
Registered: 2013-02-13
Posts: 27

Re: Some Inconviniency in midnight commander.

I managed to get around with mc pretty nicely, hope these will help someone like they did to me.

I managed to write a script for the linking problem @:
http://www.linuxquestions.org/questions … 175453641/

The inconvenient things don't longer exist @:
http://www.linuxquestions.org/questions … 175453289/

Offline

#3 2013-06-10 12:51:52

totolotto
Member
From: Hungary
Registered: 2012-11-13
Posts: 114

Re: Some Inconviniency in midnight commander.

I thought I found an answer here but now I am not sure.

Is it possible to use MC while the executed program is still running? For example I open a doc file in MC but I cannot use it until libreoffice is running. I tried the linked solution (editing extension file) but this did not work for me "vlc is started in its own session so I can continue using MC if I need to." What am I missing?

Offline

#4 2013-06-10 17:36:34

bohoomil
Member
Registered: 2010-09-04
Posts: 2,376
Website

Re: Some Inconviniency in midnight commander.

You need to background the application:

vlc %f &

Just for the record: The list of commands can be found in /usr/lib/mc/ext.d/*sh files. You may want to modify your local mc.ext file appropriately, otherwise your custom settings will be overwritten during mc's update.


:: Registered Linux User No. 223384

:: github
:: infinality-bundle+fonts: good looking fonts made easy

Offline

#5 2013-06-12 06:16:43

totolotto
Member
From: Hungary
Registered: 2012-11-13
Posts: 114

Re: Some Inconviniency in midnight commander.

Thanks but I still have 2 issues:

1. I do not know exactly why but "command %f &" does not always work, for example" mplayer %f &" does nothing.

2. Anyway, my original goal was to open file from MC otherwise I would simply use the terminal. What do I need to modify in video.sh for example?

#!/bin/sh

# $1 - action
# $2 - type of file

action=$1
filetype=$2

[ -n "${MC_XDG_OPEN}" ] || MC_XDG_OPEN="xdg-open"

do_view_action() {
    filetype=$1

    case "${filetype}" in
    *)
        mplayer -identify -vo null -ao null -frames 0 "${MC_EXT_FILENAME}" 2>&1 | \
            sed -n 's/^ID_//p'
        ;;
    esac
}

do_open_action() {
    filetype=$1

    case "${filetype}" in
    ram)
        (realplay "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
        ;;
    *)
        if [ -n "$DISPLAY" ]; then
            (mplayer "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
        else
            mplayer -vo null "${MC_EXT_FILENAME}"
        fi
        #(gtv "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
        #(xanim "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
        ;;
    esac
}

case "${action}" in
view)
    do_view_action "${filetype}"
    ;;
open)
    "${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" 2>/dev/null || \
        do_open_action "${filetype}"
    ;;
*)
    ;;
esac

Offline

#6 2013-06-12 14:54:34

bohoomil
Member
Registered: 2010-09-04
Posts: 2,376
Website

Re: Some Inconviniency in midnight commander.

totolotto wrote:

Thanks but I still have 2 issues:

1. I do not know exactly why but "command %f &" does not always work, for example" mplayer %f &" does nothing.

So use it this way instead:

(mplayer %f >/dev/null 2>&1 &)

2. Anyway, my original goal was to open file from MC otherwise I would simply use the terminal. What do I need to modify in video.sh for example?

You shouldn't need to touch this file. Instead, create a rule in your local mc.ext, like this:

shell/i/.avi
  Open=(mplayer %f >/dev/null 2>&1 &)

Use a similar entry for other extensions: mp4, rmvb, etc. Of course, remember to remove existing references to video.sh.

Last edited by bohoomil (2013-06-12 15:12:27)


:: Registered Linux User No. 223384

:: github
:: infinality-bundle+fonts: good looking fonts made easy

Offline

#7 2013-06-12 15:16:13

totolotto
Member
From: Hungary
Registered: 2012-11-13
Posts: 114

Re: Some Inconviniency in midnight commander.

Perfect, thanks for your help!

Offline

#8 2013-06-13 05:52:35

gothmog123
Member
Registered: 2012-10-31
Posts: 106

Re: Some Inconviniency in midnight commander.

Even with that code, mplayer is killed if you exit MC. Is there any way to prevent that?

Offline

#9 2013-06-13 06:45:49

bohoomil
Member
Registered: 2010-09-04
Posts: 2,376
Website

Re: Some Inconviniency in midnight commander.

I can't reproduce that: for me everything is working OK in urxvt and termite, with and without multiplexer (tmux), even when I quit the terminal itself…


:: Registered Linux User No. 223384

:: github
:: infinality-bundle+fonts: good looking fonts made easy

Offline

#10 2013-06-13 15:36:14

bohoomil
Member
Registered: 2010-09-04
Posts: 2,376
Website

Re: Some Inconviniency in midnight commander.

OK, got it: this doesn't occur with mplayer2 I'm actually using (and forgot to mention -- sorry). For anything else, you may need to use detach:

detach foo

should do the trick.

Last edited by bohoomil (2013-06-13 16:14:45)


:: Registered Linux User No. 223384

:: github
:: infinality-bundle+fonts: good looking fonts made easy

Offline

#11 2013-06-14 02:05:26

gothmog123
Member
Registered: 2012-10-31
Posts: 106

Re: Some Inconviniency in midnight commander.

Thanks for that. Works like a charm. Always wanted to use mc but this issue kept me away.

Offline

#12 2014-11-18 11:35:46

AleXoundOS
Member
From: Russia
Registered: 2009-07-18
Posts: 31
Website

Re: Some Inconviniency in midnight commander.

(evince %f > /dev/null 2>&1 &)

is the real solution to get rid of annoying stderr output from applications.
Placing "2>&1" before "/dev/null" did not work. Thank you for the tip to place it after.

Offline

Board footer

Powered by FluxBB