2017-02-21T00:40:34ZFluxBBhttps://bbs.archlinux.org/viewtopic.php?id=112643Just out of curiosity: Why does sxiv use it's own cache directory and mechanism for thumbnails, as opposed to what is recommended by freedesktop.org?

I am not complaining... just wondering.

]]>https://bbs.archlinux.org/profile.php?id=681912017-02-21T00:40:34Zhttps://bbs.archlinux.org/viewtopic.php?pid=1692596#p1692596Thanks again. I can see it was definitely worth posting here ☺

I really need to study the man pages a bit more to end up with the most simple and fastest command line... I didn't know about the `-i` option of sxiv either.

My final line now is:

find . -type f -iname '*.jpg' -not -iname '*.lzn.*' | sxiv -ifbt

But now I wonder if any kind of sorting could be implemented... most of my file organization is like so:

YYYY/YYYY-MM-DD - <camera> - <text>/<camera>-<roll>-<img-no>.jpg

(I shoot mostly film and use a few different cameras, in case you wonder about "roll" and "camera".)

`find` and `sxiv` don't have a sorting option as far as I can see, so piping the find output through sort would be the only option:

I already wrote a little script that allows me to just view images of a certain camera; I think I will expand on that to include displaying images from a certain year.

OK, enough of that, not sure if this is the right place to discuss these kinds of scripts, which are not 100% sxiv related.

]]>https://bbs.archlinux.org/profile.php?id=681912016-07-04T22:40:28Zhttps://bbs.archlinux.org/viewtopic.php?pid=1638977#p1638977Doh. Yeah, -i 's the way to go (and in case it's not clear from progandy's example, the criteria for find can be arbitrarily complex, using -not, -or and parentheses to built as complex conditionals as you need)]]>https://bbs.archlinux.org/profile.php?id=634122016-07-04T13:40:08Zhttps://bbs.archlinux.org/viewtopic.php?pid=1638874#p1638874drtebi wrote:

That is why I used the `tr` command... I am not sure if I could achieve the same without?

Today I needed to search for an image. Rather than going through each directory etc., I figured there must be some command-line trick.

This is what I came up with:

find . -type f -name '*jpg' | tr "\n" "\0" | xargs -0 sxiv -qfbt

It searches for images in the current directory and all sub-directories, then opens sxiv in thumb view with the results.

I am sure there are smarter ways to do this, but this worked for me.

You definitely want the -print0 instruction to find. Also, usually -iname is safer (some files may be named JPG and won't be found by your -name search)

find . -type f -iname "*.jp[eg]" -print0 | xargs -0 sxiv -qfbt

I also changed the expression so it finds '.jpe' files as well; it still can't find .jpeg.

For complete accuracy, consider using -iregex instead of -name / -iname; it will allow to find -all- jpegs (.jpg/.jpeg/.jpe) . A quick test suggests that "-iregex '.*.jp[eg]g?'" is correct.

...

All that said, are you aware of sxiv's `-r` option? It's usually fine, if you simply want all images in a directory. Non-images are automatically filtered out. The only thing to beware of is that large video files take sxiv a long time to detect as 'not an image'.

Thanks for these great tips!

The jpeg/jpe/jpg option is not really a concern for me, I have made sure to always rename all images to .jpg.

Regarding the '-r' option, that would not work for me, because I actually have to filter out images that have "lzn" in their filename. These are created by LightZone, the image editor I have been using (they are small preview files with embedded processing instructions for LightZone). Currently I simply filter them out with `grep -v`. Thus my actual `find` line is:

Today I needed to search for an image. Rather than going through each directory etc., I figured there must be some command-line trick.

This is what I came up with:

find . -type f -name '*jpg' | tr "\n" "\0" | xargs -0 sxiv -qfbt

It searches for images in the current directory and all sub-directories, then opens sxiv in thumb view with the results.

I am sure there are smarter ways to do this, but this worked for me.

You definitely want the -print0 instruction to find. Also, usually -iname is safer (some files may be named JPG and won't be found by your -name search)

find . -type f -iname "*.jp[eg]" -print0 | xargs -0 sxiv -qfbt

I also changed the expression so it finds '.jpe' files as well; it still can't find .jpeg.

For complete accuracy, consider using -iregex instead of -name / -iname; it will allow to find -all- jpegs (.jpg/.jpeg/.jpe) . A quick test suggests that "-iregex '.*.jp[eg]g?'" is correct.

...

All that said, are you aware of sxiv's `-r` option? It's usually fine, if you simply want all images in a directory. Non-images are automatically filtered out. The only thing to beware of is that large video files take sxiv a long time to detect as 'not an image'.

]]>https://bbs.archlinux.org/profile.php?id=634122016-07-04T04:05:32Zhttps://bbs.archlinux.org/viewtopic.php?pid=1638803#p1638803Loving sxiv, since the first run.

Today I needed to search for an image. Rather than going through each directory etc., I figured there must be some command-line trick.

This is what I came up with:

find . -type f -name '*jpg' | tr "\n" "\0" | xargs -0 sxiv -qfbt

It searches for images in the current directory and all sub-directories, then opens sxiv in thumb view with the results.

I am sure there are smarter ways to do this, but this worked for me.

]]>https://bbs.archlinux.org/profile.php?id=681912016-07-03T07:32:20Zhttps://bbs.archlinux.org/viewtopic.php?pid=1638584#p1638584Thanks for the idea.Perhaps I've miscommunicated, though. Non-blocking stdin could not achieve this as far as I understand, as a) the insertion needs to be triggered via the keyhandler rather than an input stream, and b) the insertion should be at the current cursor location, not end of list.

To give a little context, I am aiming to insert 'headings' in a list of images I'm organizing. So, user presses key, is prompted for string, image is constructed and should be inserted in file list. Further context to that is that my fork of sxiv includes commands to rearrange the filelist, and an option to output entire filelist at exit, so this 'organising' is actually possible at all.

My current best candidate idea is that sxiv provides the name of a temporary file, and the filelist size, to the key handler, and the key handler can write any number of 'INDEX\nFILENAME' pairs to it (with index='' equalling current cursor pos, index=-1 equalling end of list, etc).

Hi, just posting to ask about inserting files in the filelist at runtime. Personally, I have decided this is a necessity for dealing with larger filelists. If you've implemented something like this, I'd appreciate hearing about it.

I rather think you should implement non-blocking stdin input that keeps adding files during the sxiv runtime when new data is available.

]]>https://bbs.archlinux.org/profile.php?id=602612015-11-25T15:55:22Zhttps://bbs.archlinux.org/viewtopic.php?pid=1581338#p1581338Hi, just posting to ask about inserting files in the filelist at runtime. Personally, I have decided this is a necessity for dealing with larger filelists. If you've implemented something like this, I'd appreciate hearing about it.

Currently, I have one idea how to do this: A command that reads the clipboard content, and inserts files in the filelist at the current index.This approach has a few wrinkles when used in conjunction with keyhandler script.

* Destroys the current clipboard content* The insertion command following any insertion-orientated keyhandler command must be triggered by xdotool hackery, which is unreliable.

]]>https://bbs.archlinux.org/profile.php?id=634122015-11-23T23:26:29Zhttps://bbs.archlinux.org/viewtopic.php?pid=1580885#p1580885I've just pushed a very simple commit to my clone of sxiv, which may be of interest to anyone currently using the -o option.This commit implements an -O option, which outputs -all- files remaining in the filelist upon exit, rather than only those that are marked.

IME this is much easier for the use case where you are gradually narrowing down a list of images. And especially is not vulnerable to the 'f%*&, I forgot to select all before quitting, now my list is just empty...' mistake.

EDIT: Note that there currently seems to be an occasional bug with this, where images removed from the filelist are still output. Exactly what triggers it is unclear.It could even be a bug with the following SpaceFM script I use to filter a filelist:

TMP=/tmp/sxivfilt.$$
sxiv -i -O < "$fm_file" > "$TMP"
# XXX there is still some problem with files removed from filelist hanging around.
# I think I need to trigger a check at exit, or something?
if [ -s "$TMP" ]; then
mv "$TMP" "$fm_file"
fi

but tbh, the above seems very simple.

]]>https://bbs.archlinux.org/profile.php?id=634122015-09-25T05:18:31Zhttps://bbs.archlinux.org/viewtopic.php?pid=1564696#p1564696Yeah, I was unclear in communicating there -- when I said 'the example script' I meant the one that sxiv installs on your system, not one you've gotten off eg. browsing the source tree in github.

I also feel kind of silly for not realizing that 'read file' was supposed to be a command.

Anyhow, for future reference, following bug-reporting etiquette insofar as noting the precise version that you are running can help a lot in resolving these issues quickly.(In the case of sxiv, running `sxiv -v` reports the version.).

]]>https://bbs.archlinux.org/profile.php?id=634122015-09-07T00:08:10Zhttps://bbs.archlinux.org/viewtopic.php?pid=1559943#p1559943Thanks a lot. The wiki should really mention this.]]>https://bbs.archlinux.org/profile.php?id=933712015-09-06T19:42:57Zhttps://bbs.archlinux.org/viewtopic.php?pid=1559858#p1559858The wiki is too new. It is based on the git version (sxiv-git in AUR), not the stable that is available in community.Edit: sxiv 1.3.1 sends the file paths as commandline arguments, sxiv-git sends them as via stdin. The stdin way is described in the wiki.Edit: /usr/share/sxiv/exec/key-handler always has an example key handler that works with the installed version.]]>https://bbs.archlinux.org/profile.php?id=602612015-09-06T17:01:22Zhttps://bbs.archlinux.org/viewtopic.php?pid=1559799#p1559799likytau wrote:

I'm not sure what else to check, honestly.. * Maybe you could try a different shell in the shbang line (eg zsh or dash)?* This sounds like a silly question, but is the file set as readable? (and yes, the shbang line appears to be successfully read even if the file is set unreadable. Don't ask me to explain how that works, because I have no idea.)