You are not logged in.

#326 2013-09-07 01:46:25

karol
Archivist
Registered: 2009-05-06
Posts: 25,431

Re: sxiv - Simple image viewer written in C

I'm using dwm, what WM do you use?

Offline

#327 2013-09-07 01:52:28

dgz
Member
Registered: 2013-08-27
Posts: 97

Re: sxiv - Simple image viewer written in C

echinus, which is based on dwm i believe.

Offline

#328 2013-09-08 16:08:05

doggone
Member
Registered: 2013-06-19
Posts: 49

Re: sxiv - Simple image viewer written in C

The quiet (-q) option isn't working here. Can anyone else confirm that?

Offline

#329 2013-09-08 16:22:02

Unia
Member
From: The Netherlands
Registered: 2010-03-30
Posts: 2,472
Website

Re: sxiv - Simple image viewer written in C

dgz wrote:

echinus, which is based on dwm i believe.

Based on, but no longer resembling to. That's a big difference concerning issues like this


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#330 2013-09-08 19:59:23

karol
Archivist
Registered: 2009-05-06
Posts: 25,431

Re: sxiv - Simple image viewer written in C

doggone wrote:

The quiet (-q) option isn't working here. Can anyone else confirm that?

Seems to work for me:

$ sxiv -fs *
sxiv: warning: could not open image: 09.txt.lrz
$ sxiv -fsq *
$ 

Offline

#331 2013-09-09 13:52:22

doggone
Member
Registered: 2013-06-19
Posts: 49

Re: sxiv - Simple image viewer written in C

Thanks for the feedback, karol. I just found a post from ber_t saying that -q does not suppress libpng warnings and the like because he apparently cannot control them.

Offline

#332 2013-09-09 14:01:52

karol
Archivist
Registered: 2009-05-06
Posts: 25,431

Re: sxiv - Simple image viewer written in C

doggone wrote:

Thanks for the feedback, karol. I just found a post from ber_t saying that -q does not suppress libpng warnings and the like because he apparently cannot control them.

Can you please post a link to that post? I can't seem to find it.


Edit: Nwm, found it: https://bbs.archlinux.org/viewtopic.php … 41#p885741
In this case you can redirect stderr to a file or /dev/null.

Last edited by karol (2013-09-09 14:04:31)

Offline

#333 2013-09-09 18:36:40

doggone
Member
Registered: 2013-06-19
Posts: 49

Re: sxiv - Simple image viewer written in C

karol wrote:

In this case you can redirect stderr to a file or /dev/null.

Ugh.. Why did I not think of this? A thousand thanks.

Offline

#334 2013-09-09 23:49:08

dgz
Member
Registered: 2013-08-27
Posts: 97

Re: sxiv - Simple image viewer written in C

dgz wrote:

i can't seem to get images to fit to the window, the -d option does nothing, and different -z values are also not useful.

this was solved by setting the master tiling window area to one window instead of two.

Offline

#335 2013-10-23 15:10:09

robertpeston
Member
Registered: 2013-10-23
Posts: 16

Re: sxiv - Simple image viewer written in C

Hi.  I've just registered to let you know what a fantastic program SXIV is.  I've been converted from Feh and I love it.  I also like that you are keeping it as simple as possible.  It's great for large folders on old hardware.  The thumbnails are slick.  It's fast.  Efficient animated GIF handling and image quality is top notch.  It does everything I need and not much of what I dont.

I've one idea though wink

I use cmus (C*music) and it has this cool extra program that it listens to: cmus-remote.  You can use this to send a new file to cmus, to pause it, to get the status

I'd like to be able use SXIV as a preview window with ranger and a sxiv-remote could work here.  Perhaps all we really need is a flag on initial launch which sets it to single instance mode and not to steal focus in that mode.

This may be outside what you want to do, just putting the idea out there.

Also, I've removed the rotation options and recompiled.  I know they are lossless, but they make my images fail md5 verification and there is no confirmation to write to the file.  With the mouse wheel set to advance images I am in heaven.  I just need to know how to setup the Esc key to exit.

Finally, thank you for you efforts.

Offline

#336 2013-10-23 15:39:08

dgz
Member
Registered: 2013-08-27
Posts: 97

Re: sxiv - Simple image viewer written in C

surely ranger's built-in image previews serve that purpose?

adhydUZo.jpg

Offline

#337 2013-10-23 16:07:50

OK100
Member
From: [U==]
Registered: 2010-04-26
Posts: 453

Re: sxiv - Simple image viewer written in C

robertpeston wrote:

I've one idea though wink

I use cmus (C*music) and it has this cool extra program that it listens to: cmus-remote.  You can use this to send a new file to cmus, to pause it, to get the status

I'd like to be able use SXIV as a preview window with ranger and a sxiv-remote could work here.  Perhaps all we really need is a flag on initial launch which sets it to single instance mode and not to steal focus in that mode.

This may be outside what you want to do, just putting the idea out there.

Can you elaborate a bit more? What exactly do you want to do and how it relates to cmus? smile

Offline

#338 2013-10-23 16:22:48

robertpeston
Member
Registered: 2013-10-23
Posts: 16

Re: sxiv - Simple image viewer written in C

cmus-remote can control cmus in a lot of ways.  It can send a play-pause, change the volume etc.  You can then bind these commands to global hotkeys, so I have a play/pause key and I don't have to bring the window up

The most straightforward use for sxiv would be
    sxiv-remote FILENAME

and that would send the file to the running instance of sxiv.  So I could browse with ranger and send the selected file to sxiv, using it as a preview window.

Of course there are other ways to achieve this.  You could have a flag that set that window to be the single instance receiver.  Used without the flag it would open a second window as before, but with the flag set it would target the receiver instance with the new file.  If that makes sense.

Offline

#339 2013-10-23 16:23:45

robertpeston
Member
Registered: 2013-10-23
Posts: 16

Re: sxiv - Simple image viewer written in C

dgz wrote:

surely ranger's built-in image previews serve that purpose?

http://t.imgbox.com/adhydUZo.jpg

Ooh, I don't know how to do that.

Offline

#340 2013-10-23 16:48:01

wildshu
Member
Registered: 2013-03-25
Posts: 14

Re: sxiv - Simple image viewer written in C

dgz wrote:

surely ranger's built-in image previews serve that purpose?

http://t.imgbox.com/adhydUZo.jpg

This is very hacky though, it's using w3m to display images,  doesn't work with all terminals, and is unpredictable.

Offline

#341 2013-10-23 18:29:06

dgz
Member
Registered: 2013-08-27
Posts: 97

Re: sxiv - Simple image viewer written in C

robertpeston wrote:
dgz wrote:

surely ranger's built-in image previews serve that purpose?

http://t.imgbox.com/adhydUZo.jpg

Ooh, I don't know how to do that.

you need to set preview_images true and set draw_borders true in ~/.config/ranger/rc.conf. you also need the optional w3m dependencies installed, and to be running ranger without tmux in urxvt or xterm.

wildshu wrote:

This is very hacky though, it's using w3m to display images,  doesn't work with all terminals, and is unpredictable.

it seems to work consistently enough for me once it's set up. but it is far from a stable solution.

Offline

#342 2013-10-24 16:01:52

mentat
Member
From: France
Registered: 2009-01-13
Posts: 138
Website

Re: sxiv - Simple image viewer written in C

@dgz 

If you don't want to set it permanently in your rc file can activate it by pressing:

zp

So if you want to speed up file navigating, you can activate the preview function on demand.

Offline

#343 2013-10-24 18:54:31

robertpeston
Member
Registered: 2013-10-23
Posts: 16

Re: sxiv - Simple image viewer written in C

Here's two things I do with sxiv that I wanted to share as ideas.  Also, I'd like comments on how I can do them better.

1) I like to browse through a folder and mark images for deletion with ctrl-d.  I've done this in config.h with:

    { true,   XK_d,          it_shell_cmd,         (arg_t) \
			"mv \"$SXIV_IMG\" \"$SXIV_IMG\"--mk4del" },

I can then delete them from the commandline with a wild card. Or do sxiv *--mk4del to review my decisions. The tag stops them being shown if I have another search through (I used the filemanager launch script mostly and it ignores these files).  I'm considering prefixing as it groups them conveniently and gets around issues with the .jpg suffix but

    { true,   XK_d,          it_shell_cmd,         (arg_t) \
			"mv \"$SXIV_IMG\" mk4del--\"$SXIV_IMG\"" },   /*DOESN'T WORK*/

does not work, it prefixes the path.  Help!

2) I like to take my favourite images for a favourites folder.  I use hardlinks for this

   { true,   XK_f,          it_shell_cmd,         (arg_t) \
			"ln \"$SXIV_IMG\" \"$SXIV_IMG\"--lnkfav" },

I can then move these files to my chosen directory.  I don't do it directly as I may have a lot of clashing filenames in there and I don't want to compile in the target directory anyway.  I thought about appending a date and time or some other way to create a unique filename, perhaps using the parent dir name, but it wouldn't be universal and it wouldn't get over needing to compile the target dir in to make it a one hit process.

I hope this is of some use.

Last edited by robertpeston (2013-10-24 19:59:18)

Offline

#344 2013-10-25 21:42:16

doggone
Member
Registered: 2013-06-19
Posts: 49

Re: sxiv - Simple image viewer written in C

robertpeston wrote:

Here's two things I do with sxiv that I wanted to share as ideas.  Also, I'd like comments on how I can do them better.

1) Write a little script using sed or awk. This does the trick (I tested it on a few files but be sure to test it too, moving files around in an unexpected way could have nasty consequences).

#!/bin/bash
mv "$1" "$(echo $1 | sed 's/\([^/]\+\)$/m4del-\1/')"

2) You should only use hardlinks in extreme cases where no other trickery works. If you're really set on it, I recommend using a marking system or moving them to a separate "marked" folder.
As for giving them unique names in a certain directory: Again, write a script. There are numerous ways to solve this. Perhaps the easiest way is to number all the files in the directory.

Offline

#345 2013-10-25 23:28:13

Xyne
Moderator/TU
Registered: 2008-08-03
Posts: 5,698
Website

Re: sxiv - Simple image viewer written in C

C5OK5Y wrote:

ber_t: I really like your image viewer but I have one question - is there an obstacle preventing the GIF loop feature from being enabled by default? The majority of GIFs I potentially want to view in sxiv are much better if looped. I'm fairly sure that the GIFs I view aren't any different from GIFs the majority of people find on the internet. I'm sure that having GIF looping enabled by default will benefit more people than having it disabled.

I didn't see a reply to this. I also think it makes more sense to loop multiframe images by default. Making it optional via the UI would be nice too.

I quickly tried to bind ctrl+r to toggle looping, but converting GIF_LOOP to a global and toggling it with a function had no effect (even though the value was changing). Given the reliance on enums in the config file I concluded that my approach was incorrect and I did not pursue it further.

Offline

#346 2013-10-26 01:06:46

robertpeston
Member
Registered: 2013-10-23
Posts: 16

Re: sxiv - Simple image viewer written in C

Thanks for the feedback

doggone wrote:

1) Write a little script using sed or awk.

And then call this script by modifying config.h?  As you say, there seems to be the possibility of that script going wrong (perhaps I'm just a nervous SED newbie).  I wanted to keep it as simple as possible.  Shame that SXIV doesn't have separate variables for path and filename.

doggone wrote:

2) You should only use hardlinks in extreme cases where no other trickery works

They allow me to leave the files where they are, but still have a 'best of' directory without using any extra space.  Is there a problem with the way I want to use them?

Offline

#347 2013-11-14 09:58:21

robertpeston
Member
Registered: 2013-10-23
Posts: 16

Re: sxiv - Simple image viewer written in C

Perhaps sxiv could flush the input buffer so that it stops advancing to the next picture when you release the key.  Ranger has this option in its configuration and it works well.

Edit: apologies, it does appear to do this with key input.  Where is doesn't is 'advance on mouse wheel', and I added this in config.h.

Last edited by robertpeston (2013-11-17 12:27:28)

Offline

#348 2013-11-16 12:13:34

fulmare
Member
Registered: 2011-02-16
Posts: 25

Re: sxiv - Simple image viewer written in C

May I ask if it is possible to bind two mouse keys as single keybind? (Actually the config.h file suggests it is not possible, but anyway..)
My use case would be to zoom in/out using right button pressed and using the wheel.

Is there a hack to make continuous cycle (i.e. the first image follows the last.)?

Offline

#349 2013-11-28 16:39:57

robertpeston
Member
Registered: 2013-10-23
Posts: 16

Re: sxiv - Simple image viewer written in C

Thumbnailing (or loading from cache) should start from the current image.

Offline

#350 2013-12-10 22:29:15

drtebi
Member
Registered: 2013-02-09
Posts: 51

Re: sxiv - Simple image viewer written in C

sxiv is a fantastic program. I love the fact that you can configure your own shortcuts.

It also works well with other scripts or applications. I am currently working on a personal application that uses extended attributes to tag and describe images, which can then be searched.

Here is a Python snipped that connects with sxiv:

#
# NOTE:
# finder.count() returns the number of found images
# finder.items is a list of absolute paths for images
#
if finder.count() > 0:
    sxiv_call = ['/usr/bin/sxiv', '-b', '-d', '-f', '-p', '-t']
    for i in finder.items:
        sxiv_call.append(i)
    from subprocess import call
    call(sxiv_call)

Works like a charm, and with cached thumbnails it's even faster.

Offline

Board footer

Powered by FluxBB