https://wiki.archlinux.org/api.php?action=feedcontributions&user=Penguin%27&feedformat=atomArchWiki - User contributions [en]2024-03-29T05:28:58ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Feh&diff=130318Feh2011-02-09T14:16:59Z<p>Penguin': /* File Browser Image Launcher */</p>
<hr />
<div>[[Category: Graphics and DTP (English)]]<br />
{{i18n|Feh}}<br />
<br />
[https://derf.homelinux.org/~derf/projects/feh/ 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.<br />
<br />
==Installation==<br />
{{Package Official|feh}} is available in '''Extra''':<br />
<br />
# pacman -S feh<br />
<br />
==Usage==<br />
feh is highly configurable. For a full list of options, run {{Codeline|feh --help}}.<br />
<br />
===As an image viewer===<br />
To quickly browse images in a specific directory, you can launch feh with the following arguments:<br />
<br />
$ feh -g 640x480 -d -S filename /path/to/directory<br />
<br />
* The -g flag forces the images to appear no larger than 640x480<br />
* The -S filename flag sorts the images by filename<br />
<br />
This is just one example; there are many more options available should you desire more flexibility.<br />
<br />
====File Browser Image Launcher====<br />
The following script, originally posted [https://bbs.archlinux.org/viewtopic.php?pid=884635#p884635 on the forum], is useful for file browsers. It will display your selected image in feh, but it will enable you 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.<br />
<br />
The script assumes the first argument is the filename.<br />
<pre><br />
#!/bin/bash<br />
<br />
shopt -s nullglob<br />
<br />
if [[ ! -f $1 ]]; then<br />
echo "$0: first argument is not a file" >&2<br />
exit 1<br />
fi<br />
<br />
file=$(basename -- "$1")<br />
dir=$(dirname -- "$1")<br />
arr=()<br />
shift<br />
<br />
cd -- "$dir"<br />
<br />
for i in *; do<br />
[[ -f $i ]] || continue<br />
arr+=("$i")<br />
[[ $i == $file ]] && c=$((${#arr[@]} - 1))<br />
done<br />
<br />
exec feh "$@" -- "${arr[@]:c}" "${arr[@]:0:c}"<br />
</pre><br />
<br />
Invoke the script with the selected images path, followed by any additional arguments to feh. Here is an example of a launcher that you can use in a file browser:<br />
<br />
/path/to/script %f -F -Z<br />
<br />
"-F" and "-Z" are feh arguments. "-F" opens the image in fullscreen mode, and "-Z" autozooms the image. Adding the -q flag (quiet) suppresses error-messages to the terminal when feh tries loading non-image files in current folder.<br />
<br />
===As a desktop wallpaper manager===<br />
feh can be used to manage the desktop wallpaper for window managers that lack desktop features, such as [[Openbox]] and [[Fluxbox]]. <br />
<br />
When using [[GNOME]], you must disable Nautilus from controlling the desktop. The easiest way is to run this command:<br />
<br />
$ gconftool-2 --set /apps/nautilus/preferences/show_desktop --type boolean false<br />
<br />
The following command is an example of how to set the initial background:<br />
<br />
$ feh --bg-scale /path/to/image.file<br />
<br />
Other scaling options include:<br />
--bg-tile FILE<br />
--bg-center FILE<br />
--bg-max FILE<br />
--bg-fill FILE<br />
<br />
To restore the background on the next session, add the following to your startup file (e.g. {{Filename|~/.xinitrc}}, {{Filename|~/.config/openbox/autostart.sh}}, etc.):<br />
<br />
sh ~/.fehbg &<br />
<br />
====Random background image====<br />
To rotate the wallpaper randomly, create a script with the code below (e.g. {{Filename|wallpaper.sh}}). Make the script executable ({{Codeline|chmod +x wallpaper.sh}}) and call it from {{Filename|~/.xinitrc}}. You can also put the source directly in {{Filename|~/.xinitrc}} instead of in a separate file.<br />
<br />
Change the {{Filename|~/.wallpaper}} directory to fit your setup, and the "15m" delay as you please (see {{Codeline|man sleep}} for options).<br />
<pre><br />
#!/bin/sh<br />
<br />
while true; do<br />
find ~/.wallpaper -type f -name '*.jpg' -o -name '*.png' -print0 |<br />
shuf -n1 -z | xargs -0 feh --bg-scale<br />
sleep 15m<br />
done<br />
</pre><br />
<br />
This version doesn't fork as much, but doesn't recurse through directories:<br />
<pre><br />
#!/bin/bash<br />
<br />
shopt -s nullglob<br />
<br />
cd ~/.wallpaper<br />
<br />
while true; do<br />
files=()<br />
for i in *.jpg *.png; do<br />
[[ -f $i ]] && files+=("$i")<br />
done<br />
range=${#files[@]}<br />
<br />
((range)) && feh --bg-scale "${files[RANDOM % range]}"<br />
<br />
sleep 15m<br />
done<br />
</pre></div>Penguin'https://wiki.archlinux.org/index.php?title=Feh&diff=130317Feh2011-02-09T14:15:11Z<p>Penguin': </p>
<hr />
<div>[[Category: Graphics and DTP (English)]]<br />
{{i18n|Feh}}<br />
<br />
[https://derf.homelinux.org/~derf/projects/feh/ 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.<br />
<br />
==Installation==<br />
{{Package Official|feh}} is available in '''Extra''':<br />
<br />
# pacman -S feh<br />
<br />
==Usage==<br />
feh is highly configurable. For a full list of options, run {{Codeline|feh --help}}.<br />
<br />
===As an image viewer===<br />
To quickly browse images in a specific directory, you can launch feh with the following arguments:<br />
<br />
$ feh -g 640x480 -d -S filename /path/to/directory<br />
<br />
* The -g flag forces the images to appear no larger than 640x480<br />
* The -S filename flag sorts the images by filename<br />
<br />
This is just one example; there are many more options available should you desire more flexibility.<br />
<br />
====File Browser Image Launcher====<br />
The following script, originally posted [https://bbs.archlinux.org/viewtopic.php?pid=884635#p884635 on the forum], is useful for file browsers. It will display your selected image in feh, but it will enable you 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.<br />
<br />
The script assumes the first argument is the filename.<br />
<pre><br />
#!/bin/bash<br />
<br />
shopt -s nullglob<br />
<br />
if [[ ! -f $1 ]]; then<br />
echo "$0: first argument is not a file" >&2<br />
exit 1<br />
fi<br />
<br />
file=$(basename -- "$1")<br />
dir=$(dirname -- "$1")<br />
arr=()<br />
shift<br />
<br />
cd -- "$dir"<br />
<br />
for i in *; do<br />
[[ -f $i ]] || continue<br />
arr+=("$i")<br />
[[ $i == $file ]] && c=$((${#arr[@]} - 1))<br />
done<br />
<br />
exec feh "$@" -- "${arr[@]:c}" "${arr[@]:0:c}"<br />
</pre><br />
<br />
Invoke the script with the selected images path, followed by any additional arguments to feh. Here is an example of a launcher that you can use in a file browser:<br />
<br />
/path/to/script %f -F -Z<br />
<br />
"-F" and "-Z" are feh arguments. "-F" opens the image in fullscreen mode, and "-Z" autozooms the image. Adding the -q flag (quiet) suppresses error-messages to terminal when loading non-image files.<br />
<br />
===As a desktop wallpaper manager===<br />
feh can be used to manage the desktop wallpaper for window managers that lack desktop features, such as [[Openbox]] and [[Fluxbox]]. <br />
<br />
When using [[GNOME]], you must disable Nautilus from controlling the desktop. The easiest way is to run this command:<br />
<br />
$ gconftool-2 --set /apps/nautilus/preferences/show_desktop --type boolean false<br />
<br />
The following command is an example of how to set the initial background:<br />
<br />
$ feh --bg-scale /path/to/image.file<br />
<br />
Other scaling options include:<br />
--bg-tile FILE<br />
--bg-center FILE<br />
--bg-max FILE<br />
--bg-fill FILE<br />
<br />
To restore the background on the next session, add the following to your startup file (e.g. {{Filename|~/.xinitrc}}, {{Filename|~/.config/openbox/autostart.sh}}, etc.):<br />
<br />
sh ~/.fehbg &<br />
<br />
====Random background image====<br />
To rotate the wallpaper randomly, create a script with the code below (e.g. {{Filename|wallpaper.sh}}). Make the script executable ({{Codeline|chmod +x wallpaper.sh}}) and call it from {{Filename|~/.xinitrc}}. You can also put the source directly in {{Filename|~/.xinitrc}} instead of in a separate file.<br />
<br />
Change the {{Filename|~/.wallpaper}} directory to fit your setup, and the "15m" delay as you please (see {{Codeline|man sleep}} for options).<br />
<pre><br />
#!/bin/sh<br />
<br />
while true; do<br />
find ~/.wallpaper -type f -name '*.jpg' -o -name '*.png' -print0 |<br />
shuf -n1 -z | xargs -0 feh --bg-scale<br />
sleep 15m<br />
done<br />
</pre><br />
<br />
This version doesn't fork as much, but doesn't recurse through directories:<br />
<pre><br />
#!/bin/bash<br />
<br />
shopt -s nullglob<br />
<br />
cd ~/.wallpaper<br />
<br />
while true; do<br />
files=()<br />
for i in *.jpg *.png; do<br />
[[ -f $i ]] && files+=("$i")<br />
done<br />
range=${#files[@]}<br />
<br />
((range)) && feh --bg-scale "${files[RANDOM % range]}"<br />
<br />
sleep 15m<br />
done<br />
</pre></div>Penguin'