You are not logged in.

#1 2020-12-22 19:39:37

amaro
Member
From: xfce
Registered: 2014-05-09
Posts: 367

[SOLVED] midnight commander cannot open pdf html files

Hello everybody,

I cannot open pdf, html files in midnight commander with preferred applications (zathura, luakit). Exceptions are media files which open fine with mpv and doc files which open fine with openoffice.

I tried

export MC_XDG_OPEN=/usr/local/bin/nohup-open
Open=zathura %f 
Open=(zathura %f >/dev/null 2>&1 &)

Same for luakit.

Still if I type in the command line

zathura name.pdf

or

lesspipe.sh name.pdf

the file opens.

I also edited

/.config/mimeapps.list
 /usr/share/applications/mimeinfo.cache
xdg-mime query default application/pdf
org.pwmt.zathura.desktop
xdg-settings get default-web-browser
luakit.desktop

Did not help.
Pdf files will not open when pressing ENTER.
With html files when I press ENTER it opens the file with geany. Why?!

Any help is highly appreciated!
Thank you in advance!

Last edited by amaro (2020-12-23 21:17:34)

Offline

#2 2020-12-22 21:53:22

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,665

Re: [SOLVED] midnight commander cannot open pdf html files

Open=zathura %f 

Which mc.ext did you edit and do you have anoteher one in ~/.config/mc/mc.ext?

Online

#3 2020-12-22 21:54:33

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,599

Re: [SOLVED] midnight commander cannot open pdf html files

Put the following in your mimeapps.list?
application/pdf=zathura.desktop

edit:
The reason I pointed to mimeapps is you'll find out why 'html' files are opening in Geanny too.
BTW, I find using 'Open=(mupdf %f)' not very convenient for it occupies MC completely.
So, you could at least consider   'Open=(mupdf %f &)' which I still find a sloppy solution, but that's up to you;)
Also consider edit config files local and not system-wide.

Last edited by qinohe (2020-12-22 23:20:57)

Offline

#4 2020-12-23 11:28:03

amaro
Member
From: xfce
Registered: 2014-05-09
Posts: 367

Re: [SOLVED] midnight commander cannot open pdf html files

@qinohe

I tried 'Open=(mupdf %f &)' and putting 'mupdf.desktop' in the 'mimeapps.list'. Neither worked. Same with 'zathura'.

@seth

I edit the file from Command -> Edit extension file

Editing the file  in ~/.config/mc/mc.ext didn't help either.

Last edited by amaro (2020-12-23 11:32:55)

Offline

#5 2020-12-23 12:19:33

Archlin
Member
Registered: 2018-05-09
Posts: 67

Re: [SOLVED] midnight commander cannot open pdf html files

Should that not be something like

# Open PDF-files in external viewer.
type/^PDF
    Open=(yourviewer %f &)
   View=%view{ascii} pdftotext %f -

# html
regex/i/\.html?$
	Open= (yourbrowser %f &)

in your mc.ext ?

Last edited by Archlin (2020-12-23 12:54:11)

Offline

#6 2020-12-23 12:48:27

amaro
Member
From: xfce
Registered: 2014-05-09
Posts: 367

Re: [SOLVED] midnight commander cannot open pdf html files

It seems the problem is elsewhere.

I ran

$ which mc
/usr/local/bin/mc

I did

# mv /usr/local/bin/mc /usr/local/bin/mc.bak
renamed '/usr/local/bin/mc' -> '/usr/local/bin/mc.bak'

I reinstalled 'mc'.

Then

$ mc
bash: /usr/local/bin/mc: No such file or directory

I tried

$ /usr/bin/mc

and everything works fine.

So, how to make 'mc' to execute '/usr/bin/mc' and not 'usr/local/bin/mc'?

BTW, I have no idea how this occured in the first place.

Last edited by amaro (2020-12-23 12:51:03)

Offline

#7 2020-12-23 14:10:43

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,665

Re: [SOLVED] midnight commander cannot open pdf html files

Have /usr/bin above /usr/local/bin in $PATH, but that's not "correct", or alias mc to /usr/bin/mc but that's nonsense.
You simply should not have some random mc binary in /usr/local/bin - where does it come from, which "mc --version" is that?

Online

#8 2020-12-23 16:30:31

amaro
Member
From: xfce
Registered: 2014-05-09
Posts: 367

Re: [SOLVED] midnight commander cannot open pdf html files

Well, there is a difference

$ /usr/bin/mc --version
GNU Midnight Commander 4.8.25
Built with GLib 2.66.1
Built with S-Lang 2.3.2 with terminfo database
With builtin Editor
With subshell support as default
With support for background operations
With mouse support on xterm and Linux console
With support for X11 events
With internationalization support
With multiple codepages support
With ext2fs attributes support
Virtual File Systems:
 cpiofs, tarfs, sfs, extfs, ftpfs, sftpfs, fish, smbfs
Data types:
 char: 8; int: 32; long: 64; void *: 64; size_t: 64; off_t: 64;
$ /usr/local/bin/mc --version
GNU Midnight Commander 4.8.7
Built with GLib 2.60.3
Using the S-Lang library with terminfo database
With builtin Editor
With subshell support as default
With support for background operations
With mouse support on xterm and Linux console
With support for X11 events
With internationalization support
With multiple codepages support
Virtual File Systems: cpiofs, tarfs, sfs, extfs, ftpfs, sftpfs, fish
Data types: char: 8; int: 32; long: 64; void *: 64; size_t: 64; off_t: 64;

I can't even uninstall it

# Rns mc
checking dependencies...

Package (1)  Old Version  Net Change

mc           4.8.25-3      -7.05 MiB

Total Removed Size:  7.05 MiB

:: Do you want to remove these packages? [Y/n] 

How to get rid of it?

Offline

#9 2020-12-23 20:13:21

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,599

Re: [SOLVED] midnight commander cannot open pdf html files

You seem to work carelessly, anyway what error message do you get when removing MC.
Also paste full commands not parts of it, like 'Rns mc' I know you mean 'pacman -Rsn' but WTF.
If you'd be using '~/.config'  dir to store local MC config instead of editing global configs you'll be creating a much less error-prone environment.
Why is MC in '/usr/local/bin' in the first place? reason?

@Archlin. yes, but I suppose people using Arch read man pages, wiki's or other articles to gather  their info and know what you mean if info is posted, it looks like OP 'knows' what he/she's doing (looking at #1) and so who am I to play the teacher here. Also it wouldn't be my place because every Archer is a seasoned Linux-er already when he/she jumps this boat

Offline

#10 2020-12-23 20:18:16

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,665

Re: [SOLVED] midnight commander cannot open pdf html files

pacman -Qo /usr/local/bin/mc

if it's from some AUR .
Otherwise "uninstallation" is going to be some hassle, basically look up the mc package and then look for everything it puts into /usr in /usr/local. Ensure the files aren't owned by some other package and remove them.

Typically a /usr/local installation if from you running "configure; make; sudo make install" on the mc sources … about 8 years ago…

Online

#11 2020-12-23 20:25:52

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,599

Re: [SOLVED] midnight commander cannot open pdf html files

@seth, I would have wished to hear that from OP, guess we are in need of a spoiler button tongue

Offline

#12 2020-12-23 21:16:50

amaro
Member
From: xfce
Registered: 2014-05-09
Posts: 367

Re: [SOLVED] midnight commander cannot open pdf html files

Here is the solution I have found:

When I saw that the mc version is 4.8.7 I checked the /var/cache/pacman/pkg folder for it. There was not one.
Then I checked my drive for such package. Luckily there was a folder named mc-4.8.7.  There was not such package either. But all the installation files were there.

The I googled How to uninstall app from /usr/local/bin.
Found old arch thread here https://bbs.archlinux.org/viewtopic.php?id=92329

So I did cd to mc-4.8.7 folder.
Then ran

./configure
make
make uninstall

Then checked with

which mc

It was gone.
Rebooted.

Now everything is fine.

p.s. Lesson learned.
p.p.s. Thank you qinohe and seth!

Offline

Board footer

Powered by FluxBB