You are not logged in.

#1 2011-01-30 00:49:09

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

sxiv - Simple image viewer written in C

Because there are at least five Archers out there, who always enjoy a mouse-less workflow and whose mail address I don't have, it seems to be the best way to just announce it here...

I was kind of unsatisfied with feh and qiv, because they either depend on gtk, don't work well with tiling window managers and/or have a code base that's too big and complex to easily change them to fit my needs.

So two weeks ago I started writing my own. It's called sxiv -- which stands for simple or small or suckless x image viewer -- and can be found at GitHub and in the AUR (EDIT: there's also a sxiv-git version, thanks to Army).

It's not finished yet, but I think it's already pretty useful.

Last edited by ber_t (2011-08-16 23:23:02)

Offline

#2 2011-01-30 01:04:59

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

Re: sxiv - Simple image viewer written in C

/me scratches head
Why is it running as root? I have built it the way I always do with AUR ...

Don't know if it helps:

[karol@black ~]$ ps -C sxiv -o euser,ruser,suser,fuser,comm
EUSER    RUSER    SUSER    FUSER    COMMAND
root     karol    root     root     sxiv

They should all read 'karol'.

Am I dong something wrong?


From https://github.com/muennich/sxiv

Please note, that the latter one requires root privileges. By default, sxiv is installed using the prefix "/usr/local", so the full path of the executable will be "/usr/local/sbin/sxiv".

Why is it 'sbin/sxiv' and not 'bin/sxiv'?
The package from AUR installs to /usr/bin/sxiv anyway.

Last edited by karol (2011-01-30 02:36:51)

Offline

#3 2011-01-30 10:11:09

mikesd
Member
From: Australia
Registered: 2008-02-01
Posts: 788
Website

Re: sxiv - Simple image viewer written in C

karol wrote:

/me scratches head
Why is it running as root? I have built it the way I always do with AUR ...

The makefile installs the executable setuid root. I can't think of any reason why an image viewer requires root privileges. No thanks. smile

Offline

#4 2011-01-30 10:32:23

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

Re: sxiv - Simple image viewer written in C

Is changing

install -D -m 4755 -o root -g root sxiv $(PREFIX)/bin/sxiv

to

install -D -m 755 sxiv $(PREFIX)/bin/sxiv

all that I need to do? Seems to work that way.

Offline

#5 2011-01-30 10:49:09

MadCatMk2
Member
Registered: 2010-05-10
Posts: 84

Re: sxiv - Simple image viewer written in C

Sweeeeet. I like how it preloads everything you throw at it. Makes going through images afterwards really fast.

Is there a way to suppress warnings (-q), such as

libpng warning: Buffer error in compressed datastream in iCCP chunk

and

sxiv: image.c:66: warning: could not open image: ./testing/hurrdurr

?

Maybe change the background color from grey (on demand maybe)?
(Currently I set -f on XMonad with sxiv instances set to always float)

Ctrl+ScrollUp/Down not working for me.

Last edited by MadCatMk2 (2011-01-30 10:52:43)

Offline

#6 2011-01-30 12:04:47

bohoomil
Member
Registered: 2010-09-04
Posts: 2,376
Website

Re: sxiv - Simple image viewer written in C

Changing the background colour is as easy as modifying the value in config.h and running make. Done. smile

I've issues with keys: most don't work at all, except for 'a', '+', '-', '=', '<', '>', as well as zooming in/out with scrollwheel -- they're OK. The rest is dead as a doornail.

Besides, when using AwesomeWM, whenever I try to set the picture fullscreen, it only flashes for a split second and gets back to the default size. I can, however, switch it full screen with my WM, but not with sxiv itself.


:: Registered Linux User No. 223384

:: github
:: infinality-bundle+fonts: good looking fonts made easy

Offline

#7 2011-01-30 14:23:36

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

Re: sxiv - Simple image viewer written in C

First of all, thanks for trying sxiv and giving your feedback...

The setuid bit in the Makefile and the "/usr/sbin" typo in the README are the consequences of simply taking both files from another project and not overlooking them very carefully. They make me look really foolish and I think I have just to live with that. Anyway, both of them got fixed with the 0.3.1 release, so please update, if you still want to use sxiv...

About the keys: I don't have an idea what's going wrong, yet. bohoomil, can you please confirm, that 'a' is working but 'n' and 'p' are not?

@bohoomil: The fullscreen bug in awesome wm -- and in potentially many other window managers, too -- is caused by the fact, that they do not support the the NET_WM_FULLSCREEN atom of the EWMH spec. I do not plan to add a hackish fullscreen mode like mplayer and other programs have, because I think, that toggling the fullscreen state of a window is the job of the window manager.

@MadCatMk2: The first warning isn't from sxiv itself, but from the libraries it uses (through imlib), so I can't do anything to make them go away. The second warning just says, that it cannot open a file you have given on the command line. They're absolutely intentional, but I might add an option flag to turn them off.

EDIT: Just an idea: can someone, having problems with the keys, try them with Numlock on and off, please?

Last edited by ber_t (2011-01-30 14:30:39)

Offline

#8 2011-01-30 14:28:18

gorilla
Member
From: Berlin
Registered: 2010-06-15
Posts: 72

Re: sxiv - Simple image viewer written in C

Works great! thanks! (I'm using the git-version)
Probably replaces feh for me for imageviewing.

Offline

#9 2011-01-30 14:50:56

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: sxiv - Simple image viewer written in C

ber_t wrote:

The setuid bit in the Makefile and the "/usr/sbin" typo in the README are the consequences of simply taking both files from another project and not overlooking them very carefully. They make me look really foolish and I think I have just to live with that. Anyway, both of them got fixed with the 0.3.1 release, so please update, if you still want to use sxiv...

Everyone makes a brown bag release now and then. Any plans to add the ability to set wallpaper?

Offline

#10 2011-01-30 14:51:58

MadCatMk2
Member
Registered: 2010-05-10
Posts: 84

Re: sxiv - Simple image viewer written in C

ber_t wrote:

@MadCatMk2: The first warning isn't from sxiv itself, but from the libraries it uses (through imlib), so I can't do anything to make them go away. The second warning just says, that it cannot open a file you have given on the command line. They're absolutely intentional, but I might add an option flag to turn them off.

EDIT: Just an idea: can someone, having problems with the keys, try them with Numlock on and off, please?

I understand the warnings are intentional, but here's what I was doing:

sxiv ./*

(in a directory with multiple types of images (.png's, .jpg's etc) instead of 'sxiv *.jpg *.png')

I just tried with caps lock on/off with to no avail.
Tested all the keys this time, the only ones not working are these:

Shift+ScrollUp    Pan image left
Shift+ScrollDown  Pan image right
Ctrl+ScrollUp     Zoom in
Ctrl+ScrollDown   Zoom out

while, for example, Ctrl+ScrollUp works in chromium, so it is not being grabbed my my WM (XMonad).

Also, sometimes the window goes crazy when resizing it or does not allow me to resize it at all. No errors in the command line. I could upload a video if you want to see.

Edit:

bohoomil wrote:

Changing the background colour is as easy as modifying the value in config.h and running make. Done. smile

That would definitely work but if we had an argument option it would be nice in the sense that, for example, you might have white documents in pictures, which are easier on the eyes with a white backdrop, or images with high contrast that look better with a black background.
Just an idea I've had for a long time on image viewers.

Last edited by MadCatMk2 (2011-01-30 14:59:12)

Offline

#11 2011-01-30 15:44:33

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

Re: sxiv - Simple image viewer written in C

falconindy wrote:

Any plans to add the ability to set wallpaper?

Well, I think I have to add this, otherwise one will often need another image viewer... Just added it to the TODO list.

MadCatMk2 wrote:

(in a directory with multiple types of images (.png's, .jpg's etc) instead of 'sxiv *.jpg *.png')

Changed the behaviour in HEAD, new option -W to explicitly enable printing of warnings.

MadCatMk2 wrote:

I just tried with caps lock on/off with to no avail.

No, not Caps-Lock but Numlock, please...

MadCatMk2 wrote:

Also, sometimes the window goes crazy when resizing it or does not allow me to resize it at all. No errors in the command line. I could upload a video if you want to see.

Uploading a video would be really helpful, thanks.

Offline

#12 2011-01-30 15:48:39

bohoomil
Member
Registered: 2010-09-04
Posts: 2,376
Website

Re: sxiv - Simple image viewer written in C

Weird: I've installed it once again, and now everything's working as intended (both keyboard and mouse, including panning/zooming mentioned by MadCatMk2).


:: Registered Linux User No. 223384

:: github
:: infinality-bundle+fonts: good looking fonts made easy

Offline

#13 2011-01-30 16:06:33

gorilla
Member
From: Berlin
Registered: 2010-06-15
Posts: 72

Re: sxiv - Simple image viewer written in C

ber_t wrote:
falconindy wrote:

Any plans to add the ability to set wallpaper?

Well, I think I have to add this, otherwise one will often need another image viewer... Just added it to the TODO list.

That would be awesome - I use feh and actually it does it well, but why should I use two image-viewers. I dont know any lightweight-app wich sets the wallpaper - and nothing more...

Offline

#14 2011-01-30 16:20:13

MadCatMk2
Member
Registered: 2010-05-10
Posts: 84

Re: sxiv - Simple image viewer written in C

Woah. Numlock did it for Ctrl and Shift. I'll be testing -W once it's in AUR.

Excuse me for using youtube, http://www.youtube.com/watch?v=O-pYEueItJ4

Offline

#15 2011-01-30 19:14:37

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: sxiv - Simple image viewer written in C

gorilla wrote:

I dont know any lightweight-app wich sets the wallpaper - and nothing more...

Imlibsetroot: http://aur.archlinux.org/packages.php?ID=40199

Offline

#16 2011-01-30 20:22:01

gorilla
Member
From: Berlin
Registered: 2010-06-15
Posts: 72

Re: sxiv - Simple image viewer written in C

Gusar wrote:
gorilla wrote:

I dont know any lightweight-app wich sets the wallpaper - and nothing more...

Imlibsetroot: http://aur.archlinux.org/packages.php?ID=40199

Thanks!

Offline

#17 2011-01-30 21:03:13

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 681

Re: sxiv - Simple image viewer written in C

Thanks alot for the nice contribution! I really like it alot and it's now my new image viewer of choise!

Thanks again, mate! smile

Offline

#18 2011-01-31 07:00:19

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

Re: sxiv - Simple image viewer written in C

ber_t wrote:

Because there are at least five Archers out there, who always enjoy a mouse-less workflow and whose mail address I don't have, it seems to be the best way to just announce it here...

I'm on of them! I've used it for 1.5 weeks and I like it. Keep it up!

Offline

#19 2011-01-31 10:22:14

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

Re: sxiv - Simple image viewer written in C

@Gusar: Thanks for pointing to imlibsetroot. It seems nice and handles everything including dual monitors. And because I deeply honor the unix philosophy, I will not duplicate its functionality, so setting the wallpaper is not a real goal/todo anymore...

@MadCatMk2: What's shown in your video seems to be real weird. Is the window at the end strangely resized to consist only of its title bar, or is the whole window content just black?

Offline

#20 2011-01-31 10:42:25

MadCatMk2
Member
Registered: 2010-05-10
Posts: 84

Re: sxiv - Simple image viewer written in C

ber_t wrote:

@MadCatMk2: What's shown in your video seems to be real weird. Is the window at the end strangely resized to consist only of its title bar, or is the whole window content just black?

I don't have titlebars, only window borders. The image seems to be there if you look carefully (the white line).
Thing is, XMonad forces windows to take whatever size it want's them to in order to be able to tile them. I just noticed for example, that 'eog' has similar flickering behavior but does, ultimately, follow the cursor. I guess if people with other window managers don't have similar issues then it might as well not concern your project specifically.

Offline

#21 2011-01-31 10:44:10

gorilla
Member
From: Berlin
Registered: 2010-06-15
Posts: 72

Re: sxiv - Simple image viewer written in C

ber_t wrote:

@Gusar: Thanks for pointing to imlibsetroot. It seems nice and handles everything including dual monitors. And because I deeply honor the unix philosophy, I will not duplicate its functionality, so setting the wallpaper is not a real goal/todo anymore...

+1 imlibsetroot and sxiv replaced feh for me. :-)

Offline

#22 2011-01-31 19:07:22

milso
Member
Registered: 2010-11-16
Posts: 112
Website

Re: sxiv - Simple image viewer written in C

I like it, alot. It works great, can't wait to see more features. Great work smile

Offline

#23 2011-02-01 07:24:38

Sara
Member
From: USA
Registered: 2009-07-09
Posts: 219
Website

Re: sxiv - Simple image viewer written in C

Thanks a lot. My second favorite software by you (the first being urxvt-keyboard-select).


Registed Linux User 483618

Offline

#24 2011-02-01 14:38:11

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: sxiv - Simple image viewer written in C

+1 what Sara wrote smile
Regarding additional features, I hope you won't implement too many, this should stay a very lightweight application to show pictures.

There's one thing though I'd like to have:
When I open an image, it is being resized so it fits the screen size or the size of the application. As soon as I zoom into an image and want to go back to the original view, it's not possible to get back this previous zoom level. Could you implement that?

Offline

#25 2011-02-01 16:09:18

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

Re: sxiv - Simple image viewer written in C

Thanks for thanking. This kind of drives open source development...

@Army: It's almost feature complete, release 1.0 is just around the corner and I'm not planning to add much more features... Regarding the size/zoom thing you've asked for: I don't exactly understand, what you mean. If it's something like the typical "fit image into window when I press this key", then I can appease you, it's already in the TODO list.

Offline

Board footer

Powered by FluxBB