You are not logged in.

#401 2014-07-24 09:28:56

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

Re: sxiv - Simple image viewer written in C

==> Starting build()...                                                                                    [40/110]
gcc -march=i686 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -st
d=c99 -Wall -pedantic -O2 -I/usr/include -D_XOPEN_SOURCE=500 -DHAVE_LIBEXIF -DHAVE_GIFLIB -DVERSION=\"git-20140723\
" -c -o commands.o commands.c
gcc -march=i686 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -st
d=c99 -Wall -pedantic -O2 -I/usr/include -D_XOPEN_SOURCE=500 -DHAVE_LIBEXIF -DHAVE_GIFLIB -DVERSION=\"git-20140723\
" -c -o image.o image.c
gcc -march=i686 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -st
d=c99 -Wall -pedantic -O2 -I/usr/include -D_XOPEN_SOURCE=500 -DHAVE_LIBEXIF -DHAVE_GIFLIB -DVERSION=\"git-20140723\
" -c -o main.o main.c
In file included from main.c:43:0:
config.h:72:36: error: ‘it_quit’ undeclared here (not in a function)
  { 0,            XK_q,             it_quit,              (arg_t) None },
                                    ^
config.h:73:36: error: ‘it_switch_mode’ undeclared here (not in a function)
  { 0,            XK_Return,        it_switch_mode,       (arg_t) None },
                                    ^
config.h:74:36: error: ‘it_toggle_fullscreen’ undeclared here (not in a function)
  { 0,            XK_f,             it_toggle_fullscreen, (arg_t) None },
                                    ^
config.h:75:36: error: ‘it_toggle_bar’ undeclared here (not in a function)
  { 0,            XK_b,             it_toggle_bar,        (arg_t) None },
                                    ^
config.h:77:36: error: ‘it_prefix_external’ undeclared here (not in a function)
  { ControlMask,  XK_x,             it_prefix_external,   (arg_t) None },
                                    ^
config.h:79:36: error: ‘it_reload_image’ undeclared here (not in a function)
  { 0,            XK_r,             it_reload_image,      (arg_t) None },
                                    ^
config.h:81:36: error: ‘it_remove_image’ undeclared here (not in a function)
  { 0,            XK_D,             it_remove_image,      (arg_t) None },
                                    ^
config.h:90:36: error: ‘it_first’ undeclared here (not in a function)
  { 0,            XK_g,             it_first,             (arg_t) None },
                                    ^
config.h:91:36: error: ‘it_n_or_last’ undeclared here (not in a function)
  { 0,            XK_G,             it_n_or_last,         (arg_t) None },
                                    ^
config.h:97:36: error: ‘it_toggle_image_mark’ undeclared here (not in a function)
  { 0,            XK_m,             it_toggle_image_mark, (arg_t) None },
                                    ^
config.h:98:36: error: ‘it_reverse_marks’ undeclared here (not in a function)
  { 0,            XK_M,             it_reverse_marks,     (arg_t) None },
                                    ^
config.h:99:36: error: ‘it_navigate_marked’ undeclared here (not in a function)
  { 0,            XK_N,             it_navigate_marked,   (arg_t) +1 },
                                    ^
config.h:102:36: error: ‘it_scroll_move’ undeclared here (not in a function)
  { 0,            XK_h,             it_scroll_move,       (arg_t) DIR_LEFT },
                                    ^
config.h:111:36: error: ‘it_scroll_screen’ undeclared here (not in a function)
  { ControlMask,  XK_h,             it_scroll_screen,     (arg_t) DIR_LEFT },
                                    ^
config.h:158:2: error: initializer element is not constant
  { 0,            4,                it_scroll_move,       (arg_t) DIR_UP },
  ^
config.h:158:2: error: (near initialization for ‘buttons[3].cmd’)
config.h:159:2: error: initializer element is not constant
  { 0,            5,                it_scroll_move,       (arg_t) DIR_DOWN },
  ^
config.h:159:2: error: (near initialization for ‘buttons[4].cmd’)
config.h:160:2: error: initializer element is not constant
  { ShiftMask,    4,                it_scroll_move,       (arg_t) DIR_LEFT },
  ^
config.h:160:2: error: (near initialization for ‘buttons[5].cmd’)
config.h:161:2: error: initializer element is not constant
  { ShiftMask,    5,                it_scroll_move,       (arg_t) DIR_RIGHT },
  ^
config.h:161:2: error: (near initialization for ‘buttons[6].cmd’)
config.h:162:2: error: initializer element is not constant
  { 0,            6,                it_scroll_move,       (arg_t) DIR_LEFT },

config.h:162:2: error: (near initialization for ‘buttons[7].cmd’)
config.h:163:2: error: initializer element is not constant
  { 0,            7,                it_scroll_move,       (arg_t) DIR_RIGHT },
  ^
config.h:163:2: error: (near initialization for ‘buttons[8].cmd’)
Makefile:20: recipe for target 'main.o' failed
make: *** [main.o] Error 1
==> ERROR: A failure occurred in build().
    Aborting...

I'll check if it's already been reported upstream.



Edit: Reported it https://github.com/muennich/sxiv/issues/153

Last edited by karol (2014-07-24 09:41:43)

Offline

#402 2014-07-24 10:19:26

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: sxiv - Simple image viewer written in C

karol, update your config.h


This silver ladybug at line 28...

Offline

#403 2014-07-24 10:33:47

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

Re: sxiv - Simple image viewer written in C

To what?
I got sxiv-git from the AUR and it says it has recently updated the config.h. I'm not using any old code, old configs, I grabbed the taurball and tried to build it.

Edit: Does it work for you?


Edit2: src/sxiv/config.def.h works. Thanks :-)

Last edited by karol (2014-07-24 10:40:40)

Offline

#404 2014-07-24 10:53:53

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: sxiv - Simple image viewer written in C

I think AUR/sxiv-git shouldn't really ship a config.h ...

Actually I really wish there were a way (options/env/Xresources) to change the UI colors of sxiv at runtime, because those are the only things I change in config.h.


This silver ladybug at line 28...

Offline

#405 2014-07-24 11:17:50

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

Re: sxiv - Simple image viewer written in C

I change the bar font to terminus and make the thumbnails big. Because I'm old.
Not a problem at all, I just got confused. Because I'm old.


See e.g. https://github.com/muennich/sxiv/issues … t-49748555 for 'I wish sxiv would let me' answer.

Offline

#406 2014-07-24 12:16:12

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: sxiv - Simple image viewer written in C

karol wrote:

I change the bar font to terminus and make the thumbnails big. Because I'm old.

Oh, I also changed the font to fixed at size 12 instead of 13, because it's when it looks best to me. I agree thumbs may be a bit small; since I've just returned to using sxiv today, I'll see if I want to increase it as I go.

karol wrote:

See e.g. https://github.com/muennich/sxiv/issues … t-49748555 for 'I wish sxiv would let me' answer.

Yeah, sounds like Bert to me. This comment gets it right for me: for all my needs, a simple key=value config file is enough. But maybe Bert does not like to have an half-assed config file, considering config.h is much more powerful.


This silver ladybug at line 28...

Offline

#407 2014-07-24 12:30:47

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

Re: sxiv - Simple image viewer written in C

lolilolicon wrote:

I agree thumbs may be a bit small; since I've just returned to using sxiv today, I'll see if I want to increase it as I go.

The funny thing is the thumbnails don't get rebuilt, so I got tiny pictures (literally thumb-sized) 2 inches apart :-)
I fixed it by removing the cached ones.

Offline

#408 2014-07-24 12:43:25

ber_t
Member
From: Berlin, Germany
Registered: 2010-03-10
Posts: 214
Website

Re: sxiv - Simple image viewer written in C

lolilolicon wrote:

This comment gets it right for me: for all my needs, a simple key=value config file is enough. But maybe Bert does not like to have an half-assed config file, considering config.h is much more powerful.

You're the first one to get this right. I highly doubt that the mentioned "probably less than 100 line config parser" would offer the same possibilities than the current config.h, as long as it is written in C. And with config.h I do not have to care about backward compatibility whatsoever. If I break stuff while changing things for the better almost no one complains, because only a handful of people has to adapt their config.h files. Try the same with an ascii configuration file.

Offline

#409 2014-07-24 16:39:34

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: sxiv - Simple image viewer written in C

I think your approach is fine for your audience. Not everyone would feel as strongly against a config file as you, but most should understand and respect your stance.

Now a request for review from me smile. Note that my C is crap, as you will soon see big_smile. Anyway, I have put together whipped up a patch to add a key binding to toggle loop behavior of GIF images. Here's the code, http://ix.io/dys

I don't like the `#ifdef _GLOBAL_CONFIG` introduced by the patch, but I couldn't think of a better way to do it.

Do you like to include this feature in sxiv?

EDIT: updated patch: http://ix.io/dyV (fix cg_toggle_gif_loop that was causing seg faults when run on a non-GIF image).

EDIT: Got rid of global and _GLOBAL_CONFIG; now looking much more proper, http://ix.io/dzk

EDIT: I see Bert has removed GIF_LOOP altogether in commit 5e48191 so sxiv now does not care about what the GIF file says how many times to loop. I think it's a good direction to take. I'd like to think the motivation was from my patch here, which is now obsolete, albeit in a "push away" kind of way lol

Now the only thing left of my patch is this, to display frame delay in the info bar:

--- a/main.c
+++ b/main.c
@@ -379,6 +379,7 @@ void update_info(void)
                        n += snprintf(rt + n, rlen - n, "G%+d | ", img.gamma);
                n += snprintf(rt + n, rlen - n, "%3d%% | ", (int) (img.zoom * 100.0));
                if (img.multi.cnt > 0) {
+                       n += snprintf(rt + n, rlen - n, "%ums ", img.multi.frames[img.multi.sel].delay);
                        for (fn = 0, i = img.multi.cnt; i > 0; fn++, i /= 10);
                        n += snprintf(rt + n, rlen - n, "%0*d/%d | ",
                                      fn, img.multi.sel + 1, img.multi.cnt);

Last edited by lolilolicon (2014-07-26 06:31:40)


This silver ladybug at line 28...

Offline

#410 2014-07-25 03:14:32

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: sxiv - Simple image viewer written in C

Here, another patch where the idea is better than the code, http://ix.io/dyW

It allows toggling between two color schemes at runtime (bound to key c); no fancy default colors, but the idea is you will want a light color scheme and a dark one. Check it out smile


This silver ladybug at line 28...

Offline

#411 2014-07-25 16:28:50

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

Re: sxiv - Simple image viewer written in C

The wiki says you have to use sxiv-git if you need key-handler, but sxiv 1.2 from the repos should handle it just fine, right?
The note was added back in January, before sxiv 1.2 https://wiki.archlinux.org/index.php?ti … did=291778

Offline

#412 2014-07-26 15:20:06

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: sxiv - Simple image viewer written in C

I made a patch to add a command that resizes the window to fit the image.
http://ix.io/dAH (pretty)

This is useful when you view a series of images that are of the same size, or at least aspect ratio.

As stated in the patch, there is a tiny quirk; any idea what is causing it, and any way to fix it?

Last edited by lolilolicon (2014-07-26 15:20:57)


This silver ladybug at line 28...

Offline

#413 2014-09-09 04:57:49

hobarrera
Member
From: The Netherlands
Registered: 2011-04-12
Posts: 355
Website

Re: sxiv - Simple image viewer written in C

I'd like to bind Ctrl+D to delete files (calling "trash $FILE"). I've used key-handler for now, but I'd like to edit config.h in order to avoid having to press the prefix before doing this (mostly because it's a rather common action).

The best I've though of is having ctrl+d as a prefix as well, so ctrl+d twice trashes files.

Is this possible? Are there any plans to do this in future?

Offline

#414 2014-09-09 05:39:56

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: sxiv - Simple image viewer written in C

@hobarrera why not mark the files to be deleted and finally trash them all in one go?


This silver ladybug at line 28...

Offline

#415 2014-09-09 06:05:12

hobarrera
Member
From: The Netherlands
Registered: 2011-04-12
Posts: 355
Website

Re: sxiv - Simple image viewer written in C

lolilolicon wrote:

@hobarrera why not mark the files to be deleted and finally trash them all in one go?

How would you achieve that?

Offline

#416 2014-09-09 06:26:29

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: sxiv - Simple image viewer written in C

Are you on sxiv from git head, or the stable release? This funtionality was introduced in commit e267dc7 which isn't in a release yet.


This silver ladybug at line 28...

Offline

#417 2014-09-14 09:17:25

likytau
Member
Registered: 2012-09-02
Posts: 142

Re: sxiv - Simple image viewer written in C

Here's a simple script I wrote to split a filelist into chunks and invoke sxiv -i on each chunk one by one.
It reads the filelist from stdin, and outputs information about it after every chunk has been viewed.

It has one parameter: the size of the chunks (default 256). You must specify this if you want to pass additional options to sxiv (all further arguments are passed verbatim to sxiv).

If you want to use it in conjunction with sxiv's -o option, be advised that the final line of the output will contain splitsxiv's stats. You can remove this easily using 'head -n -1', or parse it into a string 'NCHUNKS CHUNKSIZE TOTALFILES' using 'tail -1 | grep -Eo "[0-9]+"'

Known bugs:

* will crash if you pass the -v option to sxiv, as this causes sxiv to stop reading stdin. Solution: don't do that, it's silly and has no practical application.

Other:

* can be trivially modified to invoke sxiv synchronously, rather than serially (all instances start more or less at the same time). I don't have a use for this, but you might. Simply comment out the 'sxiv.wait()' line (and beware that having many instances open may take more memory than you were expecting.).

Offline

#418 2014-09-15 13:25:40

hobarrera
Member
From: The Netherlands
Registered: 2011-04-12
Posts: 355
Website

Re: sxiv - Simple image viewer written in C

likytau wrote:

Looks really useful, but that host seems down. Could you mirror that elsewhere?

Offline

#419 2014-09-26 10:29:24

likytau
Member
Registered: 2012-09-02
Posts: 142

Re: sxiv - Simple image viewer written in C

hobarrera wrote:
likytau wrote:

Looks really useful, but that host seems down. Could you mirror that elsewhere?

I just checked and it is up for me currently (actually, I've never noticed any downtime at all with bpaste.net).
Anyway here is a pastebin mirror: http://pastebin.com/ZPi1Qygy

Offline

#420 2014-09-26 15:31:15

hobarrera
Member
From: The Netherlands
Registered: 2011-04-12
Posts: 355
Website

Re: sxiv - Simple image viewer written in C

likytau wrote:
hobarrera wrote:
likytau wrote:

Looks really useful, but that host seems down. Could you mirror that elsewhere?

I just checked and it is up for me currently (actually, I've never noticed any downtime at all with bpaste.net).
Anyway here is a pastebin mirror: http://pastebin.com/ZPi1Qygy

I just check this. They have broken DNS configuration that makes the host inaccesible for people with IPv6-only or dual-stacked (they have an IPv6 address configured for bpaste.net, but it points to a server which is not listening for HTTP, so it just fails with "Connection Refused").
I would suggest that you avoid bpaste.net, since there is a portion of the internet that cannot access their site due to misconfiguration.

More on-topic, thanks for sharing that! :-)

Offline

#421 2014-09-27 02:03:01

ikanobori
Member
Registered: 2014-09-27
Posts: 2

Re: sxiv - Simple image viewer written in C

hobarrera wrote:
likytau wrote:
hobarrera wrote:

Looks really useful, but that host seems down. Could you mirror that elsewhere?

I just checked and it is up for me currently (actually, I've never noticed any downtime at all with bpaste.net).
Anyway here is a pastebin mirror: http://pastebin.com/ZPi1Qygy

I just check this. They have broken DNS configuration that makes the host inaccesible for people with IPv6-only or dual-stacked (they have an IPv6 address configured for bpaste.net, but it points to a server which is not listening for HTTP, so it just fails with "Connection Refused").
I would suggest that you avoid bpaste.net, since there is a portion of the internet that cannot access their site due to misconfiguration.

More on-topic, thanks for sharing that! :-)

Hey, I'm the maintainer of bpaste and someone just notified me to this thread. It's getting quite late here but I'll take a look tomorrow. It's either a broken firewall or a misconfigured haproxy.

Offline

#422 2014-09-27 10:59:01

ikanobori
Member
Registered: 2014-09-27
Posts: 2

Re: sxiv - Simple image viewer written in C

Yes, it was broken since we swapped SSL termination from pound to nginx, and all configuration that happened due to that.

It should now be possible to connect again to both 80 and 443 over v6. Sorry for the inconvenience. If anything is wrong contact me outside this thread so we don't derail it fully smile

Offline

#423 2014-09-27 11:10:50

hobarrera
Member
From: The Netherlands
Registered: 2011-04-12
Posts: 355
Website

Re: sxiv - Simple image viewer written in C

ikanobori wrote:

Yes, it was broken since we swapped SSL termination from pound to nginx, and all configuration that happened due to that.

It should now be possible to connect again to both 80 and 443 over v6. Sorry for the inconvenience. If anything is wrong contact me outside this thread so we don't derail it fully smile

Thanks. I just quickly verified it when I posted the above message, and had no real fast way of finding who to contact.
Cheers.

Offline

#424 2014-10-02 09:27:17

likytau
Member
Registered: 2012-09-02
Posts: 142

Re: sxiv - Simple image viewer written in C

Just posting this exechandler snippet here in case someone hasn't thought of it:

"C-V") sxiv "$@"&;;

With multiple-selection and the toggle-marks-on-all command,  this makes it very easy  to clone a sxiv session.

Simple enough that I was thinking about proposing it for addition to the stock exec-handler.
However, I don't know what is a reasonable keybinding (my keybindings are specifically not stuck behind a prefix key -- so the above, I literally type only Ctrl+Shift+V to run.)

Last edited by likytau (2014-10-02 12:35:26)

Offline

#425 2014-10-13 03:32:05

likytau
Member
Registered: 2012-09-02
Posts: 142

Re: sxiv - Simple image viewer written in C

I've implemented filelist reordering (that is, reordering individual files within the filelist). Not sure whether this is something bert considers worth having in mainline sxiv, but it's very useful for my purposes.

https://bpaste.net/show/b1a0aa5023bb

(git patch -- you'll need a clone of sxiv git, then you can run 'git am $FILENAME' to apply it.)

Does not include keybinds, because I know the patch wouldn't apply if I did. The lines in my config.def.h are these:

        { Mod1Mask   ,  XK_Left,          g_reorder_image,      (arg_t) -9999999 },
        { Mod1Mask   ,  XK_Right,         g_reorder_image,      (arg_t) 9999999 },

(Mod1 means "Alt" here, BTW)

This is set up so that I can very quickly shove a given image to either the start or end of the list. You could use much smaller offsets, eg -1, 1 if you want to just swap the current image with the previous/next image.

It pays attention to any prefix code you enter, taking the sign from the binding argument, and the amount of movement from the prefix code (for example, typing 30 followed by Alt+Right would move the current image 30 images forward in the filelist.  Typing 30 followed by Alt+Left would move the current image 30 images backward in the filelist. Pressing Alt+Left|Right with no prefix would just move the image to the start or end of filelist.)

Example of operation:
http://i.imgur.com/oKiWU9B.gif

EDIT: Updated with some minor bugfixes.
EDIT2: small usability improvement.

-- mod edit: read the Forum Etiquette and only post thumbnails http://wiki.archlinux.org/index.php/For … s_and_Code [jwr] --

EDIT3: Here's another simple patch I made to show how many files are currently marked if the current file is marked. Simple enough that you can easily apply it manually.

@@ -429,6 +429,8 @@ void update_info(void)
                } else {
                        ow_info = true;
                }
+         if (strlen(mark) > 0)
+                 bar_put(r, "%d", markcnt);
                bar_put(r, "%s%0*d/%d", mark, fw, fileidx + 1, filecnt);
        } else {
                bar_put(r, "%s", mark);

Last edited by likytau (2014-10-17 06:55:11)

Offline

Board footer

Powered by FluxBB