Feh: Difference between revisions

From ArchWiki
m (use a leading space instead of Template:bc for one line)
 
(22 intermediate revisions by 9 users not shown)
Line 3: Line 3:
[[de:Feh]]
[[de:Feh]]
[[es:Feh]]
[[es:Feh]]
[[it:Feh]]
[[fr:Feh]]
[[ja:Feh]]
[[ja:Feh]]
[[lt:Feh]]
[[pl:Feh]]
[[ru:Feh]]
[[ru:Feh]]
[[zh-hans:Feh]]
[[zh-hans:Feh]]
Line 12: Line 12:
{{Related|sxiv}}
{{Related|sxiv}}
{{Related articles end}}
{{Related articles end}}
[http://feh.finalrewind.org/ 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.
 
From [[Wikipedia:Feh_(image_viewer)|Wikipedia]]:
 
:feh is a lightweight image viewer aimed mainly at users of command line interfaces. Unlike most graphical image viewers, feh does not have any graphical control elements (apart from an optional file name display) which enables it to also be used to display background images on systems running the X window system.


== Installation ==
== Installation ==
Line 26: Line 29:
To quickly browse images in a specific directory, you can launch feh with the following arguments:
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
  $ feh -g 640x480 -d -S filename ''/path/to/directory''


* The {{Ic|-g}} flag forces the images to appear no larger than 640x480
* The {{Ic|-g}} flag forces the images to appear no larger than 640x480
Line 34: Line 37:
This is just one example; there are many more options available should you desire more flexibility.
This is just one example; there are many more options available should you desire more flexibility.


{{Tip|The {{ic|--start-at}} option will display a selected image in feh while allowing to browse all other images in the directory as well, in their default order, i.e. as if you had run "feh *" and cycled through to the selected image. For example, {{ic|feh --start-at ./foo.jpg .}} views all images in the current directory, starting with {{ic|''foo''.jpg}}.}}
{{Tip|The {{ic|--start-at}} option will display a selected image in feh while allowing to browse all other images in the directory as well, in their default order, i.e. as if you had run {{ic|feh *}} and cycled through to the selected image. For example, {{ic|feh --start-at ./foo.jpg .}} views all images in the current directory, starting with {{ic|''foo''.jpg}}.}}
 
If you are browsing photos from a modern camera with EXIF data, it is interesting to use the {{ic|--auto-rotate}} option to automatically rotate images. This does not alter the file.


=== Set the wallpaper ===
=== Set the wallpaper ===
Line 44: Line 45:
The following command is an example of how to set the initial background:
The following command is an example of how to set the initial background:


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


Other scaling options include:
Other scaling options include:
{{bc|
{{bc|
--bg-tile FILE
--bg-tile ''FILE''
--bg-center FILE
--bg-center ''FILE''
--bg-max FILE
--bg-max ''FILE''
--bg-fill FILE
--bg-fill ''FILE''
}}
}}


Line 58: Line 59:
  ~/.fehbg &
  ~/.fehbg &


To change the background image, edit the file {{ic|~/.fehbg}} which gets created after running the command {{Ic|feh --bg-scale /path/to/image.file}} mentioned above.
To change the background image, edit the file {{ic|~/.fehbg}} which gets created after running the command {{Ic|feh --bg-scale ''/path/to/image.file''}} mentioned above.


One can explicitly disable the creation of the {{ic|~/.fehbg}}, by passing the {{ic|--no-fehbg}} flag as well.
One can explicitly disable the creation of the {{ic|~/.fehbg}}, by passing the {{ic|--no-fehbg}} flag as well.
Line 64: Line 65:
To setup different wallpapers for different monitors one should pass as many file paths as many monitors are available. For example, for a dual monitor setup it would be:
To setup different wallpapers for different monitors one should pass as many file paths as many monitors are available. For example, for a dual monitor setup it would be:


  $ feh --bg-center path/to/file/for/first/monitor path/to/file/for/second/monitor
  $ feh --bg-center ''path/to/file/for/first/monitor path/to/file/for/second/monitor''


=== Open SVG images ===
=== Open SVG images ===
Line 87: Line 88:


Another way to set a random wallpaper on each xorg session is to edit your {{ic|.fehbg}} as following.
Another way to set a random wallpaper on each xorg session is to edit your {{ic|.fehbg}} as following.
{{hc|$HOME/.fehbg|<nowiki>
{{hc|$HOME/.fehbg|
feh --bg-max --no-fehbg --randomize ~/.wallpaper/*  
feh --bg-max --no-fehbg --randomize ~/.wallpaper/*  
</nowiki>}}
}}


{{Tip|To change wallpapers periodically, use a script (see [[GregsWiki:BashGuide/TestsAndConditionals#Conditional Loops (while, until and for)|while loop]]), [[cron]] job, or [[systemd timer]] to execute the command at the desired interval.}}
{{Tip|To change wallpapers periodically, use a script (see [[GregsWiki:BashGuide/TestsAndConditionals#Conditional Loops (while, until and for)|while loop]]), [[cron]] job, or [[systemd timer]] to execute the command at the desired interval.}}
== Troubleshooting ==
=== Using in cron job ===
To use feh in a [[cron]] job for randomizing your wallpapers, you must specify the DISPLAY environment variable:
DISPLAY=:0 feh --bg-max --randomize ~/.wallpaper/*
Note that some display managers like sddm might not save of XAUTHORITY file in {{ic|~/.Xauthority}} where feh
expects it to be, which causes the cronjob to complain about: ''"Authorization required, but no authorization protocol specified"''.

Latest revision as of 10:03, 14 February 2024

From Wikipedia:

feh is a lightweight image viewer aimed mainly at users of command line interfaces. Unlike most graphical image viewers, feh does not have any graphical control elements (apart from an optional file name display) which enables it to also be used to display background images on systems running the X window system.

Installation

Install the feh package.

Usage

feh is highly configurable. For a full list of options, run feh --help or see the feh(1) man page.

Browse images

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 -d flag draws the file name
  • The -S filename flag sorts the images by file name

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

Tip: The --start-at option will display a selected image in feh while allowing to browse all other images in the directory as well, in their default order, i.e. as if you had run feh * and cycled through to the selected image. For example, feh --start-at ./foo.jpg . views all images in the current directory, starting with foo.jpg.

Set the wallpaper

feh can be used to set the desktop wallpaper, for example for window managers without this feature such as Openbox, Fluxbox, and xmonad.

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-max FILE
--bg-fill FILE

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

~/.fehbg &

To change the background image, edit the file ~/.fehbg which gets created after running the command feh --bg-scale /path/to/image.file mentioned above.

One can explicitly disable the creation of the ~/.fehbg, by passing the --no-fehbg flag as well.

To setup different wallpapers for different monitors one should pass as many file paths as many monitors are available. For example, for a dual monitor setup it would be:

$ feh --bg-center path/to/file/for/first/monitor path/to/file/for/second/monitor

Open SVG images

$ feh --conversion-timeout 1 file.svg

Note that this requires the imagemagick package.

Random background image

You can have feh set a random wallpaper using the --randomize option with one of the --bg-foo options, for example:

$ feh --bg-fill --randomize ~/.wallpaper/*

The above command tells feh to randomize the list of files in the ~/.wallpaper/ directory and set the backgrounds for all available desktops to whichever images are at the front of the randomized list (one unique image for each desktop). You can also do this recursively, if you have your wallpapers divided into subfolders:

$ feh --recursive --bg-fill --randomize ~/.wallpaper

To set a different random wallpaper from ~/.wallpaper each session, add the following to your .xinitrc:

$ feh --bg-max --randomize ~/.wallpaper/* &

Another way to set a random wallpaper on each xorg session is to edit your .fehbg as following.

$HOME/.fehbg
feh --bg-max --no-fehbg --randomize ~/.wallpaper/* 
Tip: To change wallpapers periodically, use a script (see while loop), cron job, or systemd timer to execute the command at the desired interval.

Troubleshooting

Using in cron job

To use feh in a cron job for randomizing your wallpapers, you must specify the DISPLAY environment variable:

DISPLAY=:0 feh --bg-max --randomize ~/.wallpaper/*

Note that some display managers like sddm might not save of XAUTHORITY file in ~/.Xauthority where feh expects it to be, which causes the cronjob to complain about: "Authorization required, but no authorization protocol specified".