Skip to content

nnn as default file manager

Mischievous Meerkat edited this page Apr 23, 2019 · 14 revisions

nnn can be setup as your default file manager. The following procedure is tested on the XFCE4 desktop.

Create a script nwrap with the necessary exports

$ cat /usr/local/bin/nwrap
#!/bin/sh

# If you use pywal, you need to restore the scheme here
# (cat ~/.cache/wal/sequences &)

export NNN_USE_EDITOR=1
export NNN_BMS="D:~/Downloads;v:~/Videos"
export NNN_CONTEXT_COLORS="5236"
export NNN_IDLE_TIMEOUT=900
export NNN_PLAIN_FILTER=1
export NNN_NOTE='/home/vaio/.note'
export NNN_OPS_PROG=1
alias ncp="cat ~/.config/nnn/.selection | tr '\0' '\n'"

# Start nnn with your preferred options
nnn -isl "$@"

Make the script executable with chmod +x nwrap and drop nwrap in your PATH.

Create a script nnnfm to invoke nwrap in xfce4-terminal

$ cat /usr/local/bin/nnnfm
#!/bin/sh

xfce4-terminal -e "nwrap $@"

Make the script executable and drop nnnfm in your PATH.

You can now optionally set a keybind to launch nnnfm from your DE settings.

Create the nnn.desktop file

$ cat /usr/share/applications/nnn.desktop
[Desktop Entry]
Type=Application
Name=nnn
Comment=Launches the nnn file manager
Icon=utilities-terminal
Terminal=true
Exec=nnnfm
Categories=ConsoleOnly;System;FileTools;FileManager
MimeType=inode/directory;

Now got to the preferred applications menu from Settings (or run exo-preferred-applications -c) and select nnnfm as your default file manager.

On a Tiling Window Manager

If you are using a Tiling Window Manager like i3wm, bspwm or awesomewm you can launch nnn with a keyboard shortcut.

  1. Create a nwrap script.
  2. Drop the script in your PATH.
  3. On the keyboard shortcuts section of your WM config file, you need to add a shortcut to launch nwrap. Here's is an example for sxhkd, you need to change xfce4-terminal to the terminal you want to use:
# File Manager
super + n
       xfce4-terminal -e "nwrap $@"
You can’t perform that action at this time.