You are not logged in.

#1 2009-03-15 08:09:14

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

feh control keys bothers me[SOLVED]

here are some control keys when viewing images with feh::

<KEYPAD LEFT> Move  the  image  to  the  left 
<KEYPAD RIGHT> Move the image to the right
<KEYPAD +> Zoom in
<KEYPAD -> Zoom out
<KEYPAD *> Zoom to 100%
<KEYPAD /> Zoom to fit the window

these keys are convenient, especially with the zoom in\zoom out ones, compared to the mouse button2 method (it's not zoom with the wheel, but by pressing the mid button down and move left and right... which requires quite a "mouse skill")

while, it's all preceeded by a KEYPAD, whick means i have turn NUMLOCK on every time if i want to use the zoom key...it is Fn + NumLK on my laptop, do it first every time i want to zoom pictures?? not so much Fun pressing Fn every day i guess......

so, i'm thinking about two ways to change it.
first, change feh's key settings. Which I've no idea how after reading man feh.
another solution is write a short script to do this, step by step:
1.turn on NUMLOCK
2.execute feh to view the target image
3.when image viewing is done, turn off NUMLOCK, exit.

then I searched a bit, ended up finding out that there IS a script written for toggling NUMLOCK states called numlockx
i pacmaned it , and to try it out a bit, wrote a script::

numlockx on
feh *
numlockx off

this is good , solves the NUMLOCK thing.
while... i have problems here::

if the script is called xxx, i don't know how to make it to view a image called image.jpg just with a command::
$ xxx image.jpg

i just don't know how to read something(a file, thing after the script name in the command line, etc.) in in the middle of a script.
Any solutions?

Last edited by lolilolicon (2009-03-15 11:36:59)


This silver ladybug at line 28...

Offline

#2 2009-03-15 08:21:35

simongmzlj
Member
From: Canada
Registered: 2008-11-06
Posts: 135

Re: feh control keys bothers me[SOLVED]

lolilolicon wrote:

then I searched a bit, ended up finding out that there IS a script written for toggling NUMLOCK states called numlockx
i pacmaned it , and to try it out a bit, wrote a script::

numlockx on
feh *
numlockx off

this is good , solves the NUMLOCK thing.
while... i have problems here::

if the script is called xxx, i don't know how to make it to view a image called image.jpg just with a command::
$ xxx image.jpg

i just don't know how to read something(a file, thing after the script name in the command line, etc.) in in the middle of a script.
Any solutions?

The $* bash variable stores all the command line arguments. If you want it to be a thin wrapper to feh without handling any possible arguments from the script itself, try this:

#!/bin/bash

numlockx on
feh $*
numlockx off

this way, whatever you write after 'xxx' gets sent to feh.

Offline

#3 2009-03-15 08:31:59

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

Re: feh control keys bothers me[SOLVED]

"a thin wrapper to feh"

that's nice! exactly what i want, thanks, simongmzlj!


This silver ladybug at line 28...

Offline

#4 2009-03-15 09:33:56

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

Re: feh control keys bothers me[SOLVED]

i ended up  with this "thin wrapper to feh",called "foo",

#!/bin/bash
numlockx on
feh *.* -L %f > $*
feh -F -q -f $*
numlockx off

moved it to /usr/bin/,and i set file association to open .feh files with foo
the result:
when i creat a empty file called "list.feh", double click it and it gets the images list while i'm viewing images in the directory with NUMLOCK on.

Last edited by lolilolicon (2009-03-15 09:34:20)


This silver ladybug at line 28...

Offline

#5 2009-03-15 09:37:42

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

Re: feh control keys bothers me[SOLVED]

should i add "exit" at the end to close this bash??


This silver ladybug at line 28...

Offline

#6 2009-03-15 09:48:27

simongmzlj
Member
From: Canada
Registered: 2008-11-06
Posts: 135

Re: feh control keys bothers me[SOLVED]

lolilolicon wrote:

should i add "exit" at the end to close this bash??

no need. bash ends automatically at the end of input. thats why you can use cntr-d to close a terminal.

Offline

#7 2009-03-15 09:53:38

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

Re: feh control keys bothers me[SOLVED]

simongmzlj wrote:
lolilolicon wrote:

should i add "exit" at the end to close this bash??

no need. bash ends automatically at the end of input. thats why you can use cntr-d to close a terminal.

smile got it

ctrl-d = EOF
right?


This silver ladybug at line 28...

Offline

#8 2009-03-15 10:02:46

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

Re: feh control keys bothers me[SOLVED]

hey,simongmzlj,
i just find that i can't do double click to open list.fooo if the image is in a folder with a space in its name

like  "agy look"

when ranamed to "agylook", it's all fine

should i add "" around $* in the script or else??


This silver ladybug at line 28...

Offline

#9 2009-03-15 10:10:18

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

Re: feh control keys bothers me[SOLVED]

well, it works by changing $* to "$*"

wonder why........is it that thunar doesn't interpret my current location (agy look) to /path/to/agy\ look but without the "\"??
or something else??


This silver ladybug at line 28...

Offline

#10 2009-03-15 10:21:21

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

Re: feh control keys bothers me[SOLVED]

yet another problem:: i notice the file association doesn't work well,
i didn't really set "foo" to open just ".feh" files, but all plain text files are now associated with "foo"

i guess it's "mime" stuff, out of my impression
what is mime??

how do i set it up that "foo" defaultly runs and only runs ".feh" files??


This silver ladybug at line 28...

Offline

#11 2009-03-15 12:24:37

simongmzlj
Member
From: Canada
Registered: 2008-11-06
Posts: 135

Re: feh control keys bothers me[SOLVED]

MIME types (http://en.wikipedia.org/wiki/MIME_type) just descripe the type of data thats in a file. there is no feh file mimetype, the operating system interprets that as plain-text. so by setting .feh files to open with foo you telling thunar to open all plain-text files with foo and thats where your problem lies. how to get it working (thunar, right?) i have no clue. im a command line junkie

yes, adding quotes around $* is more correct. it has to do with how bash will handle spaces, as by default it splits commands on blank spaces. by putting the quotes there you're telling it to parse it as it is instead of to divide it up. hence why "agy look" didn't work.

Offline

#12 2009-03-15 12:26:26

simongmzlj
Member
From: Canada
Registered: 2008-11-06
Posts: 135

Re: feh control keys bothers me[SOLVED]

i recommend you pick up some bash scripting. with that under your belt you would be able to help yourself with this problem.

Offline

#13 2009-03-16 14:27:01

carlocci
Member
From: Padova - Italy
Registered: 2008-02-12
Posts: 368

Re: feh control keys bothers me[SOLVED]

You could have edited the source file to change the keybindings.
As you can see it's quite straightforward (line 192 onwards):
http://linuxbrit.co.uk/feh/browser/trun … eyevents.c

Offline

#14 2009-03-17 06:11:37

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

Re: feh control keys bothers me[SOLVED]

Yeah, I thought about that in the first place, but didn't proceed to check that out.
Good idea


This silver ladybug at line 28...

Offline

Board footer

Powered by FluxBB