Hacking noice: fast cmdline file browser

terminalnoice is a minimal file browser for those who don’t like to type cd ... to reach a file, then open it; or one who doesn’t like to open a file browser and keep clicking to find and open a file. noice reduces the effort to pressing the arrow keys. Originally noice is written as a utility having minimal interactions with X. For example, image files are opened with feh. Considering most people use X and love to use to GUI apps when it makes sense, I have forked a branch with some changes of my own.

For example, instead of opening unrecognized files with less, it makes more sense to open files with xdg-open on Ubuntu or gnome-open in the Gnome environment. Let’s face it, when you select a file, you want it to be opened or played in the player of your choice. That’s what xdg-open and its friends do for you.

In its current status, noice is mostly about fast navigation and opening files. So I made it more mime friendly by introducing the option to use xdg-open and family. However, note that you can open the shell anytime within the current directory for advanced operations.

noice features

  • Browse current or specified directory
  • Navigate to parent or child directories
  • Jump to first or last entry
  • Open files with default-associated programs
  • Jump to home directory
  • Filter contents in current directory
  • Show/hide hidden files
  • Sort entries by time modified
  • Spawn a shell in current directory
  • Run top
  • Open a file with vim or less

You can find the original development of branch here.

My modifications

  • Behaviour
    • Case-insensitive alphabetic content listing instead of upper case first.
  • File associations
    • Environment variable NOICE_OPENER to override all associations and open all files with your desktop environments default file opener. Examples:
      export NOICE_OPENER=xdg-open
      export NOICE_OPENER=gnome-open
      export NOICE_OPENER=gvfs-open
      

    All the following associations are ignored if NOICE_OPENER is exported.

    • Associate plain text files with vim (using file command)
    • Remove video file associations (to each his own favourite video player)
    • Associate common audio file types with lightweight fmedia
    • Associate PDF files with zathura
    • Removed less
    • Use environment variable NOICE_FALLBACK_OPENER to open other non-associated files
  • Compilation
    • Use -O3 for compilation, fixed warnings
    • Added compilation flag -march=native (compile only, no plans to package).
    • Remove generated config.h on make clean.

Installation

To install my fork of noice, either clone the branch:

$ git clone https://github.com/jarun/noice

or download the latest zip package.

You must compile it on the machine you want to run it on. There are certain optimizations that wouldn’t work otherwise. I don’t have any plans to release any generic packages either. You need gcc and the development package of libncurses.

To compile and install noice, run:

$ make
$ make install

Usage

Start with the man page for shortcuts:

$ man noice

As you’ll notice, you’ll need only the arrow keys for navigation and opening files. The current item is preceded by >.

Export any of the following environment variables to set a generic mime handler as you need:

NOICE_OPENER
NOICE_FALLBAK_OPENER

To open the current directory in noice, run:

$ noice

To open a directory in noice, run:

$ noice path_to_dir

To quit, press q, to search for contents in the current directory matching a string, press /.

noice is extremely hackable, refer to the project readme on how to set your own custom file type associations.

On GitHub: noice

2 thoughts on “Hacking noice: fast cmdline file browser”

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s