Skip to content

Commit

Permalink
Merge pull request #85 from qkzk/v0.1.23-dev
Browse files Browse the repository at this point in the history
V0.1.23 dev
  • Loading branch information
qkzk authored Nov 11, 2023
2 parents 266ccc4 + d6833e6 commit 4a8b8b2
Show file tree
Hide file tree
Showing 53 changed files with 4,549 additions and 3,272 deletions.
1,488 changes: 727 additions & 761 deletions Cargo.lock

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fm-tui"
version = "0.1.22"
version = "0.1.23"
authors = ["Quentin Konieczko <[email protected]>"]
edition = "2021"
license-file = "LICENSE.txt"
Expand Down Expand Up @@ -30,21 +30,21 @@ fs_extra = "1.2.0"

[dependencies]
anyhow = "1.0.28"
cairo-rs = { version = "0.15", features = ["png", "pdf"] }
chrono = "0.4.31"
clap = { version = "4.0.2", features = ["derive"] }
content_inspector = "0.2.4"
copypasta = "0.8.1"
flate2 = "1.0"
fs_extra = "1.2.0"
futures = "0.3"
gag = "1.0.0"
indicatif = { version = "0.17.1", features= ["in_memory"] }
lazy_static = "1.4.0"
log = { version = "0.4.0", features = ["std"] }
log4rs = { version = "1.2.0", features = ["rolling_file_appender", "compound_policy", "size_trigger", "fixed_window_roller"] }
nvim-rs = { version = "0.3", features = ["use_tokio"] }
pathdiff = "0.2.1"
pdf-extract = "0.6.4"
pgs-files = "0.0.7"
poppler = "0.3.2"
rand = "0.8.5"
regex = "1.6.0"
rust-lzma = "0.5.1"
Expand All @@ -60,8 +60,7 @@ sysinfo = "0.29.0"
tar = "0.4.38"
tuikit = "0.5.0"
url-escape = "0.1.1"
users = "0.11.0"
zip = "0.6.4"
tokio = "1"
ueberzug = "0.1.0"
which = "4.4.0"
unicode-segmentation = "1.10.1"
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::borrow::Borrow;
fn main() {
let Ok(mut default_config_files) = std::env::current_dir() else {
eprintln!("Environment variable $PWD should be set. Couldn't find the source folder.");
return
return;
};
default_config_files.push("config_files/fm");

Expand Down
51 changes: 36 additions & 15 deletions config_files/fm/config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
# the terminal must be installed
# the terminal emulator, which must be accessible from $PATH
terminal: st
# configurable colors
# palette of the normal files. Accepted values are "red-green", "red-blue" and "green-blue"
# other value will lead to the default palette which is "green-blue".
palette: green-blue
colors:
# white, black, red, green, blue, yellow, cyan, magenta
# light_white, light_black, light_red, light_green, light_blue, light_yellow, light_cyan, light_magenta
# you can define an ANSI color or an rgb color for any kind of file except "normal" files.
# colors for normal files are calculated on the fly.
# List of allowed colors:
# white, black, red, green, blue, yellow, cyan, magenta
# light_white, light_black, light_red, light_green, light_blue, light_yellow, light_cyan, light_magenta
# Allowed Format for rgb color : `rgb(r, g, b)` where r, g and b are integers between 0 and 255 included.
directory: red
block: yellow
char: green
fifo: blue
socket: cyan
symlink: magenta
broken: light_magenta
# keybindings
# You can bind any key to any action.
# List of valid actions is accessible from `help` (default key H) and from the readme.md file.
# Invalid actions are skipped.
# AltPageUp can't be bound, it is reserved for internal use.
keys:
'esc': ResetMode
'up': MoveUp
Expand Down Expand Up @@ -51,6 +65,18 @@ keys:
'v': ReverseFlags
'w': RegexMatch
'x': DeleteFile
'alt-d': DragNDrop
'alt-e': ToggleDisplayFull
'alt-f': ToggleDualPane
'alt-g': Goto
'alt-p': TogglePreviewSecond
'ctrl-c': CopyFilename
'ctrl-e': EncryptedDrive
'ctrl-f': FuzzyFind
'ctrl-g': Shortcut
'ctrl-p': CopyFilepath
'ctrl-q': ResetMode
'ctrl-r': RefreshView
'shift-b': Bulk
'shift-f': Filter
'shift-g': End
Expand All @@ -60,21 +86,16 @@ keys:
'shift-o': Sort
'shift-p': Preview
'shift-t': MediaInfo
'ctrl-c': CopyFilename
'ctrl-e': EncryptedDrive
'ctrl-f': FuzzyFind
'ctrl-g': Shortcut
'ctrl-p': CopyFilepath
'ctrl-q': ResetMode
'ctrl-r': RefreshView
'alt-d': DragNDrop
'alt-e': ToggleDisplayFull
'alt-g': Goto
'alt-p': TogglePreviewSecond
'alt-f': ToggleDualPane
# display settings
settings:
# display all files ?
all: false
# use a second pane (if the terminal is wide enough) ?
dual: true
# display metadata ?
full: true
# use second pane for preview ?
preview: false

# Custom command :
# * Use an unused keybind
Expand Down
84 changes: 69 additions & 15 deletions development.md
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,6 @@ New view: Tree ! Toggle with 't', fold with 'z'. Navigate normally.
- [x] FIX: exiting preview doesn't refresh
- [x] Mode should know if a refresh is required after leaving them.
## Current dev
### Version 0.1.22
- [x] FIX: copying 0 bytes crash progress bar thread
Expand Down Expand Up @@ -564,8 +562,74 @@ New view: Tree ! Toggle with 't', fold with 'z'. Navigate normally.
- [x] Not accessible file in tree mode crashes the application
- [x] Look for nvim listen address in `ss -l` output
## Current dev
### Version 0.1.23
- [x] preview tar archive
- [x] Jump mode : 'Space' Toggle flag, 'u' remove all flags, 'Enter' jump to the file
- [x] FIX: copy / move while existing file already exist use another name
- [x] Jump mode (display flagged files) should allow to delete / trash the flagged files
- [x] binary preview also display parsed ASCII strings
- [x] skim fuzzy find (ctrl-f) starts from current dir, not current selected file
- [x] open/file pick flagged files if there are, use selected file instead
- [x] regroup openers when opening multiple files.
- [x] refresh every 10 seconds. If no file in current dir has changed, nothing happens.
- [x] scroll in preview second screen
- [x] FIX sending `Event::User(())` events from refresher hangs skim. Use `Event(Key::AltPageUp)` which is now reserved.
- [x] allow file selection from args : -p filename selects the file from parent dir
- [x] more args : dual pane, preview second, display full, show hidden
- [x] history: when moving back select back the file we were at
- [x] use yellow block char to make flagged files more visibles.
- [x] move input 1 char right since we inserted a space
- [x] preview pdf with ueberzug. First page extracted with poppler -> cairo -> thumbnail -> ueberzug
- [x] FIX: when encrypted drive is already mounted don't let user mount it again
- [x] FIX: group & owner metadata alignement in tree mode
- [x] Tree mode Copy / Move / New should copy in selected directory not root of tree
- [x] Allow scrolling in preview pdf. Required a lot of change in Preview::ueberzug. Update thumbnail when required.
- [x] Flag the selected file if no file is flagged before entering delete mode or trashing a file.
- [x] FIX: fuzzy finder should do nothing if escape (quit?) is inputed
- [x] preview openoffice / office documents as images. Don't use pandoc for .doc .odb etc. previews
- [x] mtp mount with gio [nnn plugin](https://github.com/jarun/nnn/blob/master/plugins/mtpmount)
- [x] add MTP mount points to shortcuts
- [x] list, mount, unmount mtp mount points
- [x] bulk, skim & removable are `None` until first use.
- [x] remove dependencies
- [x] complete refactor of many files.
- [x] Use `lazy_static` to load `Colors` configuration. Don't use a cache. Calculate every color for every extension
- [x] allow rgb colors in config file
- [x] FIX: can't read filename from / ... which crashes the app.
- [x] FIX: exploring root folder leads to wrong first line display.
- [x] allow seveval palettes for normal file colors
- [x] move every lazy_static configuration into config.
- [x] FIX: encrypted are never shown as mounted
- [x] Tree remade without recursion. Use an `HashMap<PathBuf, Node>`
- [x] FIX: folders are max depth hangs the app
- [x] FIX: rename renames the root path
- [x] FIX: scrolling to bottom of tree is bugged
- [x] FIX: scrolling starts 1 row to low
- [x] FIX: filename in first line
- [x] FIX: can't "open" a folder to redo the tree there
- [x] FIX: move back from root should redo the parent tree
- [x] FIX: move up from to go to last and vice versa
- [x] FIX: enter a dir from normal mode shouldn't set mode tree
- [x] Use a generic trait for movements
- [x] FIX: first line position for tree
- [x] FIX: searching for file very low don't scroll there
- [x] FIX: search can only find the first match
- [x] FIX: leaving preview doesn't reset tree
- [x] Add a link to previous and next node in Node. Simplify navigation, increase ram usage :/
- [x] test everything
- [x] refactor
- [x] document
## TODO
- [ ] mount usb key - should be merged with mtp
- [ ] document filepicking (from my config etc.).
- [ ] avoid multiple refreshs if we edit files ourself
- [ ] FIX: tab.selected() should return Option<&FileInfo>
- [ ] use widget for every drawable element. First line should be a collection of widget which are drawned
- [ ] while second window is opened, if the selection is below half screen, it's not shown anymore.
Scroll to second element if needed
- [ ] remote control
Expand Down Expand Up @@ -630,8 +694,6 @@ New view: Tree ! Toggle with 't', fold with 'z'. Navigate normally.
## BUGS
- [ ] creates $ENV{HOME} folders everywhere -
a new version of log4rs seems to solve this, it's not deplayed to crates.io yet
- [ ] tree mode : index are offset by one
## Won't do
Expand All @@ -640,17 +702,9 @@ New view: Tree ! Toggle with 't', fold with 'z'. Navigate normally.
All of this stuff can be done easily through a shell command or automatically. I'm not sure I wan't to bloat fm with it.
- [ ] auto mount usb keys ??? [rusb](https://github.com/a1ien/rusb) -- just use udiskie (started automatically) and udiskie-umount /mount/point
just use udiskie
- [ ] mtp... but fast [libmtp.rs](https://docs.rs/libmtp-rs/0.7.7/libmtp_rs/)
- [ ] connexion to remote servers [removefs](https://crates.io/crates/remotefs) [termscp](https://crates.io/crates/termscp)
- ssh
- sftp
- ftp
- google drive
or just use sshfs...
- [ ] auto mount usb keys ??? just use udiskie (started automatically) and udiskie-umount /mount/point
- [ ] cloud services (apple, microsoft, google, dropbox etc.)
- [ ] ftp
## Sources
Expand Down
31 changes: 0 additions & 31 deletions fm.sh

This file was deleted.

47 changes: 30 additions & 17 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ Written in rust.
[docrs]: https://docs.rs/fm-tui/0.1.0

```
FM : dired like file manager
A TUI file manager inspired by dired and ranger
Usage: fm [OPTIONS]
Options:
-p, --path <PATH> Starting path [default: .]
-p, --path <PATH> Starting path. directory or file [default: .]
-s, --server <SERVER> Nvim server [default: ]
-h, --help Print help information
-V, --version Print version information
-D, --dual <DUAL> Dual pane ? [possible values: true, false]
-S, --simple <SIMPLE> Display files metadata ? [possible values: true, false]
-P, --preview Use second pane as preview ? default to false
-A, --all Display all files (hidden)
-h, --help Print help
-V, --version Print version
```

## Platform
Expand Down Expand Up @@ -59,6 +62,7 @@ If you added the [recommanded function](#cd-on-quit) to your bashrc/zshrc, simpl
## Features

Some features depends on external programs to keep fm from being really bloated.
I try to implement every feature I can think of.

### Navigation

Expand Down Expand Up @@ -96,28 +100,30 @@ Many ways to jump somewhere :
### Display

- Change display, removing details with Alt+e or display a single pane with Alt+d
- Preview most of files (text, highlighted code, binary, pdf, exif details, video/audio details, archives) with P
- Preview most of files (text, highlighted code, binary, pdf, exif details, image/video, audio details, archives, MS-office & OpenOffice documents) with P
- Toggle the tree view with t. Fold selected folder with z. Unfold every folder with Z, fold every folder with Alt+z.
- Enter preview mode with Alt+P. Every file is previewed in the second pane.
- Filter the view (by extension, name, directory only, all files) with F
- Find files with / (with completion: Tab, enter to search),
- Find files with / (with completion: Tab, enter to search),
- flag files matching a regex with w

### Fuzzy finder
### Fuzzy finders

- Ctrl-f : search in filenames and move there,
- Ctrl-s : search for a line in file content and move there,
- Alt-h : search for a keybinding and execute the action.

- Use the integrated fuzzy finder (forked version of skim, an fzf clone) with Ctrl+f to navigate quickly
- The same fuzzy finder can find specific lines in files with Ctrl+s
- Another fuzzy finder is available for your keybinds with Alt+h
We use a fork of [skim](https://github.com/lotabout/skim), an fzf clone written in rust.

### Neovim filepicker

When you open a file with i, it will send an event to Neovim and open it in a new buffer.
Recent versions of neovim export the RPC server address to an environment variable which is read if no argument
is provided.

It should always work, even outside of neovim.

It's also possible to pass the RPC server address with `fm -s address`.
The RPC server address is found by looking for neovim in /proc. If it fails, we can still look for an
environment variable set by neovim itself.
Finally, it's also possible to pass the RPC server address with `fm -s address`.

### cd on quit

Expand Down Expand Up @@ -177,6 +183,8 @@ Expansions :
- Contol MOCP with Ctrl+arrows. Ctrl+Left, Ctrl+Right: previous or next song. Ctrl+Down: Toggle pause. Ctrl+Up: add current folder to playlist
- Set the selected image as wallpaper with W.
- _Experimental_ enter "command mode" with ':'. Type the name of a command and it will be executed.
- Mount a remote filesystem using ssfhs with Alt-r.
- Mount a MTP device with Alt-R.
Most of those features are inspired by ranger and alternatives (Midnight commander, nnn, lf etc.), the look and feel by dired.
Expand Down Expand Up @@ -289,7 +297,6 @@ Every configuration file is saved in `~/.config/fm/`
You can configure :
- **Colors** for non standard file types (directory, socket, char device, block device)
- **Keybindings**. Some should be left as they are, but all keybindings can be configured.
use the provided config file as a default.
Multiple keys can be bound the the same action.
Expand All @@ -309,12 +316,17 @@ You can configure :
- **TUI applications**. Some classic TUI applications like htop, glances, btop, lazygit are already there.
Open the menu with `S` and pick the desired one. It will only work with a TUI application like HTOP,
not a CLI application like bat.
- **Colors** of files.
Non standard files (directory, char devices, block devices, symlinks, sockets, fifo) have their own configurable colors.
You can use ansi colors or rgb values.
Standard files are colored by their extension and you can use 3 differents palettes (red-green, red-blue or green-blue).
Every extension has its own random color.
## External dependencies
Most of the openers and tui applications are configurable from config files. Some are hardcoded if their command is quite specific or if I couldn't find a workaround.
- [lsblk](https://linux.die.net/man/8/lsblk): list encroytped devices
- [lsblk](https://linux.die.net/man/8/lsblk): list encrytped devices
- [faillock](https://linux.die.net/man/8/faillock): reset failed sudo attempts
- [Cryptsetup](https://gitlab.com/cryptsetup/cryptsetup): decrypt & mount encrypted devices
- [Nitrogen](https://github.com/l3ib/nitrogen/): set up a wallpaper
Expand All @@ -323,9 +335,10 @@ Most of the openers and tui applications are configurable from config files. Som
- [Ueberzug](https://github.com/LalleSX/ueberzug) display images in your terminal. Used to preview images. This one may be tricky to install from source since the original maintener nuked his project. It's still available in many package managers.
- [isoinfo](https://command-not-found.com/isoinfo) allow the content preview of an iso file
- [jupyter](https://jupyter.org/) preview jupyter notebooks by converting them to markdown
- [pandoc](https://pandoc.org) preview open documents by converting them to markdown with pandoc
- [pandoc](https://pandoc.org) preview epub by converting them to markdown with pandoc
- [fontimage](https://fontforge.org/docs/fontutils/fontimage.html) preview fonts by creating a thumbnail
- [rsvg-convert](https://github.com/brion/librsvg) preview svg by creating a thumbnail
- [libreoffice](https://www.libreoffice.org) preview open & MS-office documents
## Contribution
Expand Down
Loading

0 comments on commit 4a8b8b2

Please sign in to comment.