You are not logged in.

#1 2022-08-15 23:02:24

gnome_is_ugly
Member
Registered: 2022-08-12
Posts: 14

How to make nnn use feh with options?

When I open nnn and press on some image, it opens with feh. Problem is, I don't want it to open just feh, I want feh with my own options (like with fixed window size, and some more options). I have alias for feh, but I don't know how to make nnn use it.
Also, how to make it open .txt (and some other files which I know contains text) in new terminal window in vim (instead of opening it in browser)?

Last edited by gnome_is_ugly (2022-08-15 23:12:12)

Offline

#2 2022-08-15 23:29:37

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

Re: How to make nnn use feh with options?

Aliases aren't relevant.  Nnn uses xdg-open (for most files) so you need to configure xdg-open to do what you want with image files.  And I think xdg-open relies on desktop files - so you can make your own feh or image viewer file with whatever settings you want:

https://wiki.archlinux.org/title/Desktop_entries


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2022-08-16 21:08:40

gnome_is_ugly
Member
Registered: 2022-08-12
Posts: 14

Re: How to make nnn use feh with options?

Sorry, I don't understand.
Say, I open nnn and see somegif.gif. When I press L button (or enter), it opens this gif in feh (first frame), instead of using mpv (for example). I googled a bit and the suggestion was to do the following:

xdg-mime default mpv.desktop ~/somegif.gif

That doesn't do anything.

xdg-mime default vim.desktop ~/sometext.txt

Also doesn't change anything. nnn still opens .txt files in firefox
Also feh opens images as "default feh", not as "feh with options I set".

Offline

#4 2022-08-16 21:56:11

dogknowsnx
Guest

Re: How to make nnn use feh with options?

Try

xdg-mime default mpv.desktop image/gif
xdg-mime default vim.desktop text/plain

As @Trilby already mentioned, if you want apps to open with custom commands by default, copy/create their '.desktop' file inside '$HOME/.local/share/applications/' and edit it accordingly.

Please be more specific about what it is that you don't understand...

Last edited by dogknowsnx (2022-08-16 22:32:26)

#5 2022-08-17 20:40:27

gnome_is_ugly
Member
Registered: 2022-08-12
Posts: 14

Re: How to make nnn use feh with options?

dogknowsnx wrote:

Try

xdg-mime default mpv.desktop image/gif
xdg-mime default vim.desktop text/plain

As @Trilby already mentioned, if you want apps to open with custom commands by default, copy/create their '.desktop' file inside '$HOME/.local/share/applications/' and edit it accordingly.

Please be more specific about what it is that you don't understand...

Thank you for reply. After reading wiki again I managed to make feh do what I want it to do (my fault). Problem is

xdg-mime query filetype ssh.txt

gives

test/plain

and

xdg-mime query default text/plain

gives

vim.desktop

But nnn still opens firefox when I press on .txt files.

Offline

#6 2022-08-17 21:37:18

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

Re: How to make nnn use feh with options?

What happens when you run `xdg-open ssh.txt` (in the same directory as that file)?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#7 2022-08-17 22:24:04

gnome_is_ugly
Member
Registered: 2022-08-12
Posts: 14

Re: How to make nnn use feh with options?

Trilby wrote:

What happens when you run `xdg-open ssh.txt` (in the same directory as that file)?

it opens vim (as if "vim ssh.txt"). But typing "nnn" in this directory and pressing enter (or L) on any txt file opens it in firefox.

Offline

#8 2022-08-18 00:14:32

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

Re: How to make nnn use feh with options?

That confirms it's an issue internal to nnn then.  I tried to review the code, but there are functions over 1000 lines long and I was getting a bit lost.  It *looks* like it's supposed to rely on xdg-open for such things but apparently there are exceptions.  You could direct your question upstream (the issue tracker on their github looks like the right place).


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#9 2022-08-18 08:28:58

dogknowsnx
Guest

Re: How to make nnn use feh with options?

Are you using the 'nuke' plugin, by any chance?

printenv | grep nnn

#10 2022-08-18 11:56:19

gnome_is_ugly
Member
Registered: 2022-08-12
Posts: 14

Re: How to make nnn use feh with options?

dogknowsnx wrote:

Are you using the 'nuke' plugin, by any chance?

printenv | grep nnn

No idea what 'nuke' plugin is.

printenv | grep nnn

gives nothing.

Offline

#11 2022-08-18 12:45:14

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

Re: How to make nnn use feh with options?

Wouldn't that need to be "grep -i nnn" or "grep NNN" in order to be informative?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#12 2022-08-18 12:56:13

dogknowsnx
Guest

Re: How to make nnn use feh with options?

Trilby wrote:

Wouldn't that need to be "grep -i nnn" or "grep NNN" in order to be informative?

printenv | grep nuke

tongue

#13 2022-08-18 16:43:39

gnome_is_ugly
Member
Registered: 2022-08-12
Posts: 14

Re: How to make nnn use feh with options?

printenv | grep nuke
printenv | grep NNN
printenv | grep -i nnn

none of those gives output.

Offline

Board footer

Powered by FluxBB