You are not logged in.

#1 2014-08-22 20:09:41

Nelly
Member
From: Bratislava
Registered: 2012-02-15
Posts: 19

[SOLVED] Next image in FEH

Hello. Please, how I can call next image (next_img) in very simple picture viewer called FEH?

man feh
...
KEYS
...
 n, ⟨Space⟩, ⟨Right⟩ [next_img]
             Show next image
....

But n, space or right doens't work sad

I tried also:

cat /home/nelly/.config/feh/keys
next_img n
prev_img p
[zrebec@freya ~]$

But this doens't works also sad Can I call next image in the same directory with some key shortcut? Thanks

Last edited by Nelly (2014-08-22 21:08:33)


Linux bella 3.2.5-1-ARCH #1 SMP PREEMPT Tue Feb 7 08:34:36 CET 2012 x86_64 Intel
(R) Core(TM)2 CPU 6600 @ 2.40GHz GenuineIntel GNU/Linux
nVidia GeForce GTS 250

Offline

#2 2014-08-22 20:27:48

emeres
Member
Registered: 2013-10-08
Posts: 1,570

Re: [SOLVED] Next image in FEH

You probably use 'feh image', use 'feh directory' instead, then shortcuts should work.

Edit: Or 'feh image1 image2 rest-of-images-*'.

Last edited by emeres (2014-08-22 20:28:36)

Offline

#3 2014-08-22 21:07:39

Nelly
Member
From: Bratislava
Registered: 2012-02-15
Posts: 19

Re: [SOLVED] Next image in FEH

Yes @emeres, you have totally right, thank you very much smile But my problem is HALF-SOLVED because if I press <ENTER> on some image in "mc", I want to see next image. But I understand that in FEH is not possible. Thank you again


Linux bella 3.2.5-1-ARCH #1 SMP PREEMPT Tue Feb 7 08:34:36 CET 2012 x86_64 Intel
(R) Core(TM)2 CPU 6600 @ 2.40GHz GenuineIntel GNU/Linux
nVidia GeForce GTS 250

Offline

#4 2014-08-22 21:09:20

Jristz
Member
From: America/Santiago
Registered: 2011-06-11
Posts: 1,022

Re: [SOLVED] Next image in FEH

if your poblem is half fixed please add a [Half Solved], [Solved], [nsolved] or [Feh can do that] to the tittle subject for other.


Well, I suppose that this is somekind of signature, no?

Offline

#5 2014-08-22 21:16:33

emeres
Member
Registered: 2013-10-08
Posts: 1,570

Re: [SOLVED] Next image in FEH

@Nelly
Well not necessarily. I would have to look up how mc starts feh, if I recall correctly there are some mime type configuration parts/scripts. You could run a shell script calling feh, that would list all images in the directory and parse them to feh respecting the selected one as the first to show.

Offline

#6 2014-08-22 22:24:49

Nelly
Member
From: Bratislava
Registered: 2012-02-15
Posts: 19

Re: [SOLVED] Next image in FEH

@emeres: Thanks smile
@Jristz: The problem is solev for me... I'm satisfied now with emeres second reply. But thanks, I will remember that


Linux bella 3.2.5-1-ARCH #1 SMP PREEMPT Tue Feb 7 08:34:36 CET 2012 x86_64 Intel
(R) Core(TM)2 CPU 6600 @ 2.40GHz GenuineIntel GNU/Linux
nVidia GeForce GTS 250

Offline

#7 2014-08-22 22:29:07

emeres
Member
Registered: 2013-10-08
Posts: 1,570

Re: [SOLVED] Next image in FEH

I never finished customizing mc, so it would take too much time to get into it again. So far I see the default mc setup uses /usr/lib/mc/ext.d/image.sh to call xdg-open or something else if specified and that is where feh is called from. When I finish writing the script for opening files with feh with sorting, I will post it here. Figure out in the meantime how to open images with your own scripts, I think ~/.config/mc/mc.ext refers to that.

Edit: This works for me. It creates an array with files in the directory the selected and passed on file sits, then matches the offset in reference to the files list, creates a new array with that offset and passes it on to feh. It probably can be done in a nicer and slicker way.

#!/bin/bash
if [ -z $2 ]; then
	FILE="$@"; DIRECTORY="$(dirname "$FILE")";
	FILES=($(find "$DIRECTORY" -maxdepth 1 -type f | sort));
	i=0; # calculate offset
	for FILE2 in "${FILES[@]}"; do
		if [[ "$FILE" == "$FILE2" ]]; then o=$i; break; fi
		i=$((i+1));
	done
	
	n=${#FILES[@]}; m=$((n-1)); j=$o;
	
	for i in $(seq 1 $n); do
		FILES2[$i]="${FILES[$j]}";
		if [ $j -lt $m ]; then j=$((i+o)); else j=0; o=$((-1*i)); fi
	done
	
	feh ${FILES2[@]};
else
	feh "$@";
fi

So if you run it with one file, it will pass on every file, which can be further specified in the find command using '-iname \*.gif -o -iname \*.jpg' or similar, in the directory. Should multiple arguments be passed, feh opens only those. I had to do something else first, so it took some time, but I do not recall how to make mc use it for images only, since like I mentioned before never finished customizing it. But I did make mc open images with qiv, so switching it for the script, which I called feh-images should work if that is based on the default configuration, look at the last few lines:

### Images ###

type/^GIF
	Include=image

type/^JPEG
	View=%view{ascii} /usr/lib/mc/ext.d/image.sh view jpeg
	Include=image

type/^PC\ bitmap
	Include=image

type/^PNG
	Include=image

type/^JNG
	Include=image

type/^MNG
	Include=image

type/^TIFF
	Include=image

type/^PBM
	Include=image

type/^PGM
	Include=image

type/^PPM
	Include=image

type/^Netpbm
	Include=image

shell/.xcf
	Open=/usr/lib/mc/ext.d/image.sh open xcf

shell/.xbm
	Open=/usr/lib/mc/ext.d/image.sh open xbm

shell/.xpm
	Include=image
	View=/usr/lib/mc/ext.d/image.sh view xpm %f

shell/.ico
	Include=image

shell/i/.svg
	View=%view{ascii} /usr/lib/mc/ext.d/image.sh view svg
	Open=/usr/lib/mc/ext.d/image.sh open svg

include/image
#	Open=/usr/lib/mc/ext.d/image.sh open ALL_FORMATS
#	Open=(qiv -m %t &)
	Open=(feh-images %t &)
	View=%view{ascii} /usr/lib/mc/ext.d/image.sh view ALL_FORMATS


### Default ###

# Default target for anything not described above
default/*
	Open=(xdg-open %f &)
	View=


### EOF ###

Last edited by emeres (2014-08-23 03:29:30)

Offline

Board footer

Powered by FluxBB