leo-arch/clifm

Default pdf viewer

x61 opened this issue · 4 comments

x61 commented

How do I set sioyek as my default pdf viewer? Each time I open a pdf file, zathura is opened. I noticed that zathura is among the applications called for viewing pdf files in mimlist.clifm file so I stripped everything off to only have sioyek but it still opens in pdf files in zathura.
X:.*/pdf$=sioyek
I exited clifm and came back in but the change did not take effect. Is this the right file to make this change? How do I get the change to take effect?

On a separate note, how do I unassign ll that toggles long view? I want to define a different command for long view and a separate command for horizontal view. Is that possible?

Thank you

Hi @x61.

The rules for reading the mimelist file are quite simple:

  1. It's read top to bottom and left to right (the first existing application in the first matching rule will be used).
  2. Applications are checked for existence. If an app does not exist, it is skipped.

According to the above

  • make sure your pdf rule (X:.*/pdf$=sioyek) is actually reached (maybe some previous rule is being matched instead). To be sure, move your rule to the top of the file (thoug I don't think this is required).

  • make sure sioyek is actually installed and the executable's path is in PATH. You can try specifying the whole path: X:.*/pdf$=/usr/bin/sioyek.

  • If you're not running on a graphical environment negate X: !X:.*/pdf$=/usr/bin/sioyek, or .*/pdf$=/usr/bin/sioyek to make this rule valid for both graphical and non-graphical environments.

  • If the pdf rule fails, the last rule in the file (Fallback) will be used, in which case it is probably running xdg-open, which most probably is calling zathura to open PDF files. Now, if the pdf rule is failing, it might be because the file you're trying to open is not an actual PDF file (despite having a .pdf extension). Run mm info FILE (or file --mime-type FILE) to find it out. It might also happen that your file is returning a different (somehow unexpected) mime type (though as far as I know there's only one mime type for PDF files: application/pdf).

  • If the rule keeps failing for some reason, you can also try to match file names (in this case all files with a .pdf extension) instead of mime types using the N keyword: X:N:.*\.pdf$=sioyek.

In case of need, take a look at the documentation for Lira (our resource opener).

I want to define a different command for long view and a separate command for horizontal view. Is that possible?

Yes it is. Using aliases (much like you do in bash and other shells) you can reassign commands however you like. For example, to use lv instead of ll to toggle long view, and reassing ll to some other command, edit the config file (F10) and add these lines;

alias lv='ll'
alias ll='CMD'
x61 commented

Thank you very much for the prompt response. I moved the line up but still no effect so i ended up uninstalling zathura and it opened successfully in sioyek. Does clifm reload automatically after making changes in mimelist or do we have to close and reopen clifm for it to take effect.

Also, if I alias lv='ll', does that not still toggle long view each time lv command is executed? How would I get non-long view mode if I were to assign a key for that? I understand that ll toggles but I just want to assign a key for long view and a separate key for horizontal view. In other words, can I have the following?:
alias lv=long-view and alias hv=horizontal-view

You're welcome.

Does clifm reload automatically after making changes in mimelist

Yes, it does.

I just want to assign a key for long view and a separate key for horizontal view

There's a single command (ll) to toggle long-view on/off (also the Alt-l keybinding). However, you can still have something like this:

alias lv='ll on'
alias hv='ll off'

Btw, lv is by default another name for the ll command. Check ll --help.

x61 commented

Perfect. Thanks again