Coder Social home page Coder Social logo

yorukot / superfile Goto Github PK

View Code? Open in Web Editor NEW
4.7K 6.0 95.0 51.89 MB

Pretty fancy and modern terminal file manager

Home Page: https://superfile.netlify.app

License: MIT License

Go 83.30% Shell 3.07% Nix 0.72% PowerShell 3.76% JavaScript 2.13% TypeScript 0.12% MDX 3.25% Astro 2.75% CSS 0.87% HTML 0.02%
bubbletea cli file-manager filesystem golang linux-app terminal-app tui filemanager terminal-based

superfile's Introduction

superfile LOGO

Demo

Perform common operations

Content

Installation

Quick install (Support MacOs and linux)

bash -c "$(wget -qO- https://superfile.netlify.app/install.sh)"

More installation methods

Click me to check on how to install

Build

You can build the source code yourself by using these steps:

Requirements

Build Steps

Clone this repository using the following command:

git clone https://github.com/yorukot/superfile.git --depth=1

Enter the downloaded directory:

cd superfile

Run the build.sh file:

./build.sh

Add the binary file to your $PATH, e.g., in /usr/local/bin:

sudo mv ./bin/spf /usr/local/bin

Supported Systems

  • Linux
  • MacOS
  • Windows (Not fully supported yet)

Tutorial

After you install superfile, you can go here to briefly understand how to use superfile!

Plugins

Click me to the plugins wiki

Themes

Click me to the theme wiki

Hotkeys

Warning

If you are vim/nvim user please change your default hotkeys config to vim version!

Click me to see the hotkey wiki

Troubleshooting

Click me to see common problem fix

Contributing

If you want to contribute please follow the contribution guide

Thanks

Support

  • a Star on my GitHub repository would be nice 🌟
  • You can buy a coffee for me πŸ’–

ko-fi

Contributors

Thanks to all the contributors for making this project even greater!

Star History

THANKS FOR All OF YOUR STARS! Your stars are my motivation to keep updating!

Star History Chart

ΰΌΌ ぀ β—•_β—• ༽぀ Please share.

superfile's People

Contributors

anshumanneon avatar beatbrot avatar booth-w avatar bwearley avatar c3r5b8 avatar ccoveille avatar charlesrocket avatar dem0ngo avatar dependabot[bot] avatar gabrieldlima avatar gv14982 avatar hyperionhex avatar juanibiapina avatar kblissett avatar kianmeng avatar lemonlime0x3c33 avatar lescx avatar myles-j avatar ndom91 avatar nonepork avatar pearcidar avatar plutonium-239 avatar renovate[bot] avatar sandeep-r3 avatar stschulte avatar ultrablacklinux avatar vazub avatar wabri avatar yorukot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

superfile's Issues

Store logs in XDG_STATE_HOME by default

The part you want to Enhancement
I would love for logs to be stored in XDG_STATE_HOME (if it exists) by default.

Why it is necessary to enhancement
None of the other XDG "save-to" locations is suitable for history/logs:

  • XDG_CONFIG_HOME and XDG_RUNTIME_DIR are the most obviously inappropriate choices, so I won't explain further here.
  • XDG_DATA_HOME is for an app's user-specific files they might want to sync across installationsβ€”generally not the case for logs/history.
  • XDG_CACHE_HOME, like any cache directory, should only ever contain files/information that can be recreated in full if deleted. Users are often told it is safe to clean their cache folders because apps are only supposed to store stuff there temporarily, for faster runtimes or whatever, so if an app stores anything there that cannot be recreated (like history/logs), it can very easily get deleted unintentionally by a user or their cache-cleaning app/script/OS/etc. If the history is actually stored in full elsewhere and is just cached here for some reason, then of course that's fine.
  • XDG_STATE_HOME was added to the XDG base directory spec in 2022 to solve this exact problem :).

Additional context
I LOVE that you've been increasing your XDG support recently (#27, #23), and I really like this app :).

I believe you are using rkoesters/xdg for basedir, so I did first ask them to add support, but who knows when/if they'll be able to get to it:

XDG_STATE_HOME description from the XDG base directory specification:

$XDG_STATE_HOME defines the base directory relative to which user-specific state files should be stored. If $XDG_STATE_HOME is either not set or empty, a default equal to $HOME/.local/state should be used.

The $XDG_STATE_HOME contains state data that should persist between (application) restarts, but that is not important or portable enough to the user that it should be stored in $XDG_DATA_HOME. It may contain:

  • actions history (logs, history, recently used files, …)
  • current state of the application that can be reused on a restart (view, layout, open files, undo history, …)

Lastly, I do work on several linux machines, but my daily driver for now is a Macβ€”and I (and many others!) set the XDG base directory environment variables even there to make it easier to organize all my files (I've even encountered overly-hopeful people who set them on Windows...). Many applications support this (check for environment variable existence, and if not set check the OS and use its defaults), but not all...so bonus points if you're able to accommodate people like me and do likewise 😁.

When there are a large number of files in the folder, lag will occur.

Describe the bug
When there are a large number of files in a folder, there will be serious lag when scrolling the wheel or moving the cursor quickly.

To Reproduce
Have a lot of files

Expected behavior
no lag

Screenshots
If applicable, add screenshots to help explain your problem.
image

System information (please complete the following information):

  • OS: fedora (I think all systems will have this error)

Use Xdg base directory specifications for your files

There is a list of the possible folders :

  • configFolder : $XDG_CONFIG_HOME/superfile
  • themeFolder : $XDG_CONFIG_HOME/superfile/theme
  • trashFolder : see #4
  • dataFolder : $XDG_STATE_HOME/superfile
  • lastCheckVersion : "$dataFolder/lastCheckVersion"
  • pinnedFile : "dataFolder/pinned.json"
  • configFile : "$configFolder/config.json"
  • themeZipName : "$themeFolder/theme.zip"
  • logFile : "$dataFolder/superfile.log"

This is the specification : https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

Some more informations : https://wiki.archlinux.org/title/XDG_Base_Directory

Open directory with default application

It would be cool if I would be able to open a directory (e.g. this superfile/ repository) in my $EDITOR. What do you think about this?

If this is something that is going to be implemented, we need to think about how to handle terminal based editors, i.e. should we move back to spf after closing the editor?

External media error when moving cursor

Each time I move the cursor, I get the following error in superfile.log:

2024/04/09 09:00:34 Get external media error
2024/04/09 09:00:34 open /run/media/luca: no such file or directory

There is no /run/media folder on my system.

OS: Debian 12 (bookworm)
spf: v1.0.1

File encryption using age instead of AES

Based on the roadmap, it is planned to support AES encryption. While I think it is a great idea to implement file encryption in a file manager, using AES is a bad idea. It is good enough for the web, but not a good tool to encrypt files on a hard drive. There are other tools that should be used for that.

Please have a look at age, a nice, small and lightning fast encryption tool written in Go. There is also a nice API for it. Crypto is hard but programming with age is not.

As mentioned in #36, I think encryption should be an optional feature. If you have age, you can encrypt files, otherwise you get a notification on which binary you need to install.

Nix package not working

Describe the bug
Build of this package fails when trying to install on NixOS by the method given in the README

To Reproduce
Steps to reproduce the behavior:

  1. Add Nix derivation into the config / use nix run
  2. Build error

Expected behavior
Should build successfully

Screenshots
image

System information (please complete the following information):

  • NixOS

Extra Info
Builds successfully when using build.sh script from development shell (nix develop)

Better theme config

I currently work on implementing the ayu themes. I noticed a few shortcomings I would like to bring up:

Better naming convention

When the terminal size is too small for spf (maybe that's also something that could be worked on in the future), the current terminal dimensions that are too small are highlighted in the terminalTooSmallError hex color value. There is also fail for error messages.

  "terminalTooSmallError": "#E65050",
  "fail": "#E65050",

I think it might be a good idea to combine color fields into more logical groups like error, warning, gutter, gutterActive and so on. It's a tradeoff between configurability and simplicity.

Separate icons and text colors

Many text editors and IDEs separate the file and folder icon colors.

Good examples would be

There are also editors and file managers that don't do that:

This would also allow icons based on file type, better tree view and overall better UI and user orientation.

Icon (Nerdfont) is not displayed properly.

Describe the bug
spf does not show any folder/file icons (except for the "Music" folder)

To Reproduce
Steps to reproduce the behavior:

  1. Open spf

Expected behavior

Screenshots

CleanShot 2024-05-10 at 21 50 51@2x

System information (please complete the following information):

  • OS: macOS Sonoma
  • Version 14.4.1
  • Superfile Version 1.1.2

AUR

I am of the opinion that it ought to be feasible to procure the project from AUR in a manner that facilitates automatic updates.

Out of scope features and plugins

This issue is based around features file managers do or do not have, should or should not have.

It is important to keep the amount of hard dependencies to a minimum. Such a hard dependency is exiftool for example. Without it, the problem crashes. Even tho exiftool isn't actually required for superfile to work. It should be an optional, soft dependency. With it you gain extra features (nice metadata preview for example).

I think currently the concept of what should be inside superfile isn't as clear as it should be. Extensibility with optional features is the better way IMO for the user to use superfile instead of forcing them to install a couple of external dependencies. The beauty of Go are the simple, single binaries it produces.

The same goes for features like archiving and extraction (there are so many options!), encryption (there are even more options!) and a lot of other features.

runtime error: invalid memory address or nil pointer dereference

As soon as I select .$rfc.drawio.bkp file, superfile crashes with the following output:

Caught panic:

runtime error: invalid memory address or nil pointer dereference

Restoring terminal...

goroutine 1 [running]:
runtime/debug.Stack()
	runtime/debug/stack.go:24 +0x5e
runtime/debug.PrintStack()
	runtime/debug/stack.go:16 +0x13
github.com/charmbracelet/bubbletea.(*Program).Run.func1()
	github.com/charmbracelet/bubbletea/tea.go:478 +0x91
panic({0x8178e0?, 0xc596e0?})
	runtime/panic.go:770 +0x132
github.com/barasher/go-exiftool.(*Exiftool).ExtractMetadata(0x0, {0xc0004b58b0, 0x1, 0xc59e30?})
	github.com/barasher/go-exiftool/exiftool.go:145 +0x5d
github.com/MHNightCat/superfile/components.ReturnMetaData({{{0xc0000b2a08, 0x1, 0x1}, 0x138, 0x0}, {{{0xc0001fe340, 0x5, 0x5}}, 0x0}, {0x0, ...}, ...})
	github.com/MHNightCat/superfile/components/function.go:372 +0x348
github.com/MHNightCat/superfile/components.model.Update({{{0xc0000b2a08, 0x1, 0x1}, 0x138, 0x0}, {{{0xc0001fe340, 0x5, 0x5}}, 0x0}, {0x0, ...}, ...}, ...)
	github.com/MHNightCat/superfile/components/model.go:210 +0x1af1
github.com/charmbracelet/bubbletea.(*Program).eventLoop(0xc00026e000, {0x94cc20?, 0xc0000a1008?}, 0xc0000444e0)
	github.com/charmbracelet/bubbletea/tea.go:411 +0x5e2
github.com/charmbracelet/bubbletea.(*Program).Run(0xc00026e000)
	github.com/charmbracelet/bubbletea/tea.go:543 +0x86b
main.main.func1(0xc000092a80?)
	github.com/MHNightCat/superfile/main.go:60 +0x145
github.com/urfave/cli/v2.(*Command).Run(0xc0001fc160, 0xc000092a80, {0xc000024170, 0x1, 0x1})
	github.com/urfave/cli/v2/command.go:279 +0x97d
github.com/urfave/cli/v2.(*App).RunContext(0xc0001c6200, {0x94d2b0, 0xccfa80}, {0xc000024170, 0x1, 0x1})
	github.com/urfave/cli/v2/app.go:337 +0x58b
github.com/urfave/cli/v2.(*App).Run(...)
	github.com/urfave/cli/v2/app.go:311
main.main()
	github.com/MHNightCat/superfile/main.go:69 +0x9f
2024-04-09.12-02-28.mp4

Dot file toggle

I think dot files should be hidden by default but toggleable with ctrl+.

Current themes not readable when using light theme.

See also: #28

The theme of spf doesn't change the background color of the terminal to the one used by the theme. By default it uses gruvbox (because of personal preference for Gruvbox?). I don't use gruvbox on my system and by default supefile looks like this (and to new users not using a gruvbox or dark theme):

image

dracula doesn't look so dracula :')

Screenshot 2024-04-09 16 11 36

We should implement the background color in the theme config files and also provide light themes where applicable.

Helix implements this nicely where you can look at each theme live:

image


Also, gruvbox dark looks nice but we might want to use the users default terminal colors by default with the option to specify fancy themes in the config.

Version `GLIBC_2.34' not found.

I got these errors after run spf :

./spf: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./spf)
./spf: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./spf)

Recursive symlink crashes spf

To Reproduce

  1. Create a recursive symlink, e.g ln -s blahblah blahblah
  2. Run spf, keep navigating until you found the directory
  3. Then spf crashes...
panic: runtime error: invalid memory address or nil pointer dereference━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫1/3┣━┛┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
                                                                       [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x10d806d2a]

                                                                                                                                                 goroutine 125 [running
]:
  github.com/MHNightCat/superfile/internal.returnMetaData({{{0xc0000c8d88, 0x1, 0x1}, 0x8f, 0x0, 0x6}, {{0xc0001f8000, 0x7, 0x7}, 0x0}, ...})
                                                                                                                                                github.com/MHNightCat/s
uperfile/internal/function.go:288 +0x46a
                                        github.com/MHNightCat/superfile/internal.mainKey.func2()
                                                                                                        github.com/MHNightCat/superfile/internal/key_function.go:34 +0x
51
  created by github.com/MHNightCat/superfile/internal.mainKey in goroutine 1
                                                                                github.com/MHNightCat/superfile/internal/key_function.go:33 +0xa8a

Expected behavior
spf doesn't crash, unless the user decides to enter that directory. mc (Midnight Commander) does it.

System information (please complete the following information):

  • macOS Monterey (x64) 12.7.4
  • Superfile Version 1.1.2 (installed via Homebrew)

Make Nerdfont optional

While this adds a great visual enhancement, not everybody has or wants Nerdfonts.

Making it optional (even enabled by default) could be great.
If needed, adding a / to the end of the folder name to see it as a folder if colors aren't sufficient.

feature: file preview

It'd be great, if superfile could preview files, like ranger does. At least text files

No folder recognized except Home

Screen.Recording.2024-04-10.at.10.51.04.AM.mov

When I select one of the pinned folder except Home, it highlights everything and shows no file or folder.
Maybe this is because of the new pinned folders. I need to check. Help appreciated

Add more nix install documentation

The part you want to Enhancement
In Nix you can install or use packages directly from a github url, in this case, we can do:

nix run github:MHNightCat/superfile#superfile

or

nix profile install github:MHNightCat/superfile#superfile

Why it is necessary to enhancement
People may not be aware that they do not need a flake configuration to test or install this package.

Additional context

Crashes when truncating metadata

Describe the bug
I try to move my cursor to a file but spf crashes when I do so. The crash logs tell that this happens when we try to truncate the text, i.e. spf tries to get metadata and because it cannot fit in metadata panel, it tries to truncate it. Then it crashes. The exact line mentioned is in file components/style.go and line 234.
I will try to work on this to find why this is happening.

To Reproduce
Steps to reproduce the behavior:

  1. open superfile config folder in spf
  2. Move cursor to the log file
  3. See error

Expected behavior
Nothing should've happened. (At least the crash shouldn't have happened)

Screenshots
Screenshot 2024-04-11 at 3 55 36 PM

System information (please complete the following information):

  • OS: MacOS
  • Version: 10.15.7

Use Xdg Trash specification to stay compatible with other file managers

Seems you use a trashfolder into your config folder. This is not compatible with XDG Trash specification and can lead to incompatibilities with other file managers. Also when trashing files on other disks it will make a full copy when moving the file, this can take a lot of time and will abnormally grow the config folder and home (or root) partition.

The specifications : https://specifications.freedesktop.org/trash-spec/trashspec-1.0.html (with multi device folders)

Some trash management softwares (none in archlinux extra, only aur) : https://wiki.archlinux.org/title/Trash_management

Symlinked folders don't open within superfile

Describe the bug
Can't open folders which have been symlinked from within superfile. Instead it opens a new terminal at the symlink location.

To Reproduce
Steps to reproduce the behavior:

  1. Navigate to any symlinked folder and hit enter
  2. New terminal window pops up, doesn't open in superfile

Expected behavior
Superfile follows the path of the symlink and shows folder contents

Screenshots
If applicable, add screenshots to help explain your problem.

System information:

  • OS: Arch Linux
  • Version 6.8.8-zen1-1-zen (kernel)
  • Superfile Version v1.1.1

Transparent Background

The part you want to Enhancement
Make superfile's background transparent.

Why it is necessary to enhancement
Better integrate with my terminal workflow.

Additional context
I saw a couple of theme examples had transparent backgrounds, but I'm unsure how to recreate it.

Open IDE from current directory

Hello
I hope you're doing well .

I've been using superfile and it looks really cool.but the only issue I've is that, I can't open VS Code or any other IDE from
current directory. This feature can be really helpful for me at least πŸ˜…
because 99% of the time when i'm opening any directory I'm gonna open VS Code or Vim from that directory.
We can implement hot-keys for it or maybe code . or nvim . something like.

Thanks πŸ™‚

Crash when selecting a broken symlink

Hi, first of all: nice work! It looks really fancy.
I did however immediately encounter a tiny bug because I had a broken symlink in my home directory.

Reproduce:

  1. ln -s /broken/link test
  2. Open superfile and move the cursor to the test file.

Output:

Caught panic:

runtime error: invalid memory address or nil pointer dereference

Restoring terminal...

goroutine 1 [running]:
runtime/debug.Stack()
   /usr/lib/golang/src/runtime/debug/stack.go:24 +0x5e
runtime/debug.PrintStack()
   /usr/lib/golang/src/runtime/debug/stack.go:16 +0x13
github.com/charmbracelet/bubbletea.(*Program).Run.func1()
   /home/nightcat/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:478 +0x91
panic({0x7f9300?, 0xc24300?})
   /usr/lib/golang/src/runtime/panic.go:920 +0x270
github.com/MHNightCat/superfile/components.returnMetaData({{{0xc00012f100, 0x1, 0x1}, 0xa8, 0x0}, {{{0xc000198f70, 0x5, 0x5}}, 0x0}, {0x0, ...}, ...})
   /home/nightcat/Documents/code/superfile/src/components/function.go:367 +0x1ef
github.com/MHNightCat/superfile/components.model.Update({{{0xc00012f100, 0x1, 0x1}, 0xa8, 0x0}, {{{0xc000198f70, 0x5, 0x5}}, 0x0}, {0x0, ...}, ...}, ...)
   /home/nightcat/Documents/code/superfile/src/components/model.go:167 +0x109b
github.com/charmbracelet/bubbletea.(*Program).eventLoop(0xc00020fd40, {0x925d18?, 0xc0001c4800?}, 0xc00019eba0?)
   /home/nightcat/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:411 +0x75a
github.com/charmbracelet/bubbletea.(*Program).Run(0xc00020fd40)
   /home/nightcat/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:543 +0x86e
main.main.func1(0xc00020c160?)
   /home/nightcat/Documents/code/superfile/src/main.go:55 +0x9e
github.com/urfave/cli/v2.(*Command).Run(0xc00020c160, 0xc000146a40, {0xc000118050, 0x1, 0x1})
   /home/nightcat/go/pkg/mod/github.com/urfave/cli/[email protected]/command.go:279 +0x9dd
github.com/urfave/cli/v2.(*App).RunContext(0xc0001e0200, {0x926410?, 0xc65920}, {0xc000118050, 0x1, 0x1})
   /home/nightcat/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:337 +0x5db
github.com/urfave/cli/v2.(*App).Run(...)
   /home/nightcat/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:311
main.main()
   /home/nightcat/Documents/code/superfile/src/main.go:65 +0xa5

Not able to go back to parent folder

Describe the bug
I try pressing h and backspace but I am unable to go back to parent folder.

To Reproduce
Steps to reproduce the behavior:

  1. Go to a folder
  2. Enter a subdirectory
  3. Try pressing h or backspace
  4. Unable to return

Expected behavior
I should be able to return to the parent folder

System information (please complete the following information):

  • OS: MacOS
  • Version 10.12.7

Hotkey menu idea - lazygit-like

Lazygit is probably my favorite CLI program from a HCI perspective. It's help menu is excellent.

Its help menu can be opened with ? and works as follows:

  • Only the keybinds that could be pressed right now without error appear
  • Shows hotkey and brief description of what they do (plus, most hotkeys are single letter keys, rather than a chord combination)
  • Can use arrows to scroll through and enter to select, or can just press the hotkey
  • Search filterable with /

Interface lag when selecting zip files

Hey! I've noticed that when pointer is at archives (zip files in my case) it freezes the spf while calculating archived metadata.
If you have a large archive with lots and lots of small files there it will freeze the app for quite a long time.

In my case 450 mb archive with about 1mil files would take around 9-12 seconds to process.
Archives with many files but about 10-15mb take 1-2 seconds.

moreover, inputs are not blocked but queued when you try to move pointer up/down while it calculates.

Error: Theme file doesn't exist

Describe the bug
I tried to build app manually but got error 2024/04/13 16:35:31 Theme file doesn't exist: open /home/casual/.config/superfile/theme/gruvbox.toml: no such file or directory.

To Reproduce
Steps to reproduce the behavior:

  1. git clone https://github.com/MHNightCat/superfile
  2. sh build.sh
  3. sh ./bin/spf
  4. See error 2024/04/13 16:35:31 Theme file doesn't exist: open /home/casual/.config/superfile/theme/gruvbox.toml: no such file or directory

Expected behavior
run app

Screenshots

superfile ➀ ./build.sh
go: downloading github.com/rkoesters/xdg v0.0.1
go: downloading github.com/urfave/cli/v2 v2.27.1
go: downloading github.com/charmbracelet/bubbletea v0.25.0
go: downloading github.com/muesli/termenv v0.15.2
go: downloading github.com/barasher/go-exiftool v1.10.0
go: downloading github.com/charmbracelet/bubbles v0.18.0
go: downloading github.com/atotto/clipboard v0.1.4
go: downloading github.com/charmbracelet/lipgloss v0.9.1
go: downloading github.com/lithammer/shortuuid v2.0.3+incompatible
go: downloading github.com/pelletier/go-toml/v2 v2.2.1
go: downloading github.com/shirou/gopsutil v3.21.11+incompatible
go: downloading github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81
go: downloading github.com/mattn/go-isatty v0.0.18
go: downloading github.com/mattn/go-localereader v0.0.1
go: downloading github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b
go: downloading github.com/muesli/cancelreader v0.2.2
go: downloading golang.org/x/term v0.6.0
go: downloading github.com/mattn/go-runewidth v0.0.15
go: downloading golang.org/x/sys v0.15.0
go: downloading github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673
go: downloading github.com/cpuguy83/go-md2man/v2 v2.0.2
go: downloading github.com/satori/go.uuid v1.2.0
go: downloading github.com/rivo/uniseg v0.4.6
go: downloading github.com/charmbracelet/harmonica v0.2.0
go: downloading github.com/russross/blackfriday/v2 v2.1.0
superfile ➀ cd bin           
bin ➀ ls                   
Permissions Size User   Date Modified Git Name
.rwxr-xr-x@  13M casual 13 Π°ΠΏΡ€ 16:35   -I ο€– spf
bin ➀ ./spf                
2024/04/13 16:35:31 Theme file doesn't exist: open /home/casual/.config/superfile/theme/gruvbox.toml: no such file or directory

System information (please complete the following information):

  • OS: NixOS
➀ nix-shell -p nix-info --run "nix-info -m" 
 - system: `"x86_64-linux"`
 - host os: `Linux 6.8.2-zen2, NixOS, 24.05 (Uakari), 24.05.20240329.807c549`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.2`
 - channels(root): `"nixos, nixpkgs"`
 - channels(casual): `""`
 - nixpkgs: `/home/casual/.nix-defexpr/channels/nixpkgs`

Invalid memory address or nil pointer dereference

Build latest version available (7th april) and the app panics seconds after startup. Running on Arch Hyprland with Alacritty terminal.

First time:

❯ ./spf
First initialize the superfile configuration.
Need to download the theme.
Please make sure you have internet access.
And this may take some time(<10s).
Caught panic:

runtime error: invalid memory address or nil pointer dereference

Restoring terminal...

goroutine 1 [running]:
runtime/debug.Stack()
	/usr/lib/go/src/runtime/debug/stack.go:24 +0x5e
runtime/debug.PrintStack()
	/usr/lib/go/src/runtime/debug/stack.go:16 +0x13
github.com/charmbracelet/bubbletea.(*Program).Run.func1()
	/home/daniel/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:478 +0x91
panic({0x811920?, 0xc53360?})
	/usr/lib/go/src/runtime/panic.go:770 +0x132
github.com/barasher/go-exiftool.(*Exiftool).ExtractMetadata(0x0, {0xc0004c2608, 0x1, 0xc537e0?})
	/home/daniel/go/pkg/mod/github.com/barasher/[email protected]/exiftool.go:145 +0x5d
github.com/MHNightCat/superfile/components.returnMetaData({{{0xc00012e308, 0x1, 0x1}, 0x64, 0x0}, {{{0xc00011e8f0, 0x5, 0x5}}, 0x0}, {0x0, ...}, ...})
	/home/daniel/tmp/superfile/src/components/function.go:377 +0x2af
github.com/MHNightCat/superfile/components.model.Update({{{0xc00012e308, 0x1, 0x1}, 0x64, 0x0}, {{{0xc00011e8f0, 0x5, 0x5}}, 0x0}, {0x0, ...}, ...}, ...)
	/home/daniel/tmp/superfile/src/components/model.go:179 +0x16d1
github.com/charmbracelet/bubbletea.(*Program).eventLoop(0xc0002da680, {0x944a20?, 0xc00009b808?}, 0xc0002dc240)
	/home/daniel/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:411 +0x5e2
github.com/charmbracelet/bubbletea.(*Program).Run(0xc0002da680)
	/home/daniel/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:543 +0x86b
main.main.func1(0xc000144a40?)
	/home/daniel/tmp/superfile/src/main.go:55 +0x9e
github.com/urfave/cli/v2.(*Command).Run(0xc00018c160, 0xc000144a40, {0xc000116120, 0x1, 0x1})
	/home/daniel/go/pkg/mod/github.com/urfave/cli/[email protected]/command.go:279 +0x97d
github.com/urfave/cli/v2.(*App).RunContext(0xc0001ea200, {0x9450b0, 0xcc9220}, {0xc000116120, 0x1, 0x1})
	/home/daniel/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:337 +0x58b
github.com/urfave/cli/v2.(*App).Run(...)
	/home/daniel/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:311
main.main()
	/home/daniel/tmp/superfile/src/main.go:65 +0xa5
^[[B^[[B^[[B^[[B^[[BA new version v1.0.0 is available.
Please update.
┏

        github.com/MHNightCat/superfile/releases/latest

                                                               β”›

After first run:

Caught panic:

runtime error: invalid memory address or nil pointer dereference

Restoring terminal...

goroutine 1 [running]:
runtime/debug.Stack()
	/usr/lib/go/src/runtime/debug/stack.go:24 +0x5e
runtime/debug.PrintStack()
	/usr/lib/go/src/runtime/debug/stack.go:16 +0x13
github.com/charmbracelet/bubbletea.(*Program).Run.func1()
	/home/daniel/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:478 +0x91
panic({0x811920?, 0xc53360?})
	/usr/lib/go/src/runtime/panic.go:770 +0x132
github.com/barasher/go-exiftool.(*Exiftool).ExtractMetadata(0x0, {0xc000136608, 0x1, 0xc537e0?})
	/home/daniel/go/pkg/mod/github.com/barasher/[email protected]/exiftool.go:145 +0x5d
github.com/MHNightCat/superfile/components.returnMetaData({{{0xc0000aea08, 0x1, 0x1}, 0x64, 0x0}, {{{0xc00039c270, 0x5, 0x5}}, 0x0}, {0x0, ...}, ...})
	/home/daniel/tmp/superfile/src/components/function.go:377 +0x2af
github.com/MHNightCat/superfile/components.model.Update({{{0xc0000aea08, 0x1, 0x1}, 0x64, 0x0}, {{{0xc00039c270, 0x5, 0x5}}, 0x0}, {0x0, ...}, ...}, ...)
	/home/daniel/tmp/superfile/src/components/model.go:179 +0x16d1
github.com/charmbracelet/bubbletea.(*Program).eventLoop(0xc00025dba0, {0x944a20?, 0xc00009b008?}, 0xc000098300)
	/home/daniel/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:411 +0x5e2
github.com/charmbracelet/bubbletea.(*Program).Run(0xc00025dba0)
	/home/daniel/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:543 +0x86b
main.main.func1(0xc00003eac0?)
	/home/daniel/tmp/superfile/src/main.go:55 +0x9e
github.com/urfave/cli/v2.(*Command).Run(0xc0001fe160, 0xc00003eac0, {0xc000024170, 0x1, 0x1})
	/home/daniel/go/pkg/mod/github.com/urfave/cli/[email protected]/command.go:279 +0x97d
github.com/urfave/cli/v2.(*App).RunContext(0xc0001ca200, {0x9450b0, 0xcc9220}, {0xc000024170, 0x1, 0x1})
	/home/daniel/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:337 +0x58b
github.com/urfave/cli/v2.(*App).Run(...)
	/home/daniel/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:311
main.main()
	/home/daniel/tmp/superfile/src/main.go:65 +0xa5

Better predefined user directories in sidebar and localization

Localization is another issue we should improve on for consistency and accessibility but this isn't the main focus of this issue.

Currently, a few common directories (Documents, Downloads, Pictures and Videos) are added below Home. These are hardcoded under src/components/function.go in the getFolder() function.

image

Problem

There are two prominent issues with this implementation:

1. Localication

Some people might not use English localizations for their system. E.g. in Germany Documents would be Dokumente and Pictures be Bilder.

2. Non-existent directories

This ties into the first problem. I don't have a Pictures directory. But I might have an Images folder.

image

Also note, that in the top status bar it reads videos where on the sidebar it reads Videos.

Solution

Without XDG user directories

If the user does not have predefined user directories, we could display only well known directories. I don't know how we could handle the localization in this case. Maybe with a structure listing the names of the Pictures folder in i18n languages.

BSDs and macOS don't use XDG-* directories by default, even tho they support it.

With XDG user directories

If you use any "normal" Linux distro or install one of the big desktop environments like Gnome or KDE, you most probably have the XDG-* utilities installed on your system. By default they create user directories based on the systems language.

You can also create more XDG_*_DIRs by adding them to XDG_CONFIG_HOME/user-dirs.dirs. XDG_CONFIG_HOME/user-dirs.locale can be used to override the localization (e.g. en_US).

~/.config/user-dirs.dirs:

XDG_DESKTOP_DIR="$HOME/desktop"
XDG_DOWNLOAD_DIR="$HOME/downloads"
XDG_TEMPLATES_DIR="$HOME/templates"
XDG_PUBLICSHARE_DIR="$HOME/public"
XDG_DOCUMENTS_DIR="$HOME/documents"
XDG_MUSIC_DIR="$HOME/music"
XDG_PICTURES_DIR="$HOME/pictures"
XDG_VIDEOS_DIR="$HOME/videos"
# Added by me
XDG_PASSWORDS_DIR="$HOME/passwords"
XDG_PROJECTS_DIR="$HOME/projects"

With xdg-user-dirs-update you can generate these directories.

We could check for the xdg-utils and list the folders based on that.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Errored

These updates encountered an error and will be retried. Click on a checkbox below to force a retry now.

  • fix(deps): update module github.com/alecthomas/chroma to v2

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

  • fix(deps): update module github.com/charmbracelet/lipgloss to v0.11.0

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/superfile-build-test.yml
  • actions/checkout v4
  • actions/setup-go v5
.github/workflows/update-gomod2nix.yml
  • actions/checkout v4
  • cachix/install-nix-action v27
gomod
go.mod
  • go 1.22.2
  • github.com/adrg/xdg v0.4.0
  • github.com/alecthomas/chroma v0.10.0
  • github.com/atotto/clipboard v0.1.4
  • github.com/barasher/go-exiftool v1.10.0
  • github.com/charmbracelet/bubbles v0.18.0
  • github.com/charmbracelet/bubbletea v0.26.4
  • github.com/charmbracelet/lipgloss v0.10.0
  • github.com/lithammer/shortuuid v3.0.0+incompatible
  • github.com/muesli/termenv v0.15.2
  • github.com/reinhrst/fzf-lib v0.9.0
  • github.com/rkoesters/xdg v0.0.1
  • github.com/shirou/gopsutil v3.21.11+incompatible
  • github.com/urfave/cli/v2 v2.27.2
  • golift.io/xtractr v0.2.2
  • github.com/yorukot/ansichroma v0.1.0
  • github.com/charmbracelet/x/exp/term v0.0.0-20240617190524-788ec55faed1@788ec55faed1
  • github.com/mattn/go-runewidth v0.0.15
  • github.com/muesli/reflow v0.3.0
  • github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646@83c6a9932646
  • github.com/pelletier/go-toml/v2 v2.2.2
npm
website/package.json
  • @astrojs/starlight ^0.24.0
  • @expressive-code/plugin-collapsible-sections ^0.35.0
  • @expressive-code/plugin-line-numbers ^0.35.0
  • @fontsource/ibm-plex-mono ^5.0.8
  • @fontsource/ibm-plex-serif ^5.0.8
  • astro ^4.4.9
  • hast-util-to-html ^9.0.0
  • sharp ^0.33.0

  • Check this box to trigger a request for Renovate to run again on this repository

Trash can error: No such file or directory

When trying to delete a file with ctrl+d, I get the following error in the log files:

2024/04/09 09:11:22 Delete single item function move file to trash can error
2024/04/09 09:11:22 open /home/luca/.local/share/Trash/info/superfile.log.trashinfo: no such file or directory

image

I think it would be nice if the XDG-folder would be created if it doesn't exist already.

The latest AUR -bin doesn't provide the `spf` command

Describe the bug
When installing the latest bin, it is expected that the installed package provides spf so superfile can run. This doesn't appear to be the case, and it must be invoked using /bin/superfile

To Reproduce
Steps to reproduce the behavior:

  1. Install the latest bin on your system
  2. Invoke spf to open superfile
  3. See error

Expected behavior
Superfile launches normally

System information

  • CPU: quad core AMD Ryzen 5 2400G with Radeon Vega Graphics (-MT MCP-)
  • speed/min/max: 1536/1600/3600 MHz
  • Kernel: 6.8.9-artix1-2 x86_64
  • Mem: 13.6 GiB
  • Shell: Zsh
  • OS: [e.g. iOS]
  • Version [e.g. 22]
  • Superfile Version: 1.1.2-1

key `l` deletes files

Describe the bug
When I press the l key, it deletes the file if it is no longer a folder to go into.

To Reproduce
Steps to reproduce the behaviour:

  1. Go to a file,
  2. Press l

Expected behaviour
Nothing should happen, there is no folder to go into, and therefore nothing should happen (maybe later do a preview or select the file, I don't know)

Screenshots
Not, possible.

System information (please complete the following information):

  • OS: MacOS
  • Version: 14.5

Get external media error

While using superfile the log file is being spammed with "Get external media error":

Get external media error
open /run/media/main: no such file or directory

The reason it happens is because I don't use /run/media/<user>, instead I mount my drives to /mnt.

It would be nice if superfile supported /mnt as a valid external media as well. An example of such path is /mnt/example-drive/.

Cut -> Paste file causes go panic

Describe the bug
When pasting a newly created file, I get a go panic.

To Reproduce
Steps to reproduce the behavior:

  1. Start spf from a terminal window
$ spf
  1. Open a second panel (<ctrl-p>)
  2. Create a new file named "test-file.txt" in the new panel (c test-file.txt <enter>)
  3. Switch to the previous panel (<tab>)
  4. Create a new folder named destination (f destination<enter>)
  5. Scroll to new folder, and open it (j... <enter>)
  6. Move to second panel, select "test-file.txt" (<tab> j....)
  7. Cut File from second panel (<ctrl-x>)
  8. Observe that the file location is present in the "clipboard" panel
  9. Move to first panel (<tab>)
  10. Paste Item (<ctrl-v>)
  11. See error

Expected behavior
I would expect to see test-file.txt in the left-hand panel, and not in the right hand panel.

Screenshots

panic: runtime error: index out of range [0] with length 0

goroutine 504 [running]:
github.com/MHNightCat/superfile/components.pasteItem({{{0x140000aa008, 0x2, 0x2}, 0x41, 0x0, 0x5}, {{0x140003ff340, 0x9, 0xe}, 0x0}, ...})
	github.com/MHNightCat/superfile/components/global_controller.go:353 +0xbf4
github.com/MHNightCat/superfile/components.mainKey.func4()
	github.com/MHNightCat/superfile/components/key_function.go:67 +0x44
created by github.com/MHNightCat/superfile/components.mainKey in goroutine 1
	github.com/MHNightCat/superfile/components/key_function.go:66 +0x19b0

System information (please complete the following information):

  • OS: MacOS
  • Version 14.4.1
  • Superfile Version 1.1.1
  • Installed from primary homebrew repo

Remove open terminal function

superfile is a TUI based file manager. I don't see the use case for opening a terminal inside of the file manager. GUI based file managers like Konsole sometimes implement a terminal because they are not a terminal based application.

If one needs a terminal in the same terminal as superfile, we can use tmux for that. That's what Tmux is used for.

Also, no need to spawn a new Terminal, just creating a subshell would be enough. No need to check for a googol amount of possible terminal applications.

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.