GithubHelp home page GithubHelp logo

afify / sfm Goto Github PK

View Code? Open in Web Editor NEW
202.0 8.0 18.0 258 KB

simple file manager

Home Page: https://git.afify.dev/sfm

License: ISC License

Makefile 1.51% C 96.66% Roff 1.83%
simple suckless file-manager c sfm filemanager terminal tty tui

sfm's Introduction

sfm logo

simple file manager

Build status

Description

sfm is a simple file manager for unix-like systems.

  • pthreads(7) to read events, no timers.
  • BSD kqueue(2) - kernel event notification mechanism.
  • Linux inotify(7) - monitoring filesystem events.
  • dual pane.
  • bookmarks.
  • open files by extension.
  • bottom statusbar.
  • vim-like key bindings.
  • filter.
  • no dependencies.
  • c99 static linking.
  • based on termbox.
  • Inspired by vifm and noice.
  • Follows the suckless philosophy.

Patches

sfm-patches

Performance

$ perf stat -r 10 sfm

Options

$ sfm [-v]
$ man sfm

sfm screenshot

Installation

Packaging status

current

git clone git://git.afify.dev/sfm
cd sfm/
make
make install

latest release

[ "$(uname)" = "Linux" ] && shacmd="sha256sum" grepf="--color=never"|| shacmd="sha256"
latest=$(curl -s https://git.afify.dev/sfm/tags.xml | grep $grepf -m 1 -o "\[v.*\]" | tr -d '[]')
tgz="https://git.afify.dev/sfm/releases/sfm-${latest}.tar.gz"
sha="${tgz}.sha256"
wget "${tgz}"
wget "${sha}"
${shacmd} -c "sfm-${latest}.tar.gz.sha256" && \
tar -xzf "sfm-${latest}.tar.gz" && cd "sfm-${latest}" && \
make
make install

Run

$ sfm

Configuration

The configuration of sfm is done by creating a custom config.h and (re)compiling the source code. This keeps it fast, secure and simple.

sfm's People

Contributors

afify avatar chripo avatar ddkn avatar mohamedafify avatar sikmir avatar tdukv 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  avatar  avatar

sfm's Issues

Can't open sfm in DWM

  1. I did try to open sfm in st using "st -e sfm" got an error - child terminated due to signal 11

  2. from dwm I couldn't open the sfm and found error in dmesg

dwm config
static const char *sfmcmd[] = { "st","-e","sfm", NULL };

dmesg :
[ 2191.463223] sfm[12387]: segfault at 55c692b3a044 ip 000055c6928d0e5e sp 00007ffcfe4138f0 error 4 in sfm[55c6928cf000+5000]
[ 2228.099152] sfm[12567]: segfault at 56022a04c044 ip 00005602297f2e5e sp 00007ffceb439f60 error 4 in sfm[5602297f1000+5000]

$ coredumpctl info
PID: 107363 (sfm)
UID: 1000
GID: 1000
Signal: 11 (SEGV)
Timestamp: Thu 2021-08-05 13:54:14 BST (3h 15min ago)
Command Line: sfm
Executable: /usr/local/bin/sfm
Control Group: /user.slice/user-1000.slice/session-1.scope
Unit: session-1.scope
Slice: user-1000.slice
Session: 1
Owner UID: 1000
Storage: /var/lib/systemd/coredump/core.sfm.1000.67236f5e79e74e349e45ad8d57fb1103.107363.1628168054000000.zst (present)
Disk Size: 26.7K
Message: Process 107363 (sfm) of user 1000 dumped core.

            Found module linux-vdso.so.1 with build-id: 67a240aff4f3f650a6de241a4cf5a0a6148d7fac
            Found module ld-linux-x86-64.so.2 with build-id: 040cc3dd10461562f177df39e3be2f3704258c3c
            Found module libc.so.6 with build-id: 4b406737057708c0e4c642345a703c47a61c73dc
            Found module libpthread.so.0 with build-id: 07c8f95b4f3251d08550217ad8a1f31066229996
            Found module sfm with build-id: 7c9f4d52cde0a8b47c3bce0612a1dc7eb0e6326c
            Stack trace of thread 107363:
            #0  0x000055805b694e5e n/a (sfm + 0x5e5e)
            #1  0x000055805b69548c n/a (sfm + 0x648c)
            #2  0x000055805b6935f7 n/a (sfm + 0x45f7)
            #3  0x00007f31a41d2b25 __libc_start_main (libc.so.6 + 0x27b25)
            #4  0x000055805b69371e n/a (sfm + 0x471e)

Custom colors

Would be really nice to see an option of setting custom colors, for example, in the config.h file.

Shell access from the file manager

Mostly coming from lf file manager, but I believe that quick access to shell could be really handy. Either in a form of a shell bar appearing on a key press, akin to how filter works now.

Or just have a key to open current folder in a shell. Like, you press key, get into terminal from the same folder you were in, do what you want, type exit and get back to the file manager.

Hiding dotfiles

Is it possible to bind some key for hiding/unhiding dotfiles? They are usually distracting.

Renaming of files

I just compiled sfm and like it very much already. Thanks for providing this! I ran into one stumble block though...

I doesn't seem to be possible to use spaces or non-english characters when renaming files with the cw command. Is this a bug? Would it be possible to add this functionality?

Also, if the filename is very long (like 60 characters), you only get the remaining character space left on the line to use for renaming the file (like 10 characters). Perhaps to skip showing the original name on the editing line could be a good idea (since you see which file you have selected for editing in the file list above anyway). Or rather, one could have the original name there for editing (like if you have a long filename and just want to change one or two characters).

So what do you say?

Visual copy

Hi @afify ,

As requested, here is the new issue explaining the visual copy problem.

I am able to copy files and see them update, however, it only copies a subset of files on both systems. If I copy 5 it may paste 3; this happens on both systems (see below for a video of both). Also, in some cases I can get it to trigger a segfault on delete d, when I select too many files, there is a "Cannot allocate memory" on mac and a core dump on OpenBSD.

Video demonstrations

In my case I run on dedicated hardware for OpenBSD, which I have two machines a laptop and a server. Both exhibit the same issue. And for additional context on OpenBSD I run xterm and an mac I am running their vanilla Terminal v2.8.3.

File types and default programs

Hello!

I have been playing around with sfm and it is very neat and lightweight! I was wondering on the choices on default applications. Would it be useful to not have apps choose between (or fall back to) xdg-open or some predefined apps? I am sure you have thought of this, but having a configuration file of some sort to set some defaults? Or define new filetypes that an be added to the images/arts/pdf/obj/etc... extensions. I was curious if this was in the works.

Otherwise awesome!

threads build on mac

Hi @afify,

So I figured the pull request was not a good place for this conversation. I went to build on mac with and I am seeing this,

$ make
sfm build options:
CFLAGS   = -std=c99 -pedantic -Wall -Wextra -Wvla -O3 -g -DVERSION="0.1" -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 -D_BSD_SOURCE
LDFLAGS  = -pthread -s
CC       = cc
cc -c -std=c99 -pedantic -Wall -Wextra -Wvla -O3 -g -DVERSION=\"0.1\" -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 -D_BSD_SOURCE sfm.c
sfm.c:481:6: error: use of undeclared identifier 'show_perm'
        if (show_perm == 1) {
            ^
sfm.c:488:6: error: use of undeclared identifier 'show_ug'
        if (show_ug == 1) {
            ^
sfm.c:499:6: error: use of undeclared identifier 'show_dt'
        if (show_dt == 1) {
            ^
sfm.c:508:6: error: use of undeclared identifier 'show_size'
        if (show_size == 1 && S_ISREG(cursor->mode)) {
            ^
sfm.c:588:44: warning: format specifies type 'long' but the argument has type 'off_t' (aka 'long long') [-Wformat]
        if (snprintf(result, result_len, "%ld%c", size, unit) < 0)
                                          ~~~     ^~~~
                                          %lld
/usr/include/secure/_stdio.h:57:62: note: expanded from macro 'snprintf'
  __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
                                                             ^~~~~~~~~~~
sfm.c:1144:12: warning: variable length array used [-Wvla]
        char *argv[argc + 2];
                  ^
2 warnings and 4 errors generated.
make: *** [sfm.o] Error 1

Which is the same error I am getting on OpenBSD. It seems you have the structs defined in sfm.c but the variables defined in config.def.h. I am sure this is something you are seeing.

sfm terminated by signal SIGABRT

After upgrading to 0.3 I have such issue:

$ readlink ./result
/nix/store/73shvirhxz8088jlnvk9j53yrr6vz28s-sfm-0.3
$ ./result/bin/sfm
*** buffer overflow detected ***: terminated
                                            fish: Job 1, './result/bin/sfm' terminated by signal SIGABRT (Abort)
$ coredumpctl gdb
...
(gdb) bt
#0  0x00007f2c84a2abaa in raise ()
   from /nix/store/cvr0kjg2q7z2wwhjblx6c73rv422k8cm-glibc-2.33-47/lib/libc.so.6
#1  0x00007f2c84a15523 in abort ()
   from /nix/store/cvr0kjg2q7z2wwhjblx6c73rv422k8cm-glibc-2.33-47/lib/libc.so.6
#2  0x00007f2c84a6b2e8 in __libc_message ()
   from /nix/store/cvr0kjg2q7z2wwhjblx6c73rv422k8cm-glibc-2.33-47/lib/libc.so.6
#3  0x00007f2c84af8382 in __fortify_fail ()
   from /nix/store/cvr0kjg2q7z2wwhjblx6c73rv422k8cm-glibc-2.33-47/lib/libc.so.6
#4  0x00007f2c84af6e40 in __chk_fail ()
   from /nix/store/cvr0kjg2q7z2wwhjblx6c73rv422k8cm-glibc-2.33-47/lib/libc.so.6
#5  0x00007f2c84af7374 in __realpath_chk ()
   from /nix/store/cvr0kjg2q7z2wwhjblx6c73rv422k8cm-glibc-2.33-47/lib/libc.so.6
#6  0x0000000000402cc9 in ?? ()
#7  0x0000000000403f14 in ?? ()
#8  0x0000000000404528 in ?? ()
#9  0x000000000040261e in ?? ()
#10 0x00007f2c84a16780 in __libc_start_main ()
   from /nix/store/cvr0kjg2q7z2wwhjblx6c73rv422k8cm-glibc-2.33-47/lib/libc.so.6
#11 0x000000000040274a in ?? ()
$ cd result
$ ./bin/sfm
 ...sfm runned OK...

Again, there were no such issue with 0.2.
There is no such problem on macOS.

No correct selection line re-drawing in fullscreen

Hello! Here I have a visual issue: in fullscreen when you go to directory, selection line from previous directory and some very long file names are displaying. It's hard to explain, so, screens.

Here I'll go to "somedirectories"
1
And here what I have
2

Breakage

Does'nt open after installation. error show [FAILED 1773] tb_init()

control c killing just mpv and not sfm

Make it so sfm does not closes itself after pressing control c in mpv/sxiv.

My idea is making it so mpv stops running after i kill it with control c but sfm stays

Scrolling doesn't work properly

Steps to reproduce

  1. There is a folder with a lot of files (e.g. 300)
  2. Start sfm
  3. Scroll from top to bottom (using Pg-Dn or j)
  4. Scroll back to top (using Pg-Up or k)

Actual behaviour

There is no way to scroll to actual top.

Expected behaviour

It should be possible to scroll up to actual top.

Configuration

581a368

Aborted (core dumped)

I opened and edited some files with sfm and left it open for a while then eventually double free or corruption (!prev) and Aborted (core dumped) showed up and sfm crashed. I am using st and tmux.

Issue with opening sfm from a script/dmenu

An issue that I spotted is when I try to run sfm from a script, it fails to start.
I tried "st -e sfm", "st sfm" or just a script with sfm, but nothing succeded unfortunately.

2 panes

I found sfm wonderfull, but in my opinion (sense of taste, if you will), I feel rare having 2 panes, is there an option or a flag to only have 1 pane, or do I need to modify sfm.c in order to achieve that.

Thansk in advance!!!

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.