Skip to content

A light, opinionated, responsive, theme-able, and simple Text User Interface (TUI) file manager for Linux and macOS

License

Notifications You must be signed in to change notification settings

andornaut/filectrl

Repository files navigation

FileCtrl

FileCtrl is a light, opinionated, responsive, theme-able, and simple Text User Interface (TUI) file manager for Linux and macOS

image

Installation

You can download and install a pre-built binary for Linux or macOS:

curl -sL https://github.com/andornaut/filectrl/releases/download/main/filectrl-linux -o filectrl
chmod +x filectrl
sudo mv filectrl /usr/local/bin/

On macOS, allow the unsigned filectrl binary to be executed:

xattr -d com.apple.quarantine filectrl

Building

  1. git clone and cd into this repository
  2. Run cargo build --release && sudo cp target/release/filectrl /usr/local/bin/

Usage

Run filectrl --help to view the available command line arguments and options:

Usage: filectrl [<directory>] [-c <config>] [--write-config]

FileCtrl is a light, opinionated, responsive, theme-able, and simple
Text User Interface (TUI) file manager for Linux and macOS

Positional Arguments:
  directory         path to a directory to navigate to

Options:
  -c, --config      path to a configuration file
  --write-config    write the default config to ~/.config/filectrl/config.toml,
                    then exit
  --help            display usage information

Copy / paste

When you copy/cut a file or directory, FileCtrl puts ${operation} ${path} into your clipboard buffer (where operation is "cp" or "mv"). If you then paste into a second FileCtrl window, this second instance of FileCtrl will perform the equivalent of: ${operation} ${path} ${current_directory}, e.g. cp filectrl.desktop ~/.local/share/applications/. Under the hood, FileCtrl doesn't actually invoke cp or mv, but implements similar operations using the Rust standard library.

Keyboard controls

Normal mode

Keys Description
q Quit
/ h, / j, / k, / l Navigate left, down, up, right
~ Go to home directory
/ b / Backspace Go to parent directory
/ f / l / Enter / Space Open the selected file using the default application configured in your environment, or navigate to the selected directory
o Open the selected file using the program configured by: templates.open_selected_file
Home / g / ^ Select first row
End / G / $ Select last row
z Select middle of visible rows
Ctrl+f / Ctrl+d / PgDn Scroll down one page
Ctrl+b / Ctrl+u / PgUp Scroll up one page
Delete Delete the selected file or directory
/ Filter by name
Ctrl+r / F5 Refresh the current directory
r / F2 Rename the selected file or directory
w Open a new filectrl window in the terminal configured by: templates.open_new_window
t Open the current directory in the program configured by: templates.open_current_directory
a, c, p Clear alerts, clipboard content, or progress bars
Ctrl+c, Ctrl+x, Ctrl+v Copy/Cut/Paste selected file or directory
n, m, s Sort by name, modified date, or size
? Toggle help

Filtering / Renaming mode

Keys Description
Esc Cancel and exit filtering/renaming mode
Enter Submit your input and exit filtering/renaming mode
/ Move cursor
Ctrl+ / Ctrl+ Move cursor by word (delimited by whitespaces or punctuation)
Home / End Move cursor to beginning/end of line
Shift+ / Shift+ Select text
Shift+Home / Shift+End Select to beginning/end of line
Ctrl+Shift+ / Ctrl+Shift+ Select by word (delimited by whitespaces or punctuation)
Ctrl+a Select all
Ctrl+c, Ctrl+x, Ctrl+v Copy/Cut/Paste text
Backspace / Delete Delete character before/after cursor

Configuration

The configuration is drawn from the first of the following:

  1. The path specified by the command line option: --config-path
  2. The default path, if it exists: ~/.config/filectrl/config.toml
  3. The built-in default configuration

Run filectrl --write-config to write the default configuration to ~/.config/filectrl/config.toml.

Opening in other applications

Keyboard key Description
f Open the selected file using the default application configured in your environment
o Open the selected file using the program configured by: templates.open_selected_file
t Open the current directory in the program configured by: templates.open_current_directory
w Open a new filectrl window in the terminal configured by: templates.open_new_window
[templates]
# Programs to use to open files or directories:
# %s will be replaced by the path to the current working directory:
open_current_directory = "alacritty --working-directory %s"
open_new_window = "alacritty --command filectrl %s"
# %s will be replaced by the path to the selected file or directory:
open_selected_file = "pcmanfm %s"

Theming

All colors can be changed by editing the configuration file:

filectrl --write-config
vim ~/.config/filectrl/config.toml

You can see all of the available theme variables in the default configuration.

Desktop entry

You can make filectrl the default application for opening directories. Start by copying the filectrl.desktop file to ~/.local/share/applications/:

cp filectrl.desktop ~/.local/share/applications/
xdg-mime default filectrl.desktop inode/directory
update-desktop-database ~/.local/share/applications/

Developing

cargo clippy
cargo fix --allow-dirty --allow-staged
cargo test
cargo run
cargo build --release
./target/debug/filectrl

# Log to ./err
RUST_LOG=debug cargo run 2>err

Git hooks

Changing cargo-husky configuration:

  1. Edit the [dev-dependencies.cargo-husky] section of Cargo.toml
  2. rm .git/hooks/pre-commit (or other hook file)
  3. cargo clean
  4. cargo test
  5. Verify that the changes have been applied to .git/hooks/pre-commit

About

A light, opinionated, responsive, theme-able, and simple Text User Interface (TUI) file manager for Linux and macOS

Topics

Resources

License

Stars

Watchers

Forks

Languages