You are not logged in.

#151 2011-05-22 17:46:10

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

Re: sxiv - Simple image viewer written in C

litemotiv wrote:

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

I've added the image dimension. I've found no API-function in imlib2 for getting the depth of an image, so I couln't add this one.

EDIT: @karol: The wiki says, that the script should be called with a single file as the first argument, it then gives all the other files in the same directory as the file to sxiv. So there's no need to use a wildcard when calling it.

Last edited by ber_t (2011-05-22 17:49:15)

Offline

#152 2011-05-22 18:41:32

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

Re: sxiv - Simple image viewer written in C

Thanks ber_t!

Ernie_Rubber_Ducky_V.jpg


ᶘ ᵒᴥᵒᶅ

Offline

#153 2011-05-22 18:52:33

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

Re: sxiv - Simple image viewer written in C

ber_t wrote:

EDIT: @karol: The wiki says, that the script should be called with a single file as the first argument, it then gives all the other files in the same directory as the file to sxiv. So there's no need to use a wildcard when calling it.

I thought that it should work anyway ;P Thanks!

I assumed that

The script assumes the first argument is the filename.

was about the order of the arguments and

Invoke the script with the selected images path

made me think it's OK to specify multiple images (edited it to read 'selected image's path').

Offline

#154 2011-05-24 18:35:09

mac1202
Member
Registered: 2011-05-24
Posts: 33

Re: sxiv - Simple image viewer written in C

Hello, the script don't work properly with sxiv. for example I have 3 picture if i open the number 2 with the script they are in this order 2 > 3 > 1 . If I use the script with feh no problem it's 1 < 2 > 3. Any tips to fix this.

Offline

#155 2011-05-24 21:21:16

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

Re: sxiv - Simple image viewer written in C

mac1202 wrote:

Hello, the script don't work properly with sxiv. for example I have 3 picture if i open the number 2 with the script they are in this order 2 > 3 > 1 . If I use the script with feh no problem it's 1 < 2 > 3. Any tips to fix this.

That's because the script is relying on the fact, that feh sorts its arguments while keeping track of their ordering on the command line. Change the script to the following and it should work (only the last two lines were changed):

#!/bin/bash

shopt -s nullglob

if [[ ! -f $1 ]]; then
    echo "$0: first argument is not a file" >&2
    exit 1
fi

file=$(basename -- "$1")
dir=$(dirname -- "$1")
arr=()
shift

cd -- "$dir"

for i in *; do
    [[ -f $i ]] || continue
    arr+=("$i")
    [[ $i == $file ]] && c=$((${#arr[@]} - 1))
done

r=$((${#arr[@]} - $c - 1))
exec sxiv "$@" -- "${arr[c]}" "${arr[@]:0:c}" "${arr[@]:c+1:r}"

Offline

#156 2011-05-25 02:42:54

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

Re: sxiv - Simple image viewer written in C

With regard to the new script:
I'm not sure if I'm doing it right, but now the picture I pick to start with is simply dragged to the front. If I pick, say, picture number 3, instead of the regular 1 > 2 > 3 > 4 > 5 sequence, I get 3 > 1 > 2 > 4 > 5.

Offline

#157 2011-05-25 06:53:49

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

Re: sxiv - Simple image viewer written in C

karol wrote:

With regard to the new script:
I'm not sure if I'm doing it right, but now the picture I pick to start with is simply dragged to the front. If I pick, say, picture number 3, instead of the regular 1 > 2 > 3 > 4 > 5 sequence, I get 3 > 1 > 2 > 4 > 5.

You're not the only one.

Offline

#158 2011-05-25 07:31:46

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

Re: sxiv - Simple image viewer written in C

karol wrote:

With regard to the new script:
I'm not sure if I'm doing it right, but now the picture I pick to start with is simply dragged to the front. If I pick, say, picture number 3, instead of the regular 1 > 2 > 3 > 4 > 5 sequence, I get 3 > 1 > 2 > 4 > 5.

sxiv doesn't sort its arguments, but keeps them in the same order they're given on the cmdline, so it doesn't fully work with the feh-script from the wiki.
You want the perfect behaviour? Use sxiv-git from the AUR (new option -n) and change the script to:

#!/bin/bash

shopt -s nullglob

if [[ ! -f $1 ]]; then
    echo "$0: first argument is not a file" >&2
    exit 1
fi

file=$(basename -- "$1")
dir=$(dirname -- "$1")
arr=()
shift

cd -- "$dir"

for i in *; do
    [[ -f $i ]] || continue
    arr+=("$i")
    [[ $i == $file ]] && n=${#arr[@]}
done

exec ~/work/github/sxiv/sxiv -n $n "$@" "${arr[@]}"

This still loads images twice, if you call the script with more than one file.

Last edited by ber_t (2011-05-25 07:32:01)

Offline

#159 2011-05-25 11:24:25

mac1202
Member
Registered: 2011-05-24
Posts: 33

Re: sxiv - Simple image viewer written in C

ber_t wrote:

You want the perfect behaviour? Use sxiv-git from the AUR (new option -n) and change the script to:

#!/bin/bash

shopt -s nullglob

if [[ ! -f $1 ]]; then
    echo "$0: first argument is not a file" >&2
    exit 1
fi

file=$(basename -- "$1")
dir=$(dirname -- "$1")
arr=()
shift

cd -- "$dir"

for i in *; do
    [[ -f $i ]] || continue
    arr+=("$i")
    [[ $i == $file ]] && n=${#arr[@]}
done

exec ~/work/github/sxiv/sxiv -n $n "$@" "${arr[@]}"

This still loads images twice, if you call the script with more than one file.

Thank you now work the way I want smile

Offline

#160 2011-05-26 14:58:07

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

Re: sxiv - Simple image viewer written in C

script changes and sxiv-git don't work together for me. Not a really big deal though. Just thought it was something I'd try.

Offline

#161 2011-06-05 10:49:21

Pank
Member
From: IT
Registered: 2009-06-13
Posts: 371

Re: sxiv - Simple image viewer written in C

I've got a quick question/feature request. I didn't find it earlier in the thread, but admittedly I only skimmed through it. I am using v.0.8.1 from the community repo.

I'd love to be able to set thumbnail size. By default they are tiny, especially on a high resolution screen -- at least to me. Thus, I'd like to be able to increase the size of thumbnails -- maybe even on-the-go but not necessarily.

Would that be possible?

Thanks,
Rasmus


Arch x64 on Thinkpad X200s/W530

Offline

#162 2011-06-05 12:47:54

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

Re: sxiv - Simple image viewer written in C

Pank wrote:

I've got a quick question/feature request. I didn't find it earlier in the thread, but admittedly I only skimmed through it. I am using v.0.8.1 from the community repo.

I'd love to be able to set thumbnail size. By default they are tiny, especially on a high resolution screen -- at least to me. Thus, I'd like to be able to increase the size of thumbnails -- maybe even on-the-go but not necessarily.

Would that be possible?

It's possible but not on-the-go. You have to recompile the package from ABS, overwriting the THUMB_SIZE macro in config.h. If you use thumbnail caching, then you might want to remove all cached thumbnails by running `rm -r ~/.sxiv/*', because they will look ugly after changing THUMB_SIZE.

Offline

#163 2011-06-05 17:23:57

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

Re: sxiv - Simple image viewer written in C

I have a little problem: I can't cache thumbnails on one of my computers. I have created ~/.sxiv and it gets populated with thumbnails but the caching doesn't work. I have no such problems on the other computer. I've removed the ~/.sxiv folder, reinstalled sxiv but it still doesn't work.

Offline

#164 2011-06-05 19:59:16

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

Re: sxiv - Simple image viewer written in C

karol wrote:

I have a little problem: I can't cache thumbnails on one of my computers. I have created ~/.sxiv and it gets populated with thumbnails but the caching doesn't work. I have no such problems on the other computer. I've removed the ~/.sxiv folder, reinstalled sxiv but it still doesn't work.

sxiv loads a cached thumbnail only if it has the same modification time as the image file it belongs to. Can you please check the modification times of the thumbnail cache files and compare them to the original image files? I've only tested the thumbnail caching on ext file systems, it may not work on other file systems.

Offline

#165 2011-06-05 20:25:00

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

Re: sxiv - Simple image viewer written in C

'ls' reports the times to be the same. The partition is formated as ext4 and mounted with noatime and nodiratime. The other computer is using ext3 + relatime and all is fine. Switching to relatime (and regenerating thumbnail cache) didn't help.

Offline

#166 2011-06-06 10:44:56

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

Re: sxiv - Simple image viewer written in C

karol, could you please use the "td" branch and post/pastebin sxivs output? Please make sure to run it without the -q flag.

Offline

#167 2011-06-06 11:17:01

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

Re: sxiv - Simple image viewer written in C

ber_t wrote:

karol, could you please use the "td" branch and post/pastebin sxivs output? Please make sure to run it without the -q flag.

First run, should be creating thumbnails (~/.sxiv exists and the thumbnails get created):

[karol@white inne]$ /home/karol/sxiv/sxiv -t *
sxiv: warning: [td] cache miss: 395frampol8.jpg
sxiv: warning: [td] cache miss: 4548775268_365f6043a5_o.jpg
sxiv: warning: [td] cache miss: 5383624687_2b1eeefc27_o.jpg
sxiv: warning: [td] cache miss: 561645_20031202_screen002.jpg
sxiv: warning: [td] cache miss: 5643706579_4eb5152e4a_o.jpg
sxiv: warning: [td] cache miss: 589770_20040129_screen006.jpg
sxiv: warning: [td] cache miss: 589770_20040129_screen028.jpg
sxiv: warning: [td] cache miss: 71886168884540869369.jpg
sxiv: warning: [td] cache miss: 73116647.jpg
sxiv: warning: [td] cache miss: 929240_20070530_screen043.jpg
sxiv: warning: [td] cache miss: 929240_20070530_screen048.jpg
sxiv: warning: [td] cache miss: 932650_20060508_screen001.jpg
sxiv: warning: [td] cache miss: 942290_20080303_screen011.jpg
sxiv: warning: [td] cache miss: 942291_20080122_screen024.jpg
sxiv: warning: [td] cache miss: 943566_20080910_screen002.jpg
sxiv: warning: [td] cache miss: 943567_20080711_screen013.jpg
sxiv: warning: [td] cache miss: 946232_20081031_screen001.jpg
sxiv: warning: [td] cache miss: 94707339.jpg
sxiv: warning: [td] cache miss: 950186_20100121_screen006.jpg
sxiv: warning: [td] cache miss: 952339_20090911_screen007.jpg
sxiv: warning: [td] cache miss: 954474_20090213_screen013.jpg
sxiv: warning: [td] cache miss: 954474_20090313_screen009.jpg
sxiv: warning: [td] cache miss: 954474_20090622_screen035.jpg
sxiv: warning: [td] cache miss: 954748_20081023_screen002.jpg
sxiv: warning: [td] cache miss: 959317_20100319_screen008.jpg
sxiv: warning: [td] cache miss: 959317_20100319_screen009.jpg
sxiv: warning: [td] cache miss: 995481_20101102_screen042.jpg
sxiv: warning: [td] cache miss: 996092_20100614_screen017.jpg
sxiv: warning: [td] cache miss: 997559_20110309_screen138.jpg
sxiv: warning: [td] cache miss: beyondgande_screen001.jpg
sxiv: warning: [td] cache miss: beyond_screen001.jpg
sxiv: warning: [td] cache miss: d201002_1266250433_by_serethorn_500.jpg
sxiv: warning: [td] cache miss: dsc00670y.jpg
sxiv: warning: [td] cache miss: dsc3912.jpg
sxiv: warning: [td] cache miss: dziwolagi35.jpg
sxiv: warning: [td] cache miss: GajuszJuliuszTadeusz.jpg
sxiv: warning: [td] cache miss: gr_02_14.jpg
sxiv: warning: [td] cache miss: IMG_3304-edit.jpg
sxiv: warning: [td] cache miss: img7603.jpg
sxiv: warning: [td] cache miss: Nowy-1.jpg
sxiv: warning: [td] cache miss: portmiejski029.jpg
sxiv: warning: [td] cache miss: sdc17739.jpg
sxiv: warning: [td] cache miss: sdc17752.jpg

Second run, doesn't load the cached thumbnails:

[karol@white inne]$ /home/karol/sxiv/sxiv -t *
sxiv: warning: [td] cache miss: 395frampol8.jpg
sxiv: warning: [td] cache miss: 4548775268_365f6043a5_o.jpg
sxiv: warning: [td] cache miss: 5383624687_2b1eeefc27_o.jpg
sxiv: warning: [td] cache miss: 561645_20031202_screen002.jpg
sxiv: warning: [td] cache miss: 5643706579_4eb5152e4a_o.jpg
sxiv: warning: [td] cache miss: 589770_20040129_screen006.jpg
sxiv: warning: [td] cache miss: 589770_20040129_screen028.jpg
sxiv: warning: [td] cache miss: 71886168884540869369.jpg
sxiv: warning: [td] cache miss: 73116647.jpg
sxiv: warning: [td] cache miss: 929240_20070530_screen043.jpg
sxiv: warning: [td] cache miss: 929240_20070530_screen048.jpg
sxiv: warning: [td] cache miss: 932650_20060508_screen001.jpg
sxiv: warning: [td] cache miss: 942290_20080303_screen011.jpg
sxiv: warning: [td] cache miss: 942291_20080122_screen024.jpg
sxiv: warning: [td] cache miss: 943566_20080910_screen002.jpg
sxiv: warning: [td] cache miss: 943567_20080711_screen013.jpg
sxiv: warning: [td] cache miss: 946232_20081031_screen001.jpg
sxiv: warning: [td] cache miss: 94707339.jpg
sxiv: warning: [td] cache miss: 950186_20100121_screen006.jpg
sxiv: warning: [td] cache miss: 952339_20090911_screen007.jpg
sxiv: warning: [td] cache miss: 954474_20090213_screen013.jpg
sxiv: warning: [td] cache miss: 954474_20090313_screen009.jpg
sxiv: warning: [td] cache miss: 954474_20090622_screen035.jpg
sxiv: warning: [td] cache miss: 954748_20081023_screen002.jpg
sxiv: warning: [td] cache miss: 959317_20100319_screen008.jpg
sxiv: warning: [td] cache miss: 959317_20100319_screen009.jpg
sxiv: warning: [td] cache miss: 995481_20101102_screen042.jpg
sxiv: warning: [td] cache miss: 996092_20100614_screen017.jpg
sxiv: warning: [td] cache miss: 997559_20110309_screen138.jpg
sxiv: warning: [td] cache miss: beyondgande_screen001.jpg
sxiv: warning: [td] cache miss: beyond_screen001.jpg
sxiv: warning: [td] cache miss: d201002_1266250433_by_serethorn_500.jpg
sxiv: warning: [td] cache miss: dsc00670y.jpg
sxiv: warning: [td] cache miss: dsc3912.jpg
sxiv: warning: [td] cache miss: dziwolagi35.jpg
sxiv: warning: [td] cache miss: GajuszJuliuszTadeusz.jpg
sxiv: warning: [td] cache miss: gr_02_14.jpg
sxiv: warning: [td] cache miss: IMG_3304-edit.jpg
sxiv: warning: [td] cache miss: img7603.jpg
sxiv: warning: [td] cache miss: Nowy-1.jpg
sxiv: warning: [td] cache miss: portmiejski029.jpg
sxiv: warning: [td] cache miss: sdc17739.jpg
sxiv: warning: [td] cache miss: sdc17752.jpg

This is not a big deal, I'm just reporting it doesn't work.

Offline

#168 2011-06-06 12:41:47

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

Re: sxiv - Simple image viewer written in C

I think I know what's causing this. Can you please pull the "td" branch, repeat the same run and post the output as before. Thanks, karol

Offline

#169 2011-06-06 13:46:05

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

Re: sxiv - Simple image viewer written in C

I've created a test dir with just a couple of pics. First run - generating thumbnails:

[karol@white cache_test]$ /home/karol/sxiv/sxiv -t *
sxiv: warning: [td] cache miss: 950186_20100121_screen006.jpg
[td] miss caused by: 1307367891 985886268 - 1307367776 909222556
[td] writing: /home/karol/.sxiv/home/karol/fotki/cache_test/950186_20100121_screen006.jpg.png, 1307367891 985886268
sxiv: warning: [td] cache miss: 952339_20090911_screen007.jpg
[td] miss caused by: 1307367891 985886268 - 1307367776 909222556
[td] writing: /home/karol/.sxiv/home/karol/fotki/cache_test/952339_20090911_screen007.jpg.png, 1307367891 985886268
sxiv: warning: [td] cache miss: 954474_20090213_screen013.jpg
[td] miss caused by: 1307367891 989219600 - 1307367776 909222556
[td] writing: /home/karol/.sxiv/home/karol/fotki/cache_test/954474_20090213_screen013.jpg.png, 1307367891 989219600
sxiv: warning: [td] cache miss: 954474_20090313_screen009.jpg
[td] miss caused by: 1307367891 992552932 - 1307367776 909222556
[td] writing: /home/karol/.sxiv/home/karol/fotki/cache_test/954474_20090313_screen009.jpg.png, 1307367891 992552932
sxiv: warning: [td] cache miss: 954474_20090622_screen035.jpg
[td] miss caused by: 1307367891 992552932 - 1307367776 909222556
[td] writing: /home/karol/.sxiv/home/karol/fotki/cache_test/954474_20090622_screen035.jpg.png, 1307367891 992552932
sxiv: warning: [td] cache miss: 954748_20081023_screen002.jpg
[td] miss caused by: 1307367891 992552932 - 1307367776 909222556
[td] writing: /home/karol/.sxiv/home/karol/fotki/cache_test/954748_20081023_screen002.jpg.png, 1307367891 992552932
sxiv: warning: [td] cache miss: 959317_20100319_screen008.jpg
[td] miss caused by: 1307367891 995886264 - 1307367776 909222556
[td] writing: /home/karol/.sxiv/home/karol/fotki/cache_test/959317_20100319_screen008.jpg.png, 1307367891 995886264
sxiv: warning: [td] cache miss: 959317_20100319_screen009.jpg
[td] miss caused by: 1307367891 995886264 - 1307367776 909222556
[td] writing: /home/karol/.sxiv/home/karol/fotki/cache_test/959317_20100319_screen009.jpg.png, 1307367891 995886264

Second run, thumbnails aren't cached

[karol@white cache_test]$ /home/karol/sxiv/sxiv -t *
sxiv: warning: [td] cache miss: 950186_20100121_screen006.jpg
[td] miss caused by: 1307367891 985886268 - 1307367891 985886000
[td] writing: /home/karol/.sxiv/home/karol/fotki/cache_test/950186_20100121_screen006.jpg.png, 1307367891 985886268
sxiv: warning: [td] cache miss: 952339_20090911_screen007.jpg
[td] miss caused by: 1307367891 985886268 - 1307367891 985886000
[td] writing: /home/karol/.sxiv/home/karol/fotki/cache_test/952339_20090911_screen007.jpg.png, 1307367891 985886268
sxiv: warning: [td] cache miss: 954474_20090213_screen013.jpg
[td] miss caused by: 1307367891 989219600 - 1307367891 989219000
[td] writing: /home/karol/.sxiv/home/karol/fotki/cache_test/954474_20090213_screen013.jpg.png, 1307367891 989219600
sxiv: warning: [td] cache miss: 954474_20090313_screen009.jpg
[td] miss caused by: 1307367891 992552932 - 1307367891 992552000
[td] writing: /home/karol/.sxiv/home/karol/fotki/cache_test/954474_20090313_screen009.jpg.png, 1307367891 992552932
sxiv: warning: [td] cache miss: 954474_20090622_screen035.jpg
[td] miss caused by: 1307367891 992552932 - 1307367891 992552000
[td] writing: /home/karol/.sxiv/home/karol/fotki/cache_test/954474_20090622_screen035.jpg.png, 1307367891 992552932
sxiv: warning: [td] cache miss: 954748_20081023_screen002.jpg
[td] miss caused by: 1307367891 992552932 - 1307367891 992552000
[td] writing: /home/karol/.sxiv/home/karol/fotki/cache_test/954748_20081023_screen002.jpg.png, 1307367891 992552932
sxiv: warning: [td] cache miss: 959317_20100319_screen008.jpg
[td] miss caused by: 1307367891 995886264 - 1307367891 995886000
[td] writing: /home/karol/.sxiv/home/karol/fotki/cache_test/959317_20100319_screen008.jpg.png, 1307367891 995886264
sxiv: warning: [td] cache miss: 959317_20100319_screen009.jpg
[td] miss caused by: 1307367891 995886264 - 1307367891 995886000
[td] writing: /home/karol/.sxiv/home/karol/fotki/cache_test/959317_20100319_screen009.jpg.png, 1307367891 995886264
[karol@white cache_test]$ 

Offline

#170 2011-06-06 14:01:15

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

Re: sxiv - Simple image viewer written in C

Okay, I think I've got it. Thumbnail caching should now work on ext4. Thanks karol for reporting the issue.

Last edited by ber_t (2011-06-06 14:02:04)

Offline

#171 2011-06-06 14:45:57

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

Re: sxiv - Simple image viewer written in C

Yes, it works now, thanks a lot!

Offline

#172 2011-06-07 10:09:46

zer
Member
Registered: 2011-04-09
Posts: 5

Re: sxiv - Simple image viewer written in C

Great tool.

Thanks!

Offline

#173 2011-06-18 22:15:44

Pank
Member
From: IT
Registered: 2009-06-13
Posts: 371

Re: sxiv - Simple image viewer written in C

Is it possible to have sxiv draw the filename in the picture frame or below thumbnails? My WM is set up to not display a titlebar by default. . .
Thanks,
Rasmus


Arch x64 on Thinkpad X200s/W530

Offline

#174 2011-06-24 11:24:00

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

Re: sxiv - Simple image viewer written in C

Pank wrote:

Is it possible to have sxiv draw the filename in the picture frame or below thumbnails? My WM is set up to not display a titlebar by default. . .

Sorry, but I do not want to draw strings inside the window frame.

Offline

#175 2011-06-25 03:44:39

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: sxiv - Simple image viewer written in C

1. Would it be possible to make sxiv work with the +/- keys on the numpad?

2. After viewing the last image in a set, could sxiv just cycle though the images instead of having an end?

Offline

Board footer

Powered by FluxBB