You are not logged in.

#126 2011-04-25 08:44:17

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: sxiv - Simple image viewer written in C

Great stuff, replaced feh completely here too.

Would it be possible to have the package add sxiv to the mimeapps list automatically, to avoid that people have to do this manually?


ᶘ ᵒᴥᵒᶅ

Offline

#127 2011-04-26 02:37:30

EiyuuZack
Member
Registered: 2011-04-11
Posts: 17

Re: sxiv - Simple image viewer written in C

Ledti wrote:

I actually have two final suggestions, one of which I noticed earlier; the first is another enhancement to the recursive flag which would make it work when opening an image directly:

$ ls /path/to/
001.jpg 002.jpg 003.jpg 004.jpg 005.jpg

$ sxiv -r /path/to/003.jpg

^ Which would order all five images and focus on 003.jpg.

So basically what you're asking is to start at a specific image. I somewhat agree with this suggestion -- useful for you manga readers to start at a given manga page and (many) people that tend to open a specific image in a folder (e.g. a photo) and expect to be able to go backwards or forwards from there -- but not as an extension of the -r flag as I find it fine as it is.

Perhaps another flag (-l ?) to load all images (in the order they're found) in the same directory as the one being displayed? However I don't know how much this deviates from the suckless approach. The only workaround I can think of out of the top off my head is something like

sxiv [options] image.jpg *

but it would load image.jpg twice and pressing next would display the first image found on the folder, which isn't practical.

What are your thoughts on this ber_t, think it's doable?

On another note, I see litemotiv's point, as more and more people pick sxiv having it at least as an option on the open with dialog seems like a logic step, but then again most people who adopt(ed) sxiv probably have lightweight desktops and usually those people know their way around Arch, and therefore, how to do it -- which isn't much of a hassle to be honest.

Offline

#128 2011-04-27 08:17:31

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

Re: sxiv - Simple image viewer written in C

litemotiv wrote:

Would it be possible to have the package add sxiv to the mimeapps list automatically, to avoid that people have to do this manually?

I do not want to install a DE just to write a .desktop file for sxiv and mess around with the mime* stuff. But if someone provides a .desktop file and comes up with some decent commands to alter the mime* files, then I would not hesitate including them in the sxiv pkg.

EiyuuZack wrote:

Perhaps another flag (-l ?) to load all images (in the order they're found) in the same directory as the one being displayed? However I don't know how much this deviates from the suckless approach. The only workaround I can think of out of the top off my head is something like

sxiv [options] image.jpg *

but it would load image.jpg twice and pressing next would display the first image found on the folder, which isn't practical.

I think this is too cumbersome.
If you forget to give an argument like *.jpg you will certainly also forget the -l option.
What exactly is "the order they're found"? From a programmers perspective, that's the same listing as `find' would produce, but this is hardly the same order a user would expect.
What if multiple images from different folders are given on the command line?

I can however add a new option, that defines the number of the image that sxiv starts on. This will also allow advanced users to write a small script wrapper for reading their comics. Maybe something like: given the base of all file names and the number of the image to start with, open all base* images with sxiv and hand over the number argument to it...

Offline

#129 2011-04-28 21:48:58

EiyuuZack
Member
Registered: 2011-04-11
Posts: 17

Re: sxiv - Simple image viewer written in C

ber_t wrote:

I think this is too cumbersome.
If you forget to give an argument like *.jpg you will certainly also forget the -l option.
What exactly is "the order they're found"? From a programmers perspective, that's the same listing as `find' would produce, but this is hardly the same order a user would expect.
What if multiple images from different folders are given on the command line?

Indeed, thought I'd edited this post, was too tired at such a late hour. Scrap what I said.

ber_t wrote:

I can however add a new option, that defines the number of the image that sxiv starts on. This will also allow advanced users to write a small script wrapper for reading their comics. Maybe something like: given the base of all file names and the number of the image to start with, open all base* images with sxiv and hand over the number argument to it...

That's a possibility I'm comfortable with. Would be enough to make a wrapper script to find the number of a given image name among the files to be loaded and have sxiv start there.

On another note, I've noted something while using full screen on my openbox desktop, if I press Alt+Tab to switch to another application sxiv loses focus but still stays on top of every other application. Is this the intended behavior?

Offline

#130 2011-04-28 22:56:25

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: sxiv - Simple image viewer written in C

ber_t wrote:
litemotiv wrote:

Would it be possible to have the package add sxiv to the mimeapps list automatically, to avoid that people have to do this manually?

I do not want to install a DE just to write a .desktop file for sxiv and mess around with the mime* stuff. But if someone provides a .desktop file and comes up with some decent commands to alter the mime* files, then I would not hesitate including them in the sxiv pkg.

Here are a few lines from ~/.local/share/applications/mimeapps.list

image/jpeg=sxiv.desktop;
image/png=sxiv.desktop;
image/gif=sxiv.desktop;

And a simple xsiv.desktop

[Desktop Entry]
Type=Application
Name=sxiv
Exec=sxiv %f
NoDisplay=true

ᶘ ᵒᴥᵒᶅ

Offline

#131 2011-04-29 07:39:39

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

Re: sxiv - Simple image viewer written in C

EiyuuZack wrote:
ber_t wrote:

I can however add a new option, that defines the number of the image that sxiv starts on. This will also allow advanced users to write a small script wrapper for reading their comics. Maybe something like: given the base of all file names and the number of the image to start with, open all base* images with sxiv and hand over the number argument to it...

That's a possibility I'm comfortable with. Would be enough to make a wrapper script to find the number of a given image name among the files to be loaded and have sxiv start there.

Okay, I'll add this new option soon.

EiyuuZack wrote:

On another note, I've noted something while using full screen on my openbox desktop, if I press Alt+Tab to switch to another application sxiv loses focus but still stays on top of every other application. Is this the intended behavior?

This also happens in dwm. This behaviour is not intended. The whole fullscreen mode depends on the window manager. The only thing sxiv does for toggling its fullscreen mode is, that it tells the window manager that it wants to get into or out of fullscreen mode. All the other things--like handling focus when an application is in fullscreen mode--are up to the wm...

litemotiv wrote:

Here are a few lines from ~/.local/share/applications/mimeapps.list

image/jpeg=sxiv.desktop;
image/png=sxiv.desktop;
image/gif=sxiv.desktop;

So I can easily just cat these lines into mimeapps.list if the file already exists, and that's it? Do these lines make sxiv the default application for the mentioned file types? I've somewhere read, that supported file types--an application wants to become the default app for--have to be listed in its .desktop file. Sorry, I'm a noob regarding mime stuff and don't have that much time at the moment.
I only want to make it as easy as possible to open images with sxiv from inside a DE. I don't want to make it the default app, that's something the user definitely has to do by himself.

Offline

#132 2011-04-29 14:03:32

Raziel23
Member
Registered: 2010-03-30
Posts: 15

Re: sxiv - Simple image viewer written in C

ber_t wrote:
EiyuuZack wrote:

On another note, I've noted something while using full screen on my openbox desktop, if I press Alt+Tab to switch to another application sxiv loses focus but still stays on top of every other application. Is this the intended behavior?

This also happens in dwm. This behaviour is not intended. The whole fullscreen mode depends on the window manager. The only thing sxiv does for toggling its fullscreen mode is, that it tells the window manager that it wants to get into or out of fullscreen mode. All the other things--like handling focus when an application is in fullscreen mode--are up to the wm...

In dwm this issue was fixed in the last commit in development version (the patch describe similar issue with fullscreen mplayer but also fix similar fullscreen issues with other programs, including sxiv (I have checked)).

Last edited by Raziel23 (2011-04-29 14:15:03)

Offline

#133 2011-04-29 14:56:57

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

Re: sxiv - Simple image viewer written in C

Raziel23 wrote:

In dwm this issue was fixed in the last commit in development version (the patch describe similar issue with fullscreen mplayer but also fix similar fullscreen issues with other programs, including sxiv (I have checked)).

Are you referring to changeset 7a60bff116c7? This patch prevents the fullscreen window from getting resized when changing the selected tagset. It has nothing to do with preventing a focus change to another client when the current one is in fullscreen mode. I've asked Anselm on #suckless, if he intends to forbit this behaviour and he denied it, because this way pop-up windows of the fullscreen client would never get the focus.

Offline

#134 2011-04-29 15:32:10

Raziel23
Member
Registered: 2010-03-30
Posts: 15

Re: sxiv - Simple image viewer written in C

You're right, this patch is not referring to switch between clients focus when one of them is in fullscreen mode (my fault smile). On the other hand when I have multiple running programs with fullscreen mode in the same tag, I have the opportunity to change between them (for example multiple running mplayer in the same tag) and this patch fixed focus behavior of mplayer (when I switch between them, not only switch between tags).

Offline

#135 2011-04-30 01:29:16

EiyuuZack
Member
Registered: 2011-04-11
Posts: 17

Re: sxiv - Simple image viewer written in C

ber_t wrote:

Okay, I'll add this new option soon.

Much appreciated.

ber_t wrote:
litemotiv wrote:

Here are a few lines from ~/.local/share/applications/mimeapps.list

image/jpeg=sxiv.desktop;
image/png=sxiv.desktop;
image/gif=sxiv.desktop;

So I can easily just cat these lines into mimeapps.list if the file already exists, and that's it? Do these lines make sxiv the default application for the mentioned file types? I've somewhere read, that supported file types--an application wants to become the default app for--have to be listed in its .desktop file. Sorry, I'm a noob regarding mime stuff and don't have that much time at the moment.
I only want to make it as easy as possible to open images with sxiv from inside a DE. I don't want to make it the default app, that's something the user definitely has to do by himself.

If I recall correctly, those lines would add an "Open With 'sxiv'" entry for those file types in file managers i.e. nautilus which uses gnome-open or Thunar (exo-open), which both check for candidate applications in mimeapps.list. Since sxiv.desktop is the only value (candidate) it would effectively make it the default application. However that alone won't make it the default application to be called by other (DE independent) programs like chromium which use xdg-open. That's where mimeinfo.cache and the MimeType entry in .desktop files come in. By specifying file types on .desktop files and running (post-install or manually)

update-desktop-database

to check what .desktop files (with a MimeType entry) claim to be able to handle, the mimeinfo.cache file is updated (or created) with the candidate(s) for a given file type. This file is, in turn, what xdg-open checks when opening a file, picking the first value (candidate).

Putting it simple, if you don't wan't to force sxiv as the new default, just create a .desktop file with a MimeType entry specifying what image types you want sxiv to claim to open, and let the user decide whether he wants to make an association or not. Of course it would be nice to remind users at installation that if they want chromium, etc. to be able to open images directly with sxiv then they have to run the above command.

Offline

#136 2011-04-30 10:26:53

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: sxiv - Simple image viewer written in C

ber_t wrote:
litemotiv wrote:

Here are a few lines from ~/.local/share/applications/mimeapps.list

image/jpeg=sxiv.desktop;
image/png=sxiv.desktop;
image/gif=sxiv.desktop;

So I can easily just cat these lines into mimeapps.list if the file already exists, and that's it? Do these lines make sxiv the default application for the mentioned file types? I've somewhere read, that supported file types--an application wants to become the default app for--have to be listed in its .desktop file. Sorry, I'm a noob regarding mime stuff and don't have that much time at the moment.
I only want to make it as easy as possible to open images with sxiv from inside a DE. I don't want to make it the default app, that's something the user definitely has to do by himself.

Yes, i understand. Here is an example with multiple registered applications:

image/png=feh.desktop;sxiv.desktop;

Both are not the default application, i'm actually not sure where that is set, they are just available in the context menus. So the proper way i guess would be to check if there is a image/png line, and if there is only append instead of creating.

Edit: didn't see EiyuuZack's reply. smile

Edit 2: apparently you can also add this section to mimeapps.list:

[Default Applications]
image/jpeg=sxiv.desktop
image/png=sxiv.desktop
image/gif=sxiv.desktop

If you wanted to make it the defaullt application.

Last edited by litemotiv (2011-04-30 10:31:15)


ᶘ ᵒᴥᵒᶅ

Offline

#137 2011-05-08 16:03:09

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

Re: sxiv - Simple image viewer written in C

Released version 0.8.1

New:

- Bug fix: Correctly center image when zooming
- Bug fix: Fullscreen handling, it now works in some broken window managers too
- Added a .desktop file, the rest of mime-handling has to be done by the user

Offline

#138 2011-05-12 01:13:47

EiyuuZack
Member
Registered: 2011-04-11
Posts: 17

Re: sxiv - Simple image viewer written in C

ber_t wrote:

Released version 0.8.1

- Bug fix: Fullscreen handling, it now works in some broken window managers too

Just reporting it's working flawlessly on my Openbox desktop, thanks for the fix.

litemotiv wrote:

...apparently you can also add this section to mimeapps.list:

[Default Applications]
image/jpeg=sxiv.desktop
image/png=sxiv.desktop
image/gif=sxiv.desktop

If you wanted to make it the defaullt application.

Is that so? That used to be the contents of the defaults.list file, which is now gone from my ~/.local/share/applications/ folder ever since I deleted all files in there and remade the associations through Thunar's Open With and update-desktop-database. From my understanding that file is either DE dependent or deprecated because I still have my default applications opening correctly using only mimeapps.list -- [Added Associations] section only --, mimeinfo.cache and the self-made .desktop files.

Offline

#139 2011-05-21 23:16:10

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

Re: sxiv - Simple image viewer written in C

Offline

#140 2011-05-22 02:01:50

igndenok
Member
From: Sidoarjo, Indonesia
Registered: 2010-06-07
Posts: 160

Re: sxiv - Simple image viewer written in C

Awesome application, pretty fast too smile
If possible can you implement browse function just like in qiv, it's similar to recursive minus all children directory just the current directory. So I can navigate all picture in the current directory only.


Ask, and it shall be given you.
Seek, and ye shall find.
Knock, and it shall be opened unto you.

Offline

#141 2011-05-22 07:41:04

lchr
Member
From: Denmark
Registered: 2011-05-10
Posts: 38
Website

Re: sxiv - Simple image viewer written in C

igndenok wrote:

Awesome application, pretty fast too smile
If possible can you implement browse function just like in qiv, it's similar to recursive minus all children directory just the current directory. So I can navigate all picture in the current directory only.

Wouldn't " sxiv * " do that? smile

Offline

#142 2011-05-22 07:43:28

archman-cro
Member
From: Croatia
Registered: 2010-04-04
Posts: 943
Website

Re: sxiv - Simple image viewer written in C

lchr wrote:
igndenok wrote:

Awesome application, pretty fast too smile
If possible can you implement browse function just like in qiv, it's similar to recursive minus all children directory just the current directory. So I can navigate all picture in the current directory only.

Wouldn't " sxiv * " do that? smile

Partially, cause you would want to start viewing at your chosen picture, and not at the first picture from that folder.

Offline

#143 2011-05-22 09:35:35

igndenok
Member
From: Sidoarjo, Indonesia
Registered: 2010-06-07
Posts: 160

Re: sxiv - Simple image viewer written in C

archman-cro wrote:
lchr wrote:
igndenok wrote:

Awesome application, pretty fast too smile
If possible can you implement browse function just like in qiv, it's similar to recursive minus all children directory just the current directory. So I can navigate all picture in the current directory only.

Wouldn't " sxiv * " do that? smile

Partially, cause you would want to start viewing at your chosen picture, and not at the first picture from that folder.

I'm sorry that my post didn't clear enough, but just like archman-cro said. If I have picture files like this

~/Picture $ ls *.jpg
00.jpg
01.jpg
02.jpg
03.jpg
...
10.jpg

I want to browse Picture folder but start with 02.jpg as the first picture not 00.jpg, maybe using sxiv like this

sxiv -b ~/Picture/02.jpg

Ask, and it shall be given you.
Seek, and ye shall find.
Knock, and it shall be opened unto you.

Offline

#144 2011-05-22 09:56:12

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

Re: sxiv - Simple image viewer written in C

igndenok wrote:

I want to browse Picture folder but start with 02.jpg as the first picture not 00.jpg, maybe using sxiv like this

sxiv -b ~/Picture/02.jpg

What does '-b' do? I get sxiv: invalid option -- 'b'.

That will search only the pics you specified (02.jpg), so using 'foo*' will let you view only those starting with 'foo'.

Offline

#145 2011-05-22 10:10:46

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: sxiv - Simple image viewer written in C

Isn't there a feh script for that?

https://wiki.archlinux.org/index.php/Fe … e_Launcher

Haven't tested it, but it should work with just replacing feh with sxiv.

Offline

#146 2011-05-22 10:39:10

igndenok
Member
From: Sidoarjo, Indonesia
Registered: 2010-06-07
Posts: 160

Re: sxiv - Simple image viewer written in C

@karol: from earlier my post, I wrote this "maybe using sxiv like this"


Ask, and it shall be given you.
Seek, and ye shall find.
Knock, and it shall be opened unto you.

Offline

#147 2011-05-22 11:14:55

Rupp
Member
Registered: 2010-02-14
Posts: 47

Re: sxiv - Simple image viewer written in C

Procyon wrote:

Isn't there a feh script for that?

https://wiki.archlinux.org/index.php/Fe … e_Launcher

Haven't tested it, but it should work with just replacing feh with sxiv.

I can confirm that this works.

Offline

#148 2011-05-22 14:34:46

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

Re: sxiv - Simple image viewer written in C

Rupp wrote:
Procyon wrote:

Isn't there a feh script for that?

https://wiki.archlinux.org/index.php/Fe … e_Launcher

Haven't tested it, but it should work with just replacing feh with sxiv.

I can confirm that this works.

Great. This script renders the -b/-l wishes useless. Also, I've forgotten the number option, that EiyuuZack has wished, so I'm glad this script also works around his issue -- both issues are actually the same.

Offline

#149 2011-05-22 15:28:07

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

Re: sxiv - Simple image viewer written in C

It kinda works for me: on the first go the script will display only the pics that match glob (but for some reason will skip the first one) and later ... some files that match the glob and then the rest.

Running  '/path/to/script 1*' on

00
01
02
10
11
20
21
22

will show

11
12
10
11
12
20
21
22
00
01
02

Offline

#150 2011-05-22 15:35:57

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: sxiv - Simple image viewer written in C

ber_t, would you consider adding the original resolution/depth of the image to the title? Something like this:

<61% - 1024x768@32bpp>

Or perhaps combine them all:

<84% - 800x600@8bpp - 19.72K>


ᶘ ᵒᴥᵒᶅ

Offline

Board footer

Powered by FluxBB