You are not logged in.

#26 2020-08-24 06:59:31

ohnonot
...again
Registered: 2015-09-29
Posts: 5,568

Re: FEH is multi purpose: background setting GUI, folder image viewer, ...

ohnonot wrote:

but what about the nice gui that nitrogen provides, browsing a dedicated folder, generating previews...?

try this:

feh -r -t -P -N --scale-down -W 1008 -E 105 -y 168 -J 100 --index-info "%n" --title "Wallpapers" --action "feh -g 1008x630 %F" "$HOME/Pictures/wallpapers"

it will create a sheet of clickable thumbnails from the Pictures/wallpapers folder. clicking opens a larger view, upon which you can perform the above mentioned action to set it as a wallpaper, or just close it.

Things have evolved, I now use this script to create a sheet of clickable thumbnails:

#!/bin/sh

# $@ = list of folders to be searched for images

# tested with
# feh version 3.1.3
# Compile-time switches: curl exif help stat64 verscmp xinerama
#
# feh version 3.4.1
# Compile-time switches: curl exif inotify help stat64 verscmp xinerama 

# NOTE: feh distiguishes between closing a window and exiting completely.
# the default key for closing a window is x
# the default key for exiting is q
# so if you look at a wallpaper full size, then press 'q', feh will close completely, incl. the thumbnail window.
# you could change this by unsetting the quit action and assigning 'q' to the close action:
# quit
# close q
# (add this to ~/.config/feh/keys)
# that way you have to press 'q' twice to exit completely.

# NOTE 2:
# scrolling up and down works with arrow keys Up/Down.
# the Left/Right arrow keys do not work in an intuitive way.
# you can scroll up and down with keys but will need to click on the desired image.

# get screen resolution
width="$(xwininfo -root | awk '/Width/ {print $2}')"
height="$(xwininfo -root | awk '/Height/ {print $2}')"
# limit window size to 90% of screen size
width="$(((width/10)*9))"
height="$(((height/10)*9))"

# how many rows and columns of thumbnails?
divider=8
thumbheight=$((height/divider))
thumbwidth=$((width/divider))

# feh adds 5 pixels of background below each thumbnail
fehquirk=5

# it scrolls down 1 row of images at a time
scrollstep=$(( (thumbheight+fehquirk) * 1 ))

# recursive? add -r
feh -r -t --cache-thumbnails --no-menus --index-info '' --ignore-aspect --stretch \
-g ${width}x$height --limit-width $width --thumb-width $thumbwidth --thumb-height $thumbheight \
--scroll-step $scrollstep --action ";feh --title='%f --- %wx%hpx' -g ${width}x$height %F" "$@"
#--bg $HOME/.config/scripts/feh/grey.gif

Feh now (3.4.1) also has a " --start-at" option which loads all images inside a folder even if it was invoked on only one image.
This makes some of the wrapper scripts discussed in this thread unnecessary.


Give to COVAX! Here or here. (explanation)
My Repos: notabug | framagit

Offline

#27 2020-08-28 21:05:47

Nili
Member
From: $HOME/♫♪
Registered: 2015-09-30
Posts: 1,020
Website

Re: FEH is multi purpose: background setting GUI, folder image viewer, ...

A fine work as always ohnonot, been for a while on a old feh version, so now that i have new package i have chance to do some testing regarding new feh features. I'm sucker for that simple image viewer.


Devuan // CWM
Fedora // GNOME

Offline

#28 2020-08-29 20:50:53

ohnonot
...again
Registered: 2015-09-29
Posts: 5,568

Re: FEH is multi purpose: background setting GUI, folder image viewer, ...

^ thanks!

Here's another one:
feh can display images straight from the interwebz:

feh https://spam.com/scrot-2020-08-29_23:21:36.png

Use it with a keybind:

    <keybind key="C-A-f">
      <action name="Execute">
        <command>sh -c 'feh "$(xclip -o)"'</command>
      </action>
    </keybind>

to view images straight from your browser (Copy link location, press hotkey)!

Last edited by ohnonot (2021-05-27 18:57:46)


Give to COVAX! Here or here. (explanation)
My Repos: notabug | framagit

Offline

#29 2020-08-30 12:07:10

Nili
Member
From: $HOME/♫♪
Registered: 2015-09-30
Posts: 1,020
Website

Re: FEH is multi purpose: background setting GUI, folder image viewer, ...

Awesome! straight to the rc ^that one. Thanks!


Devuan // CWM
Fedora // GNOME

Offline

#30 2020-11-27 15:54:37

Nili
Member
From: $HOME/♫♪
Registered: 2015-09-30
Posts: 1,020
Website

Re: FEH is multi purpose: background setting GUI, folder image viewer, ...

I was looking for a feature that close image instantly with right click and found this way.

- zoom in/out with mouse wheel to zoom the image
- right click to quit

# make scroll wheel (mousewheel up and down) zoom, instead of flipping images
zoom_in 4
zoom_out 5

# the quit action with button 3 of mouse that is (right click) >instant close<
# this feature kills right click menu aswell.
quit
toggle_menu
quit 3

Create a text file called "buttons" on your $HOME/.config/feh then paste those commands.

Edit: Because of the killing right click menu one may found useful this script that draw those useful info on the bottom-left of a photo:

Filename:Testfile.jpg
Resolution:3000x2000
Filesize:10M

#!/bin/bash
feh \
--start-at "$1" \
--quiet \
--fontpath ~/.local/share/fonts/ \
--font sarasa-term-hc-semibold/9 \
--fullscreen \
--auto-rotate \
--hide-pointer \
--info "printf '%%s\n' Filename:\ '%n' Resolution:\ %wx%h Filesize:\ '%S' | sed -e 's/[\t ]//g;/^$/d'" \
#--draw-exif

Note: Change your font directory, also remove "#" if you wish to extract other exif info from a photo.
Changes:
- Removed spaces
- Fixed file with brackets on a filename

Last edited by Nili (2020-11-29 14:41:15)


Devuan // CWM
Fedora // GNOME

Offline

#31 2021-09-19 16:54:53

sleekmason
zoom
Registered: 2018-05-22
Posts: 629
Website

Re: FEH is multi purpose: background setting GUI, folder image viewer, ...

Thank you for this.  I made a small adjustment for use in my menu, that allows to just click on the image to "set as wallpaper".

Made a script to place in /usr/local/bin named feh-set-wallpaper

#!/bin/sh

feh -r -t -P -N --scale-down -W 1008 -E 105 -y 168 -J 100 --index-info "%n" --title "Wallpapers" --action ";feh --bg-scale %F" "$HOME/Pictures/wallpapers"

and just call it from the menu.  Works really good. Only caveat for me was that I couldn't figure out how to keep the chosen image from being "X"ed out?  Being able to flip back again after choosing an image seems to me to be a better option. Seems this is a feh thing though, rather than a chosen option. Anyhow. very cool:)

Found the fix to the "X"ing out from @ohnonot here: https://forums.bunsenlabs.org/viewtopic.php?id=5773

if you use thumbnail mode and see blue-tinted thumbnails with an X after clicking on them, prepend a semicolon to your action

Thank you and howdy ohnonot!

Last edited by sleekmason (2021-09-27 16:23:35)

Offline

#32 2021-09-20 10:15:42

ceeslans
Member
Registered: 2015-09-30
Posts: 112

Re: FEH is multi purpose: background setting GUI, folder image viewer, ...

@sleekmason (and @ohnonot of course) thanks for the wallpaper selection script.

I made a few changes and additions to it, so that multiple image directories can be sourced - and the selected image path + preferred bg-setting mode can be written to $HOME/.fehbg file.
It works a treat as wallpaper changer on my single-user MX fluxbox session.

#!/bin/sh

### select wallpaper directories to be shown 
BGDIR1="$HOME/Pictures/wallpapers"
#BGDIR2="$HOME/Pictures/wildflowers"
BGDIR3="/usr/share/backgrounds"

### uncomment if selection should NOT be written to ~/.fehbg 
#FEHBG="--no-fehbg"	

### select background setting mode
#BGSET="--bg-scale"
BGSET="--bg-fill"
#BGSET="--bg-max"
#BGSET="--bg-tile"

feh -r -t -P -N --scale-down -W 960 -E 100 -y 160 -J 100 --title "Wallpaper" \
--fontpath /usr/share/fonts/truetype/dejavu/ --font DejaVuSansCondensed.ttf/8 \
--index-info "%n" \
--action ";feh $FEHBG $BGSET %F" $BGDIR1 $BGDIR2 $BGDIR3

Last edited by ceeslans (2021-09-21 05:52:24)

Offline

#33 2021-09-28 05:19:50

ohnonot
...again
Registered: 2015-09-29
Posts: 5,568

Re: FEH is multi purpose: background setting GUI, folder image viewer, ...

Thanks both.

I am still using the wallpaper selector.

About the first Bonus in my OP:
By now, feh has a "--start-at" option, which does exactly what most image viewers do: allow to browse all images in that folder.
On my system, /usr/share/applications/feh.desktop even uses "Exec=feh --start-at %u" by default.

Last edited by ohnonot (2021-09-28 05:20:30)


Give to COVAX! Here or here. (explanation)
My Repos: notabug | framagit

Offline

Board footer

Powered by FluxBB