Feh

From ArchWiki

Jump to: navigation, search
i18n
English
简体中文
Italiano
Español

feh is a lightweight and powerful image viewer that can also be used to manage the desktop wallpaper for standalone window managers lacking such features.

Contents

Installation

# pacman -S feh

Usage

feh is highly configurable. For a full list of options, run feh --help.

As an image viewer...

To quickly browse images in a specific directory, you can launch feh with the following arguments:

$ feh -g 640x480 -d -S filename /path/to/directory
  • The -g flag forces the images to appear no larger than 640x480
  • The -S filename flag sorts the images by filename

This is just one example; there are many more options available should you desire more flexibility.

As a desktop wallpaper manager

feh can be used to manage the desktop wallpaper for window managers that lack desktop features, such as Openbox and Fluxbox. The following command is an example of how to set the initial background:

$ feh --bg-scale /path/to/image.file

Other scaling options include:

--bg-tile FILE
--bg-center FILE
--bg-seamless FILE

To restore the background on the next session, add the following to your startup file (e.g. ~/.xinitrc, ~/.config/openbox/autostart.sh, etc.):

sh ~/.fehbg &

Random background image

To rotate the wallpaper randomly, create a script with the code below (e.g. wallpaper.sh). Make the script executable (chmod +x wallpaper.sh) and call it from ~/.xinitrc. You can also put the source directly in ~/.xinitrc instead of in a separate file.

Change the $HOME/.wallpaper directory to fit your setup, and the "15m" delay as you please (see man sleep for options).

#!/bin/sh
while true;
do
   find $HOME/.wallpaper -type f -name '*.jpg' -o -name '*.png' | shuf -n 1 | xargs feh --bg-scale
   sleep 15m
done &

If you have spaces in the file names try this:

#!/bin/sh
while true;
do
   feh --bg-scale "$(find ~/.wallpaper -name *.jpg | shuf -n 1)"
   sleep 15m
done &
Personal tools