bakkeby / sxiv-flexipatch

Simple X Image Viewer
GNU General Public License v2.0
35 stars 7 forks source link

Could you add that all images from a directory are loaded? #8

Open fov95 opened 2 years ago

fov95 commented 2 years ago

Someone patched his Sxiv so if you open a picture it automatically loads in all other pictures in the given directory so one can scroll through.. I know there is hacky stuff but this would be a nice addition to flexipatch imho.. https://github.com/qsmodo/sxiv

edit: I might be to stupid to get it to work right.. I know there is an -F option but I have to give it a list.. like -F file filelist.. then it works.. but it's hard to integrate into my filemanager..

One could do something like sxiv file "$(pwd)" but then u have a duplicate. I'd rather have an internal function..

N-R-K commented 2 years ago

IMO, this is better done via a script like sxiv-rifle.

Also there's a couple hacky things going on with that patch such as looping through the entire filelist for every single file. And then looping through it again to find the initial file.

https://github.com/qsmodo/sxiv/blob/7888d0017b3eb60e38dca5bb2c13d75f15d1ab14/main.c#L130-L134 https://github.com/qsmodo/sxiv/blob/7888d0017b3eb60e38dca5bb2c13d75f15d1ab14/main.c#L931-L936

On my system, this ends up being noticeably slower than the sxiv-rifle script (run via dash) when opening large directories.

N-R-K commented 2 years ago

Anyhow, you can probably use this (append .patch to the url to download the patch) if you really want a native patch.

fov95 commented 2 years ago

IMO, this is better done via a script like sxiv-rifle.

Also there's a couple hacky things going on with that patch such as looping through the entire filelist for every single file. And then looping through it again to find the initial file.

https://github.com/qsmodo/sxiv/blob/7888d0017b3eb60e38dca5bb2c13d75f15d1ab14/main.c#L130-L134 https://github.com/qsmodo/sxiv/blob/7888d0017b3eb60e38dca5bb2c13d75f15d1ab14/main.c#L931-L936

On my system, this ends up being noticeably slower than the sxiv-rifle script (run via dash) when opening large directories.

Yea well I want to implement it into my gui fm pcmanfm, which is kinda picky with what works and what not. I wasn't able to get sxiv-rifle working in there. I don't need sxiv-rifle when in my terminal when I can simply use -F $1 "$(pwd)" in my little sxiv view script. But it doesn't work in pcmanfm somehow.. I can recall having it working somehow in the past but I forgot how..

N-R-K commented 2 years ago

I had used pcmanfm to launch images via the sxiv-rifle script in the past just fine.

You probably just need to add a .desktop entry. Try copying the sxiv desktop entry and under Exec replace sxiv with /path/to/sxiv-rifle. https://github.com/muennich/sxiv/blob/master/sxiv.desktop

fov95 commented 2 years ago

That's weird because I used the same command in pcmanfm and it didn't work. Now with the desktop file it does work. This should not be an issue imo. Thanks.

Oups.. So I got a file named 416x416.PNG and the rifle script refuses to open it. It works fine with sxiv alone.

N-R-K commented 2 years ago

Oups.. So I got a file named 416x416.PNG and the rifle script refuses to open it. It works fine with sxiv alone.

That's a bug with the current sxiv-rifle script, it checks the file extension only in lower case. Consider applying this patch https://github.com/ranger/ranger/pull/2586/.

fov95 commented 2 years ago

With that it only opens a single image

N-R-K commented 2 years ago

With that it only opens a single image

Works fine on my end, what's the filename of image you're trying to open?

fov95 commented 2 years ago

I forgot to add that it oes not work with pcmanfm. it does from terminal however