You are not logged in.

#1 2015-11-22 11:27:58

ohnonot
...again
Registered: 2015-09-29
Posts: 4,882
Website

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

crunchbang and bunsenlabs have always used nitrogen to set the background.
i prefer feh.
whenever opening an image, i can right click => File => Background => ...
setting the background, it creates a file "~/.fehbg" (always that name) which is an executable shellscript which i can call from autostart.

so, replace nitrogen with

"$HOME/.fehbg"

in your ~/.config/openbox/autostart, and from now on feh is responsible for the root window background. it's very lightweight and makes a noticeable difference at login.

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.
this one is optimized for my 1680x1050 monitor, you might want to adapt the pixel sizes.
it's also possible to use different fonts & backgrounds & other things (rtfm).
this is how i do it:

#!/bin/dash
# $@ = list of folders to be searched for images (including subfolders)
# recursive? add -r
feh -r -t -P -N --scale-down -W 1008 -E 105 -y 168 -J 20 --index-info "%n" \
--fontpath "$HOME/.config/feh" -e "pf_tempesta_seven.ttf/6" \
"" --title "Wallpapers" --action \
"feh -g 1008x630 %F" --bg $HOME/.config/feh/grey.gif \
--force-aliasing "$@"

font, gif

save, make executable, add ob menu entry.

Bonus:

feh is an extremely lightweight image viewer, but it lacks the ability to browse through a folder with images.
this little script provides that functionality:

#!/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

exec feh --cycle-once -Y -F -Z "$@" -- "${arr[@]:c}" "${arr[@]:0:c}"

save, make executable, set as default action for all image files (right-click => properties => open with).

Bonus 2:

I wrote a scipt to view through a folder with tiles (usually small, seamlessly tileable images), apply some manipulation, and set as a background with feh.
here's the repo: https://github.com/ohnonot/tileset
and here's a screenshot: http://dt.iki.fi/stuff/tileset/scrot.png

I was inspired to write this script after downloading a large collection of transparent textures from http://www.transparenttextures.com/

=========================================================================

and, lastly, my config files for feh to make keys & mouse behave in a way that i find natural.
~/.config/feh/keys:

#!config
# feh key configuration.
# Comments start with a # sign, do not use them mid-line.
# Each line must be blank, a comment, or a key definition.
#
# key definition: <action name> <key1> [<key2> [<key3>]]
#
# Each <key> is an X11 keysym (as output by xev) with optional modifier.
# For instance, C-x would be Ctrl+X, or 4-space Mod4+Space

# Examples for vim-like menu bindings on a qwerty keyboard:
menu_parent Left
menu_child Right
menu_down  Down
menu_up    Up
menu_select space Return

# Same for image navigation ...
next_img Right space
prev_img Left BackSpace

# and image movement
scroll_up    Up
scroll_down  Down
scroll_left  C-Left
scroll_right C-Right

# unset keys that cause more harm than help
remove
delete
toggle_filenames

# zooming
zoom_in  plus
zoom_out minus
zoom_default 1
zoom_fit 2

# I only hit these accidentaly
save_image
save_filelist

# This leaves some conflicts with existing default bindings, but you should
# get the idea.  And I'm not gonna fix the conflicts, I don't use qwerty ;-)

toggle_fullscreen f

~/.config/feh/buttons:

#!config
# feh button configuration.
# Comments start with a # sign, do not use them mid-line.
# Each line must be blank, a comment, or a button definition.
#
# button definition: <action name> <button>
#
# A <button> is a button number with optional modifier.
# For instance, C-1 would be Ctrl + Left click, 4-2 Mod4 + Middle click,
# et cetera.

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

Last edited by ohnonot (2016-04-09 09:47:53)


BL quote proposals to this thread please.
my repos / my repos
---
Thank you for posting direct image links!

Offline

#2 2015-11-22 14:26:34

damo
....moderator....
Registered: 2015-08-20
Posts: 6,273

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

Pure awesomeness!!

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"

Click on an image, r-click in the new window, File->Background->Set as...  How great is that? Nitrogen, eat your heart out big_smile

...now, how to manage multi-monitor setups?


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#3 2015-11-22 15:48:38

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,029

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

Just list them out in the feh command, I believe. Here is my ~/.fehbg to show what I am talking about:

#!/bin/sh
feh  --bg-fill '/home/tknomanzr/Pictures/wallpapers/inspiration-rectangle.jpg' '/home/tknomanzr/Pictures/wallpapers/geometric-wallpaper.jpg' '/home/tknomanzr/Pictures/wallpapers/BunsenLabs.png' 

I will have to check out ohnonot's script for image browsing. I already have a custom action set in pcmanfm that lets me browse certain image directories. Feh manages backgrounds on multi-monitors much more reliably than nitrogen.

Last edited by tknomanzr (2015-11-22 15:49:14)

Offline

#4 2015-11-22 16:04:29

damo
....moderator....
Registered: 2015-08-20
Posts: 6,273

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

^ Yes, I use feh for multi-monitor - I was wondering if it was possible to use the feh image viewer menu to set more than one bg. AFAICS it just writes the selected image to .fehbg, but it would be good to be able to select multiple files.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#5 2015-11-22 18:55:25

ohnonot
...again
Registered: 2015-09-29
Posts: 4,882
Website

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

^ erm, how? on a single monitor? you mean like a collage/montage? feh has a montage mode.


BL quote proposals to this thread please.
my repos / my repos
---
Thank you for posting direct image links!

Offline

#6 2015-11-22 20:42:38

damo
....moderator....
Registered: 2015-08-20
Posts: 6,273

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

ohnonot wrote:

^ erm, how? on a single monitor? you mean like a collage/montage? feh has a montage mode.

The feh image viewer has a menu option to set the bg. It would be great to be able to select more than one, like nitrogen can, instead of having to edit .fehbg. (I'm assuming the menu options are compiled into feh though)

uSFVBT9x.jpg


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#7 2015-11-22 22:01:00

ohnonot
...again
Registered: 2015-09-29
Posts: 4,882
Website

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

damo wrote:

The feh image viewer has a menu option to set the bg. It would be great to be able to select more than one, like nitrogen can, instead of having to edit .fehbg. (I'm assuming the menu options are compiled into feh though)

i'm sorry you really lost me there.
more than one option? like tiled and filled at the same time?
more than one background? like e.g. 2 pictures side-by-side?
more than one preview?

how can you have more than one background on one monitor/desk?

i also had a look at the nitrogen gui to understand what you mean, but i don't - how can you select more than one background with nitrogen?
Ctrl-clicking did nothing.

if you mean some sort of background slideshow, i don't see an option for that in the nitrogen gui either.

Last edited by ohnonot (2015-11-22 22:03:21)


BL quote proposals to this thread please.
my repos / my repos
---
Thank you for posting direct image links!

Offline

#8 2015-11-22 23:29:09

damo
....moderator....
Registered: 2015-08-20
Posts: 6,273

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

@ohnonot - sorry if I'm being unclear sad

The r-click menu in feh image viewer is what the scrot shows - the selected image is what is set as the bg in ~/.fehbg.

With 2 monitors  ~/.fehbg has to be edited manually:

feh --bg-option /path/to/image1 /path/to/image2

Nitrogen has the options to set Full Screen, Screen 1, or Screen2, ie you can set different images on each monitor via the gui.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#9 2015-11-23 00:38:30

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,029

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

Here's a desktop entry for the browsing portion of feh using ohnonot's script:

[Desktop Entry]
Name=Feh-browse
Name[fr_FR]=Feh-browse
Name[de_DE]=Feh-browse
GenericName=Feh Image viewer
GenericName[fr_FR]=Visualisateur d'image
GenericName[de_DE]=Bildbetrachter
Comment=Image viewer
Comment[fr_FR]=Visualisateur d'image
Comment[de_DE]=Bildbetrachter
Exec=/usr/bin/feh-browse
Icon=image
Type=Application
StartupNotify=true
NoDisplay=false
Hidden=false
Terminal=false
Categories=Graphics;Viewer;
MimeType=image/jpeg;image/png;image/gif;image/tiff;image/bmp;image/x-icon;image/x-xpixmap;image/x-xbitmap;
Comment[en_US]=View Image Files

I named ohnonot's provided script as feh-browse and copied it into /usr/bin.
I saved the desktop entry to ~/bin as feh-browse.desktop, then issued:

sudo desktop-file-install ~/bin/feh-browse.desktop
sudo update-desktop-database

Once the script and the desktop entry was in place, I was able to get bl-alternatives to select it as my default image browser:

sudo bl-alternatives install bl-image-viewer feh-browse

After all of this, mirage is replaced with feh as my image viewer. I can double click an image or right-click and select open and view all the images in that folder.

Things to note:
I do not yet have a proper icon for the desktop entry. The original provided file listed image-viewer of which I could not find any icon with that name. I selected image and it appears to end up a generic icon as well. I might end up having to make something up for it.

This does not yet even touch setting wallpapers. After some consideration, I decided the best way to do that is with a separate script plus desktop entry. I could then set the wallpaper via a simple dialog using yad to determine which monitor to set the wallpaper too. Ohononot's original provided script would be a start, with some additional logic to properly place the file url into an array, then build a feh background command up from that. This would provide desktop setting functionality from the file manager, however, not from feh's image viewer itself.

Last edited by tknomanzr (2015-11-23 00:40:05)

Offline

#10 2015-11-23 01:03:31

damo
....moderator....
Registered: 2015-08-20
Posts: 6,273

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

^ Would `image-x-generic.png/svg` do the job?


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#11 2015-11-23 02:20:16

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,029

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

OK. I think I figured it out. It turns out the icon theme I am using at the moment does not implement image-x-generic and it wasn't falling back for some reason. A quick switch to Faenza-BunsenLabs and back seemed to fix that. I think, however, that applications-viewers might be a more logical choice.

I've been having some difficulty with bl-alternatives and the help entry does not seem to be available on this install for whatever reason. So for now I have just been creating the symlinks.

One caveat to this is that it always chooses to start on the first monitor. I may fix the script up to not start in full screen so I can move it around where I want it.

Last edited by tknomanzr (2015-11-23 02:21:26)

Offline

#12 2015-11-23 03:42:26

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,308
Website

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

tknomanzr wrote:

I've been having some difficulty with bl-alternatives and the help entry does not seem to be available on this install for whatever reason.

When you have time, I wonder if you could post a separate topic on this, in help or bug reports? It would be good to get to the bottom of it.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#13 2015-11-23 03:54:26

hhh
Meep!
Registered: 2015-09-17
Posts: 10,517
Website

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

+1 to a bug report.

Offline

#14 2015-11-23 05:40:03

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,029

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

Ok. I will post what I can. I am not sure if I messed something up, so I may do some more testing on a different machine before I post one.

Offline

#15 2015-11-23 06:20:58

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,308
Website

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

^thanks!
(As we're approaching a Release, we'd like to squash as many bugs as possible.)


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#16 2015-11-23 07:18:28

ohnonot
...again
Registered: 2015-09-29
Posts: 4,882
Website

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

damo wrote:

With 2 monitors  ~/.fehbg has to be edited manually:

feh --bg-option /path/to/image1 /path/to/image2

ok, so it was a multimonitor question.

but still, neat that this is possible smile

@tknomanzr: wonderful extra work! feh for alternatives!


BL quote proposals to this thread please.
my repos / my repos
---
Thank you for posting direct image links!

Offline

#17 2015-11-23 08:36:38

Snap
Member
Registered: 2015-10-02
Posts: 465

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

Great job, ohnonot.

I also prefer feh to nitrogen, though depending on the day, the mood, the moon phase or the system I use hsetroot (sometimes with some effects: tint, blur, contrast...) instead of feh.

I use this feh browsing script instead. Will try yours and choose my favorite wink

feh-browser

#!/bin/bash
#nvoke it with the image path, e.g. "/path/to/script %f -F -Z".
#It should open that image in feh and let you browse through other images in the folder in the usual order, i.e. "feh /path/to/dir/*".
  
  # Change the input field separator to avoid problems with spaces.
  IFS='
  '
  # Get the target file, its name, directory, and the other files in the
  directory.
  _fpath="${1/%\/}"
  _fname="$(basename "$_fpath")"
  _dpath="$(dirname "$_fpath")"
  _flist=($(ls "$_dpath"))
  
  
  # Determine the index of the target file in the file list array.
  _i=0
  for _file in "${_flist[@]}"; do
    [ "$_file" == "$_fname" ] && break
    _i=$(($_i + 1))
  done
  
  # Remove the target file from the arguments, leaving any eventual arguments to
  # feh.
  shift
  
  # Change to the directory and launch feh with the target file as the first
  # argument, and the rest of the files in their normal order.
  cd "$_dpath"
  feh "$@"  "${_flist[@]:$_i}" "${_flist[@]:0:$_i}"

Depending on the environment, file manager, etc... I use either a .desktop file like tknomanzr pointed out or sometimes these wrappers

browse:

#!/bin/bash
# wrapper to use feh-browser in ranger
# configure it like this in rifle.conf: mime ^image, has feh-b,     X, flag f = feh-b -- "$@"

/usr/local/bin/feh-browser %f -F -Z

slideshow:

#!/bin/bash
# wrapper to use feh-browser slide show in ranger
# configure it like this in rifle.conf: mime ^image, has feh-s,     X, flag f = feh-s -- "$@"

/usr/local/bin/feh-browser %f -F -Z -x -q -Y -D 3 .

EDIT: for spacefm I add a slideshow.desktop. It should work for thunar too. (I made it in a rush for a friend, so the comments in es and en differ, but this is irrelevant for the purpose).

[Desktop Entry]
Name=Feh Slideshow
Name[en_US]=feh-slideshow
Name[es_ES]=feh-pase de fotos
GenericName=Image viewer
GenericName[en_US]=Image viewer
GenericName[es_ES]=Visor de imágenes
Comment=Fast Imlib2-based Image Viewer
Comment[es_ES]=Pase de fotos con Feh
Exec=feh-browser %f -F -Z -x -q -Y -D 3 .
Terminal=false
Type=Application
Icon=/usr/share/icons/cab_view.png
Categories=Graphics;2DGraphics;Viewer;
MimeType=image/bmp;image/gif;image/jpeg;image/jpg;image/pjpeg;image/png;image/tiff;image/x-bmp;image/x-pcx;image/x-png;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-tga;image/x-xbitmap;

Last edited by Snap (2015-11-23 08:53:31)

Offline

#18 2015-11-23 14:30:35

damo
....moderator....
Registered: 2015-08-20
Posts: 6,273

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

I love these forums! big_smile


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#19 2015-11-23 15:45:31

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

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

I simply put on .xinitrc

#FEH sets the wallpaper

#feh --randomize --bg-scale ~/tokyog/*
feh --bg-scale ~/tokyog/8152933395_4b1c30d017_k.jpg

Randomize && Static, currently i'm using a static ones, FEH almost perfect!


OS: Devuan GNU/Linux 4 (chimaera/ceres)
WM: Openbox / Tint2

Studio Ghibli

Offline

#20 2015-11-23 17:13:30

Snap
Member
Registered: 2015-10-02
Posts: 465

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

Another nice feh trick for the collection. These lines now live into my ~/.xinitrc (now commented, the moon phase told me to do so, LOL).

Thanks, Nili.

FEH almost perfect!

feh is a sucker trying to go full scale all the time, but we love it anyway.

EDIT: Don't forget to use quotes if having spaces in the file paths or picture file names, folks.

Last edited by Snap (2015-11-23 17:23:13)

Offline

#21 2016-04-09 09:47:27

ohnonot
...again
Registered: 2015-09-29
Posts: 4,882
Website

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

I wrote a scipt to view through a folder with tiles (usually small, seamlessly tileable images), apply some manipulation, and set as a background with feh.
here's the repo: https://github.com/ohnonot/tileset
and here's a screenshot: http://dt.iki.fi/stuff/tileset/scrot.png

I was inspired to write this script after downloading a large collection of transparent textures from http://www.transparenttextures.com/


BL quote proposals to this thread please.
my repos / my repos
---
Thank you for posting direct image links!

Offline

#22 2016-04-09 10:58:08

twoion
ほやほや
Registered: 2015-08-10
Posts: 2,943

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

Set wallpapers from KDE file managers (Dolphin, Konqueror...) using feh by adding a custom context menu. This is mostly for people who use KDE stuff outside of full KDE desktop environment (i.e. who are not running Plasma 4/5).

Create the file $HOME/.kde4/share/kde4/services/ServiceMenus/setasbackground.desktop:

[Desktop Entry]
Type=Service
Actions=set_as_background_center;set_as_background_fill;set_as_background_max;set_as_background_scale;set_as_background_tile
Encoding=UTF-8
Version=1.4
ServiceTypes=KonqPopupMenu/Plugin
MimeType=image/*;

[Desktop Action set_as_background_center]
Name=Set as desktop background (center)
Exec=feh --bg-center %u

[Desktop Action set_as_background_fill]
Name=Set as desktop background (fill)
Exec=feh --bg-fill %u

[Desktop Action set_as_background_max]
Name=Set as desktop background (maximized)
Exec=feh --bg-fill %u

[Desktop Action set_as_background_scale]
Name=Set as desktop background (scaled)
Exec=feh --bg-scale %u

[Desktop Action set_as_background_tile]
Name=Set as desktop background (tiled)
Exec=feh --bg-tile %u

Restart everything KDE. Now, when clicking on an image in Dolphin/Konqueror, you'll see a context menu entry Actions>Set as desktop background ($MODE), which does what it advertises.


Per aspera ad astra.

Offline

#23 2016-04-09 15:11:28

ohnonot
...again
Registered: 2015-09-29
Posts: 4,882
Website

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

ohnonot wrote:

I wrote a scipt to view through a folder with tiles (usually small, seamlessly tileable images), apply some manipulation, and set as a background with feh.
here's the repo: https://github.com/ohnonot/tileset
and here's a screenshot: http://dt.iki.fi/stuff/tileset/scrot.png

I was inspired to write this script after downloading a large collection of transparent textures from http://www.transparenttextures.com/

i had to fix some things, and just pushed again.


BL quote proposals to this thread please.
my repos / my repos
---
Thank you for posting direct image links!

Offline

#24 2016-04-11 04:47:50

Snap
Member
Registered: 2015-10-02
Posts: 465

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

^ Love it! Thanks for this, ohnonot.

Offline

#25 2016-04-26 06:12:59

ohnonot
...again
Registered: 2015-09-29
Posts: 4,882
Website

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

I added a single image mode, so if the argument passed on the command line is a file (not a dir), then tileset just opens that one file.
especially useful if you get it to work in your filemanager.

i guess most filemanagers have an option to create a custom "Open with..." (remember to tick "open in terminal").
i provided a tileset.desktop but can't get it to work with pcmanfm. hrmph. still investigating.

also fixed some things (handling spaces in filenames; how embarrassing).

edit:
of course i'm talking about this script:

ohnonot wrote:

I wrote a scipt to view through a folder with tiles (usually small, seamlessly tileable images), apply some manipulation, and set as a background with feh.
here's the repo: https://github.com/ohnonot/tileset
and here's a screenshot: http://dt.iki.fi/stuff/tileset/scrot.png
I was inspired to write this script after downloading a large collection of transparent textures from http://www.transparenttextures.com/

Last edited by ohnonot (2016-04-27 05:01:57)


BL quote proposals to this thread please.
my repos / my repos
---
Thank you for posting direct image links!

Offline

Board footer

Powered by FluxBB