diff options
42 files changed, 591 insertions, 894 deletions
@@ -1,3 +1,85 @@ +Sun, 17 Feb 2019 08:41:53 +0100 Daniel Friesel <derf+feh@finalrewind.org> + +* Releasev v3.1.3 + * Fix missing filename in ~/.fehbg when using --no-xinerama on a feh + binary compiled with xinerama=1. This issue was introduced in v3.1.2. + +Mon, 11 Feb 2019 17:24:13 +0100 Daniel Friesel <derf+feh@finalrewind.org> + +* Release v3.1.2 + * Fix missing filenames in ~/.fehbg when using --bg-* on directories and/or + with --randomize + * Fix repeated --slideshow-delay/-D option not properly overriding the + 'start paused' flag + * Fix repeated --info option not properly overriding the 'draw info' flag + +Fri, 07 Dec 2018 22:51:15 +0100 Daniel Friesel <derf+feh@finalrewind.org> + +* Release v3.1.1 + * Decrease libcurl timeout from indefinite to 30 minutes. This should + be sufficient even for use cases with unusually high timeouts (just in + case anyone wants to do interplanetary slideshows), while at the same + time avoiding stalls in unattended slideshows when encountering + temporary network issues. + * Handle SIGINT/SIGTERM/SIGQUIT signals while loading images using libcurl. + Previously, signals were ignored during a (possibly slow) libcurl + network transfer, which was not intended behaviour. + +Wed, 21 Nov 2018 19:37:34 +0100 Daniel Friesel <derf+feh@finalrewind.org> + +* Release v3.1 + * Running "feh --start-at .../file.jpg" without specifying images, + directories or filelists to load is now equivalent to running + "feh --start-at .../file.jpg $(dirname .../file.jpg)". This way, it is + possible to view a specific file and browse all other files in the + corresponding directory. This is especially useful when starting feh + from file managers. + * Introduce fuzzy matching in --start-at: If the specified path is not + found in the file list, feh now resorts to comparing basenames (i.e., + file names without the directory components). This allows calls + like "feh --start-at cat.jpg ~/Pictures", which led to a file not found + error in previous versions. + * Respect -j / --output-dir when using save_image or save_filelist actions. + +Fri, 09 Nov 2018 17:17:15 +0100 Daniel Friesel <derf+feh@finalrewind.org> + +* Release v3.0 + * Remove deprecated webcam scripts (feh-cam and gen-cam-menu) + * Remove deprecated collage mode (-c/--collage) + * Remove deprecated option --cycle-once (use --on-last-slide=quit instead) + * Remove deprecated option --menu-bg + * Change default save_filelist key from "f" to "L" (mnemonic: fileList) + * Change default toggle_fullscreen key from "v" to "f" as this is also + used by mplayer, mpv and similar + * flip and rotation (keys "<", ">", "|", and "_") no longer change the + underlying file. This leaves delete ("Ctrl+Delete") as the only + destructive action which is enabled by default + * Add option --edit, which makes flip and rotation change the underlying + file as well as the displayed image. This was the default behaviour in + feh 1.x and 2.x + +Sat, 27 Oct 2018 19:46:48 +0200 Daniel Friesel <derf+feh@finalrewind.org> + +* Release v2.28.1 + * Do not ignore quit signals (SIGTERM, SIGINT, SIGQUIT) during preload + * Add missing EXIF orientations 2, 4, 5, and 7 (when built with exif=1, + patch by Olof-Joachim Frahm) + * Improve randomness on non-glibc systems + +Mon, 17 Sep 2018 21:17:04 +0200 Daniel Friesel <derf+feh@finalrewind.org> + +* Release v2.28 + * Decrease loading time for RAW images by utilizing dcraw to display the + embedded JPEG preview (patch by <https://github.com/ulteq>) + * Rename --magick-timeout to --conversion-timeout. --magick-timeout is + now deprecated and will be removed in a future release + * Fix unintened aliasing in rotated images whose rotation is not a + multiple of 90 degrees (patch by <https://github.com/ulteq>) + * New option: --on-last-slide=hold|quit|resume. + hold will cause feh to stop advancing beyond the last slide (patch by + <https://github.com/ulteq>), quit replaces --cycle-once (which is now + deprecated), and resume is the default (continue at the first image). + Tue, 17 Jul 2018 17:33:10 +0200 Daniel Friesel <derf+feh@finalrewind.org> * Release v2.27.1 @@ -25,23 +25,6 @@ test-x11: all install: install-man install-doc install-bin install-font install-img install: install-icon install-examples install-applications -ifeq (${cam},1) -install: install-cam -uninstall: uninstall-cam -endif - -install-cam: - @echo installing fe-cam and gen-cam-menu - @cp man/feh-cam.1 man/gen-cam-menu.1 ${man_dir}/man1 - @chmod 644 ${man_dir}/man1/feh-cam.1 ${man_dir}/man1/gen-cam-menu.1 - @cp cam/feh-cam cam/gen-cam-menu ${bin_dir} - @chmod 755 ${bin_dir}/feh-cam ${bin_dir}/gen-cam-menu - -uninstall-cam: - rm -f ${man_dir}/man1/feh-cam.1 - rm -f ${man_dir}/man1/gen-cam-menu.1 - rm -f ${bin_dir}/feh-cam ${bin_dir}/gen-cam-menu - install-man: @echo installing manuals to ${man_dir} @mkdir -p ${man_dir}/man1 @@ -1,12 +1,21 @@ [![build status](https://travis-ci.org/derf/feh.svg?branch=master)](https://travis-ci.org/derf/feh) -# feh -Imlib2 based image viewer +Feh – Image viewer and Cataloguer --- - * http://feh.finalrewind.org/ - * http://linuxbrit.co.uk/feh/ - * #feh on irc.oftc.net +feh is a light-weight, configurable and versatile image viewer. +It is aimed at command line users, but can also be started from graphical file +managers. Apart from viewing images, it can compile text and thumbnail +listings, show (un)loadable files, set X11 backgrounds, and more. + +Features include filelists, various image sorting modes, custom action scripts, +and image captions. feh can be controlled by configurable keyboard and mouse +shortcuts, terminal input and signals. When no file arguments or filelists are +specified, feh displays all files in the current directory. + +For more information, please refer to the [feh +website](https://feh.finalrewind.org/) or read the [feh +manual](https://man.finalrewind.org/1/feh/). Dependencies --- @@ -22,11 +31,10 @@ If built with exif=1: * libexif-dev * libexif12 -Recommended +Recommended Binaries --- - * jpegtran (supplied by the jpeg library, for lossless image rotation) - * convert (supplied by ImageMagick, can be used to load unsupported formats) + * convert (supplied by ImageMagick, can be used to load image formats not supported by Imlib2) Installation --- @@ -46,24 +54,23 @@ $ sudo make install **Explanation:** feh ships some icons and an X11 desktop entry, which allow it to be used from file managers, desktop menus and similar. However, installing -icons to /usr/local/share/... does not seem to work reliable in all cases. +icons to /usr/local/share/... does not seem to work reliably. Because of this, when using "make install app=1", feh will install its icons to /usr/share/..., even though they technically belong into /usr/local. - -ZSH Completion for feh is available [here](http://git.finalrewind.org/zsh/plain/etc/completions/_feh) +[ZSH completion for +feh](https://git.finalrewind.org/zsh/plain/etc/completions/_feh) is also +available. Make flags ---------- -Flags can be used to control the build and installation process. - -e.g. +feh's build process uses make flags to enable/disable optional features and +fine-tune the build and installation process. They can be passed as **make** +arguments or set as environment variables, like so: ```bash make flag=bool -``` -```bash make install flag=bool ``` or @@ -72,15 +79,13 @@ export flag=bool make && make install ``` -For example, `make xinerama=0 debug=1` will disable Xinerama support and produce a debug build. - -Available flags are: +The following flags are respected by the makefile. A default value of **1** +indicates that the corresponding feature is enabled by default. | Flag | Default value | Description | | :--- | :---: | :--- | -| app | 0 | install icons to /usr/share, regardless of `DESTDIR` and `PREFIX, and call gtk-update-icon-cache afterwards | -| cam | 0 | install deprecated feh-cam und gen-cam-menu scripts | -| curl | 1 | use libcurl to view http:// and similar images | +| app | 0 | install icons to /usr/share, regardless of `DESTDIR` and `PREFIX`, and call gtk-update-icon-cache afterwards | +| curl | 1 | use libcurl to view https:// and similar images | | debug | 0 | debug build, enables `--debug` | | exif | 0 | Builtin EXIF tag display support | | help | 0 | include help text (refers to the manpage otherwise) | @@ -89,18 +94,19 @@ Available flags are: | verscmp | 1 | Support naturing sorting (`--version-sort`). Requires a GNU-compatible libc exposing `strverscmp` | | xinerama | 1 | Support Xinerama/XRandR multiscreen setups | -So, by default **libcurl** and **Xinerama** are enabled, the rest is disabled. +For example, `make xinerama=0 debug=1` will disable Xinerama support and +produce a debug build; libcurl and natural sorting support will remain enabled. Additionally, the standard variables `PREFIX` and `DESTDIR` are supported. -**PREFIX _(default: /usr)_** controls where the application and its data files +**PREFIX _(default: /usr/local)_** controls where the application and its data files will be installed. It must be set both during `make` and `make install`. **DESTDIR _(default: empty)_** sets the installation root during "make install". It is mostly useful for package maintainers. -**Note:** config.mk is designed so that in most cases, you can set environment -variables instead of editing it. E.g.: +**Note:** Defaults are specified in `config.mk`. It is designed so that in most +cases, you can set environment variables instead of editing it. E.g.: ```bash CFLAGS='-g -Os' make @@ -115,26 +121,29 @@ Builtin EXIF support is maintained by Dennis Real, [here](https://github.com/rea Testing (non-X) --------------- + +The non-X11 parts of feh can be automatically tested by running + ```bash $ make test ``` - -Requires **perl >= 5.10** with `Test::Command`. The tests are non-interactive and -work without X, so they can safely be run even on a headless buildserver. +This requires **perl >= 5.10** and the perl module `Test::Command`. Tests are +non-interactive and do not require a running X11, so they can safely be run on +a headless buildserver. -Testing (X) ------------ +Contributing +--- -Requires - * import (usually supplied by imagemagick) - * perl >= 5.10 with GD, Test::More and X11::GUITest - * twm - * Xephyr +Bugfixes are always welcome, just open a pull request :) -```bash -$ make test-x11 -``` +Before proposing a new feature, please consider the scope of feh: It is an +image viewer and cataloguer, not an image editor or similar. Also, its option +list is already pretty long. Please discuss your ideas in a feature request +before opening a pull request in this case. -**_Be aware that this is quite experimental, so far the X-tests have only been -run on one machine. So they may or may not work for you._** +Please keep in mind that feh's options, key bindings and format specifiers are +documented in two different places: The manual (man/feh.pre) and the help text +(src/help.raw). Although the help is not compiled in by default, it should be +kept up-to-date. On space-constrained embedded systems, it may be more useful +than the (significantly larger) man page. diff --git a/cam/ChangeLog b/cam/ChangeLog deleted file mode 100644 index 4a562bd..0000000 --- a/cam/ChangeLog +++ /dev/null @@ -1,14 +0,0 @@ -0.3 ---- -- added this changelog.. - -0.4 ---- -- added richlowe's patch. since he pretty much rewrote everything, he's -an author, not a contributor. :) -- uses "use strict" now -- uses POD for documentation -- added title support in cam bookmarks file -- cmd line flag for different bookmars file -- getoppt_long use for command-line flags -- rmeoved richlow's damn nonstandard Pod::Usage stuff diff --git a/cam/README b/cam/README deleted file mode 100644 index e67d60e..0000000 --- a/cam/README +++ /dev/null @@ -1,45 +0,0 @@ -Cam 0.4 README -============== -This document was last updated on 20010223-1620-PST. -Please see the file COPYING for licensing information. - -Description -=========== -feh-cam is a Perl wrapper for feh that simlifies viewing webcams. It uses -keyed bookmarks. Type "feh-cam --help" at the command line for usage -information. - -Webcam Information -================== -All webcam images are the property of their respective owners. If you -enjoy the cam, you should check out the page too! The initial list of -cam bookmarks (in the cam_bookmarks file) is a combination of webcams -scoured from the #E People Page (http://bma.debian.net/~bma/e-irc/), -my favorite webcams from the Stile Project's cam pages -(http://www.stileproject.com/), and additional #e people cams that -have come online since cam's original release (0.1). - -Installation -============ -- Copy the "feh-cam" script to a location in your PATH (ex /usr/bin, - /usr/local/bin, or $HOME/bin), and make sure hte execute bit on the - script is set (type "chmod a+x $HOME/.cam_bookmarks"). -- Copy the "cam_bookmarks" file to $HOME/.cam_bookmarks and make sure - cam can see it by typing "feh-cam --list". -- Optionally, modify the options inside the feh-cam script. You can pass - feh any options before the image by adjusting the $PRE variable, - and any options after the image by adjustin the $POST variable. - For example, I like to keep all cam images by default; you can enable - this behavior with the -k command line option, or enable it permanently - by adding it to the $PRE flags in feh-cam. - -About the Authors -================= -Paul Duncan <pabs@pablotron.org>, pabs on #e -http://www.pablotron.org/ - -Richard Lowe <richlowe@btinternet.com>, richlowe on #e -http://www.richlowe.btinternet.co.uk/ - -...but the real credit goes to Tom Gilbert for making feh, an awesome -image viewer. :) diff --git a/cam/cam_bookmarks b/cam/cam_bookmarks deleted file mode 100644 index 8d45413..0000000 --- a/cam/cam_bookmarks +++ /dev/null @@ -1,2 +0,0 @@ -nasa_shuttle=60,http://science.ksc.nasa.gov/shuttle/countdown/video/chan2large.jpg - diff --git a/cam/feh-cam b/cam/feh-cam deleted file mode 100755 index 29b254f..0000000 --- a/cam/feh-cam +++ /dev/null @@ -1,195 +0,0 @@ -#!/usr/bin/perl -w - -use strict; -use Getopt::Long; - -############################################# -############# CAM RUN-TIME OPTIONS ########## -############################################# -my $feh = "feh"; - -# additional feh cmdline options -my $PRE = " -q -G -Twebcam -1 0 -0 1 "; -my $POST = ""; -############################################# -############################################# - -# Options -my $help = ''; -my $fullscreen = ''; -my $geometry = ''; -my $list = ''; -my $verbose = ''; -my $add = ''; -my $keep = ''; -my $deftitle = '%cCAM - %u'; -my $title = ''; -my $bp = $ENV{HOME}."/.cam_bookmarks"; -my $DEBUG = 0; - -# check args -&print_usage_and_exit unless (@ARGV); - -print STDERR "Note: feh-cam will be removed from the feh distribution in 2013.\n"; -print STDERR "Please mail derf\@finalrewind.org if you still use it.\n"; - - -# Url, Refresh, and bookmarks -my $url = ""; -my $ref = ""; -my %bms = (); - -GetOptions('help|?|h' => \$help, - 'full-screen|f|giblets-mom' => \$fullscreen, - 'list|l' => \$list, - 'geometry|g=s' => \$geometry, - 'verbose|v' => \$verbose, - 'add|a' => \$add, - 'keep-images|k|save-pr0n' => \$keep, - 'title|t=s' => \$title, - 'debug|d' => \$DEBUG, - 'bookmarks|b=s' => \$bp - ); - -my $key = shift @ARGV; - -&print_usage_and_exit if ($help); - -if ($verbose) { - $PRE .= " -V "; -} - -if ($fullscreen) { - $PRE =~ s/-w//; - $PRE .= " --full-screen --auto-zoom "; -} - -if ($geometry) { - $PRE .= " --geometry $geometry "; -} - -# if requested, add a key/url pair to bookmarks file -if ($add) { - my $mytitle = ''; - ($url,$ref,$mytitle) = @ARGV; - die "Bad key syntax\n" unless ($key && $url && $ref); - - $mytitle="" unless ($mytitle); - - open(BMF, ">>$bp") or die "Couldn't open bookmarks file \"$bp\": $!\n"; - print BMF "$key=$ref,$url \"$mytitle\"\n"; - close BMF; - print "Added URL key \"$key\" = $url, $ref.\n"; # its useful to have this even if you arent debugging --richlowe - exit 0; -} - -if ($keep) { - $PRE .= " -k "; -} - - - -# load bookmarks -open(BMF, "$bp") or die "Couldn't open bookmarks file \"$bp\": $!\n"; -foreach (<BMF>) { - next unless /^(.*?)=(.*)$/; - $bms{$1} = $2; - print "key=$1, url=$2\n" if ($DEBUG); -} -close BMF; - -# if requested, dump a list of key/url pair values -if ($list) { - foreach (sort keys %bms) { - my $t = $bms{$_}; - - $t =~ s/^(.+?),(.+?)(^ "(.*)"|)?$/$2/; - chomp $t; - print "$_ = $t, $1, $3\n"; - } - exit 0; -} - -# main loop -MAIN: { - do { - $title=""; - $url = $bms{$key}; - die "Couldn't find URL key \"$key.\"\n" unless($url); - - $url =~ s/^(.+?),(.+?)( "(.*)")?$/$2/; - $ref = $1; - - if ($4) { - $title = $4; - } else { - $title = $deftitle; - } - - if ($title) { - $title =~ s/\%c/$key/g; - $title =~ s/\%u/$url/g; - $title =~ s/\%r/$ref/g; - $title =~ s/\%\%/\%/g; - $title = " --title \"$title\" "; - } - - my $cmd = "$feh $PRE $title -T".$key."cam -R $ref $url $POST"; - print "$cmd\n" if ($DEBUG); - FORK: { - my $pid; - if ($pid = fork) { - # We're a daddy! :) - } elsif (defined $pid) { - # child - exec "$cmd" or die "Couldnt exec() $feh: $!\n"; - } elsif ( $! =~ /No more process/) { - sleep 5; - redo FORK; - } else { - # wtf? - die "Unrecoverable fork() error: $!\n"; - } - } - } while ($key = shift @ARGV); -} - - -sub print_usage_and_exit() { - print <<END_USAGE; -$0 0.4 -by Paul Duncan <pabs\@pablotron.org>, and - Richard Lowe <richlowe\@btinternet.com> - -Description: - A convenient webcam wrapper for feh. - -Usage: - $0 <keys> - Load the urls specified by the given keys. - key : a url key stored in the bookmarks file (\"$bp\"). - $0 <-a|--add> key url refresh - Add a key to the bookmarks file. - key : short key (ex \"jenni\"), - url : url (ex \"http://www.jennicam.org/webcam/cam.jpg\"), - refresh : refresh, in seconds (ex 120) - $0 <-l|--list> - List each url key in the bookmarks file (\"$bp\"). - $0 [-f|--full-screen] keys - Start feh in full-screen mode (aka --giblets-mom \"viewing\" mode). - $0 [-k|--keep-images] keys - Save each image in the current directory (aka --save-pr0n). - $0 [-g|--geometry] xxx - Use window geometry xxx (e.g. 640x480). - $0 [-v|--verbose] options - Start feh in verbose mode (feh -V). - $0 <-h|-?|--help> - Display usage information (this screen). - -Notes: -Thanks to giblet for feh, an awesome image and webcam viewing program, -and raster for Imlib2. -END_USAGE - exit(-1); -} - diff --git a/cam/gen-cam-menu b/cam/gen-cam-menu deleted file mode 100755 index 710070b..0000000 --- a/cam/gen-cam-menu +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -###################################################################### -# gen_cam_menu.sh 0.1 # -# by Paul Duncan <pabs@pablotron.org> # -# # -# This script will generate a menu of cam bookmarks for # -# Enlightenment DR0.16.x. TYou can safely run this script more than # -# once; it won't add an another entry to the left-click menu if it's # -# already been run once. It doesn't delete any existing menu # -# entries, and it backs up your existing menu files as well. (just # -# in case I screwed up.. hehe). THe two variables below allow you # -# rename the left-click menuitem, and the menu title. # -# # -# # -MENU_ITEM="Webcams"; # -MENU_TITLE="Webcam List"; # -BMARKS=$HOME"/.cam_bookmarks"; # -# # -###################################################################### - - -C_MENUFILE="webcam.menu"; -F_MENUFILE="file.menu"; -C_MENU=$HOME"/.enlightenment/"$C_MENUFILE; -F_MENU=$HOME"/.enlightenment/"$F_MENUFILE; - -# make backups, just in case -cp -f $C_MENU $C_MENU"-cam_menu.backup" -cp -f $F_MENU $F_MENU"-cam_menu.backup" - -echo "Note: gen-cam-menu will be removed from the feh distribution by 2013." > /dev/stderr -echo "Please mail derf@finalrewind.org if you still use it." > /dev/stderr - -# generate cam menu -echo "Generating \""$C_MENU"\"."; -echo "\"$TITLE\"" > "$C_MENU"; -cat $BMARKS | perl -e "while (<>) { /(.*?)=/; \$keys{\$1}=\"1\"; } foreach(sort keys %keys) { /(.)(.*$)/; print \"\\\"\".uc(\$1).\"\$2\\\" NULL exec \\\"feh-cam \$1\$2\\\"\\n\"; }">> $C_MENU; - -# add entry to file menu if there isn't one -echo "Generating \""$F_MENU"\"."; -perl -i -e "\$already_there=0; while (<>) { \$already_there++ if (/$MENU_ITEM/); print \"\\\"$MENU_ITEM\\\" NULL menu \\\"$C_MENUFILE\\\"\\n\" if (!\$already_there&&/Restart/); print; }" $F_MENU; - -echo "Done."; @@ -2,7 +2,6 @@ PACKAGE ?= feh VERSION ?= ${shell git describe --dirty} app ?= 0 -cam ?= 0 curl ?= 1 debug ?= 0 exif ?= 0 diff --git a/examples/themes b/examples/themes index d315942..2d77770 100644 --- a/examples/themes +++ b/examples/themes @@ -41,11 +41,6 @@ booth --full-screen --hide-pointer --slideshow-delay 20 # Screw xscreensaver, use feh =) screensave --recursive --full-screen --randomize --slideshow-delay 10 --hide-pointer -# Different menus -aqua --menu-bg /usr/share/feh/images/menubg_aqua.png -sky --menu-bg /usr/share/feh/images/menubg_sky.png -black --menu-bg /usr/share/feh/images/menubg_black.png - # Some more examples, used by the feh developer rfs --full-screen --hide-pointer --auto-zoom --randomize diff --git a/man/feh-cam.pre b/man/feh-cam.pre deleted file mode 100644 index 4a02753..0000000 --- a/man/feh-cam.pre +++ /dev/null @@ -1,57 +0,0 @@ -.Dd $DATE$ -.Dt FEH-CAM 1 -.Os -. -.Sh NAME -.Nm feh-cam -.Nd utility for viewing live webcam images -.Sh SYNOPSIS -.Nm -.Op Ar options -.Ar keys -. -.Sh VERSION -This manual documents feh-cam, shipped with feh version $VERSION$ -. -.Sh DEPRECATION WARNING -. -This tool will be removed from the feh distribution by 2013. -. -.Pp -. -If you still use it, please contact me at -.Aq derf@finalrewind.org -. -.Sh DESCRIPTION -.Nm -is a perl wrapper for feh which simplifies viewing webcams using keyed -bookmarks. It helps manage viewing your favourite webcam sites with feh. -. -.Sh OPTIONS -.Bl -tag -width indent -.It Cm -a , --add Ar key url refresh -Add -.Ar url -as -.Ar key -to the bookmarks file; when viewing, reload it every -.Ar refresh -seconds -.It Cm -l , --list -List each url / key pair in the bookmarks file -.It Cm -f , --full-screen -Start feh in full-screen mode -.It Cm -k , --keep-images -Save each webcam image in the current directory -.It Cm -g , --geometry Ar width No x Ar height -Use window geometry -.Ar width No x Ar height -.It Cm -v , --verbose -Start feh in verbose mode -.El -. -.Sh FILES -The bookmarks are stored in -.Pa ~/.cam_bookmarks -.Sh SEE ALSO -.Xr feh 1 diff --git a/man/feh.pre b/man/feh.pre index e1ade10..f59301f 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -33,28 +33,24 @@ $MAN_INOTIFY$$MAN_DEBUG$ .Sh DESCRIPTION . .Nm -is a mode-based image viewer. -It is especially aimed at command line users who need a fast image viewer -without huge GUI dependencies, though it can also be started by -.Pq graphical -file managers to view an image. -By default -.Pq unless arguments or a filelist are specified , -.Nm -displays all files in the current directory. +is a light-weight, configurable and versatile image viewer. +It is aimed at command line users, but can also be started from graphical file +managers. +Apart from viewing images, it can compile text and thumbnail +listings, show (un)loadable files, set X11 backgrounds, and more. . .Pp . +Features include filelists, various image sorting modes, custom action scripts, +and image captions. .Nm -supports filelists, various image sorting modes, image captions, HTTP and more. -It can be controlled by configurable keyboard and mouse shortcuts, terminal +can be controlled by configurable keyboard and mouse shortcuts, terminal input and signals. -. -.Pp -. -In many desktop environments, +When no file arguments or filelists are specified and +.Cm --start-at +is not used, .Nm -can also be used as wallpaper setter. +displays all files in the current directory. . .Pp . @@ -97,7 +93,7 @@ and its size can be limited by height, width or both. . Index mode forms an index print from the filelist. Image thumbnails are shown along with the filename, -filesize and pixel size, printed using a truetype +size and dimensions, printed using a truetype font of your choice. The resulting image can be viewed or saved, and its size can be limited by height, width or both. @@ -134,22 +130,22 @@ This is useful for preening a directory. .Sh SUPPORTED FORMATS . .Nm -can open any format supported by Imlib2, most notably jpeg, png, +can open any format supported by imlib2, most notably jpeg, png, pnm, tiff, and bmp. The gif format is also supported, but only for static images. In case of animations, only the first frame will be shown. . If the convert binary .Pq supplied by ImageMagick -is available, it also has limited support for many other filetypes, such as +is available, it also has limited support for many other file types, such as svg, xcf and otf. If dcraw is available, .Nm also supports RAW files provided by cameras and will display the embedded thumbnails. Use -.Cm --conversion-timeout Ar num -with a non-negative value to enable it. +.Cm --conversion-timeout Ar timeout +with a non-negative value to enable support for these formats. . . .Sh OPTIONS @@ -229,7 +225,7 @@ Create borderless windows. . .It Cm --cache-size Ar size . -Set Imlib2 in-memory cache to +Set imlib2 in-memory cache to .Ar size MiB. A higher cache size can significantly improve performance especially for small @@ -261,6 +257,22 @@ and viewing image the caption will be looked for in .Qq images/captions/foo.jpg.txt . . +.It Cm --conversion-timeout Ar timeout +. +.Nm +can use ImageMagick to try converting unloadable files into a supported +file format. +As this can take a long time, it is disabled by default. +Set +.Ar timeout +to a non-negative value to enable it. +A positive value +specifies after how many seconds conversion attempts should be aborted, +zero causes +.Nm +to try indefinitely. +Negative values restore the default by disabling conversion altogether. +. .It Cm -L , --customlist Ar format . Don't display images, print image info according to @@ -282,7 +294,7 @@ with exiv2 / exifgrep . . .It Cm -d , --draw-filename . -Draw the filename at the top-left of the image. +Draw the file name at the top-left of the image. . .It Cm --draw-tinted . @@ -290,14 +302,20 @@ Show overlay texts .Pq as created by Cm --draw-filename No et al on a semi-transparent background to improve their readability . +.It Cm --edit +. +Enable basic editing of files. This makes rotation and mirroring +.Pq bound to Qo < Qc , Qo > Qc , Qo | Qc , and Qo _ Qc by default +change the underlying file and not just its displayed content. +. .It Cm -f , --filelist Ar file . This option is similar to the playlists used by music software. If .Ar file exists, it will be read for a list of files to load, in the order they appear. -The format is a list of image filenames, absolute or relative to the current -directory, one filename per line. +The format is a list of image file names, absolute or relative to the current +directory, one file name per line. . .Pp . @@ -346,7 +364,7 @@ add multiple paths. . .It Cm --force-aliasing . -Disable antialiasing for zooming, background setting etc. +Disable anti-aliasing for zooming, background setting etc. . .It Cm -I , --fullindex . @@ -371,14 +389,13 @@ to get a progress bar. . Make the window fullscreen. Note that in this mode, large images will always be scaled down to fit the -screen, +screen, and .Cm --zoom Ar zoom only affects smaller images and never scales larger than necessary to fit the screen size. The only exception is a .Ar zoom -of 100, in which case images will always be shown at 100% zoom, no matter -their dimensions. +of 100, in which case images will always be shown at 100% zoom. . .Pp . @@ -389,17 +406,17 @@ The thumbnail list itself will still be windowed. . .It Cm -g , --geometry Ar width Cm x Ar height | Cm + Ar x Cm + Ar y | Ar width Cm x Ar height Cm + Ar x Cm + Ar y . -Limit (and don't change) the window size. -Takes an X-style geometry -.Ar string -like 640x480 with optional +x+y window offset. -Use +Use a fixed window size as specified in the X-style geometry +.Ar string , +e.g. 640x480. +An optional +x+y window offset can be specified. +Combine with .Cm --scale-down to scale down larger images like in fullscreen mode. . -Also note that this option does not enforce the geometry, changing it by a tiling +Note that this option does not enforce the window size; changing it by a tiling WM or manually is still possible. -After each resize, the resulting window size is used as the new size limit. +However, auto-resize remains disabled. . .It Cm -Y , --hide-pointer . @@ -412,12 +429,13 @@ Use .Ar style as background for transparent image parts and the like. Accepted values: default, checks, or an XColor -.Pq eg. Qo black Qc or Qo #428bdd Qc . +.Pq e.g. Qo black Qc or Qo #428bdd Qc . . In windowed mode, the default is checks .Pq a checkered background so transparent image parts are easy to see . -In fullscreen and background setting mode, checks is not accepted and the -default is black. +In fullscreen and background setting mode, +.Cm checks +is not accepted and the default is black. . .It Cm -i , --index . @@ -430,10 +448,10 @@ Index mode enables certain other options, see and .Sx MONTAGE MODE OPTIONS . . -.It Cm --info Oo Ar flag Oc Ns Ar commandline +.It Cm --info Oo Ar flag Oc Ns Ar command_line . Execute -.Ar commandline +.Ar command_line and display its output in the bottom left corner of the image. Can be used to display e.g. image dimensions or EXIF information. Supports @@ -446,6 +464,12 @@ is set to the output will not be displayed by default, but has to be enabled by the toggle_info key. . +.It Cm --insecure +. +When viewing files with HTTPS, this option disables all certificate checks. It +allows images on sites with self-signed or expired certificates to be opened, +but is no more secure than plain HTTP. +. .It Cm -k , --keep-http . When viewing files using HTTP, @@ -456,13 +480,6 @@ specified by .Cm --output-dir , or in the current working directory. . -.It Cm --insecure -. -When viewing files with HTTPS, this option disables strict hostname and peer -checking. -This allows images on sites with self-signed certificates to be opened, but is -no more secure than plain HTTP. -. .It Cm --keep-zoom-vp . When switching images, keep zoom and viewport settings @@ -482,16 +499,6 @@ Don't display images. Just print out their names if imlib2 can successfully load them. Returns false if at least one image failed to load. . -.It Cm --conversion-timeout Ar timeout -. -Stop trying to convert unloadable files after -.Ar timeout -seconds. -Negative values disable conversion altogether, zero causes -.Nm -to try indefinitely. -By default, conversion is disabled. -. .It Cm --max-dimension Ar width No x Ar height . Only show images with width <= @@ -590,7 +597,9 @@ image. . Save files to .Ar directory -.Pq only useful with -k . +when using +.Cm --keep-http +or the save_image command. By default, files are saved in the current working directory. . .It Cm -p , --preload @@ -619,13 +628,14 @@ from last to first image). . .It Cm -r , --recursive . -Recursively expand any directories in the commandline arguments +Recursively expand any directories in the command line arguments to the content of those directories, all the way down to the bottom level. . .It Cm --no-recursive . -Don't recursively expand any directories (enabled by default). -Useful to override theme options. +Don't recursively expand any directories. +This is the default, but this option is useful to override themes containing +.Cm --recursive . . .It Cm -R , --reload Ar int . @@ -633,7 +643,7 @@ Reload filelist and current image after .Ar int seconds. Useful for viewing HTTP webcams or frequently changing directories. -.Pq Note that the filelist reloading is still experimental. +.Pq Note that filelist reloading is still experimental. . .Pp . @@ -669,10 +679,10 @@ In tiling environments, this also causes the image to be centered in the window. Scroll .Ar count pixels whenever scroll_up, scroll_down, scroll_left or scroll_right is pressed. -Note that this option accepts negative numbers in case you need to inverse the -scroll direction; see +Note that this option accepts negative numbers in case you need to reverse the +scroll direction. See .Sx KEYS CONFIG SYNTAX -to change it permanently. +for how to reverse it permanently. Default: 20 . .It Cm -D , --slideshow-delay Ar float @@ -689,36 +699,66 @@ in paused mode. . .It Cm -S , --sort Ar sort_type . -The file list may be sorted according to image parameters. -Allowed sort types are: name, filename, dirname, mtime, width, height, pixels, -size, format. -For sort modes other than name, filename, dirname, or mtime, a preload run will -be necessary, causing a delay proportional to the number of images in the list. +Sort file list according to image parameters. +Allowed sort types are: +.Cm name , filename , dirname , mtime , width , height , pixels , size , format . +For sort modes other than +.Cm name , filename , dirname , +or +.Cm mtime , +a preload run is +necessary, causing a delay proportional to the number of images in the list. +. +.Pp +. +.Cm mtime +starts with the most recently modified image. +.Cm width , height , pixels +and +.Cm size +start with the smallest. +Use +.Cm --reverse +to sort by oldest or largest first. . .Pp . -The mtime sort mode sorts images by most recently modified. -To sort by oldest first, reverse the filelist with --reverse. +For +.Cm name , filename , +and +.Cm dirname +you can use +.Cm --version-sort +to sort numbers naturally, so that e.g. 10.jpg comes after 2.jpg. . .It Cm -| , --start-at Ar filename . Start the filelist at .Ar filename . -. -Note that at the moment, -.Ar filename -must match an -.Pq expanded -path in the filelist. -So, if the file to be matched is passed via an absolute path in the filelist, +If no other files or filelists were specified on the command line, +.Nm +will first load all files from the directory in which .Ar filename -must be an absolute path. -If the file is passed via a relative path, +resides. +This way, it's possible to look at a specific image and use the next / prev +keys to browse through the directory. +See +.Sx USAGE EXAMPLES +for examples. +. +.Pp +. +Note: If you use relative paths in your filelist, .Ar filename -must be an identical relative path. -This is a known issue. -See also -.Sx USAGE EXAMPLES . +should also be a relative path. +If you use absolute paths, it should also be an absolute path. +. +If +.Nm +cannot find an exact match, it will compare basenames +.Pq filenames without the directory suffix . +This may lead to mismatches if several files in your filelist +have the same basename. . .It Cm -T , --theme Ar theme . @@ -727,7 +767,7 @@ Load options from config file with name - see .Sx THEMES CONFIG SYNTAX for more info. -Note that commandline options always override theme options. +Note that command line options always override theme options. The theme can also be set via the program name .Pq e.g. with symlinks , so by default @@ -782,11 +822,17 @@ output version information and exit. .It Cm --version-sort . .Pq optional feature, $MAN_VERSCMP$ in this build -Use natural sorting for file and directory names. +When combined with +.Cm --sort name , --sort filename , +or +.Cm --sort dirname : +use natural sorting for file and directory names. In this mode, filenames are sorted as an ordinary human would expect, e.g. .Qq 2.jpg comes before .Qq 10.jpg . +Note that this option only has an effect when a sort mode is set using +.Cm --sort . . .It Cm --xinerama-index Ar screen . @@ -967,20 +1013,14 @@ be printed. . Redraw thumbnail window every .Ar n -images. -In -.Nm -<= 1.5, the thumbnail image used to be redrawn after every computed thumbnail -.Pq so, it updated immediately . -However, since the redrawing takes quite long -.Pq especially for thumbnail mode on a large filelist , -this turned out to be a major performance penalty. -As a workaround, the thumbnail image is redrawn every 10th image now by default. +images while generating thumbnails. +Redrawing takes quite long, so the default is 10. Set .Ar n No = 1 -to get the old behaviour, -.Ar n No = 0 -will only redraw once all thumbnails are loaded. +to update the thumbnail window immediately. +With +.Ar n No = 0 , +there will only be one redraw once all thumbnails are loaded. . .El . @@ -1216,7 +1256,7 @@ If the files are not found in that directory, it will also try All config files treat lines starting with a .Qq # character as comments. -Note that mid-line comments are not supported. +Comments at the end of a line are not supported. . . .Sh THEMES CONFIG SYNTAX @@ -1283,6 +1323,9 @@ to use these options. . Note that you can split a theme over several lines by placing a backslash at the end of an unfinished line. +A single option-argument-pair must not span multiple lines. +A single line must not be longer than 1023 characters, but there's no upper +limit for the length of a theme. . .Pp . @@ -1409,10 +1452,9 @@ Toggle filename display .Pq optional feature, $MAN_EXIF$ in this build Toggle EXIF tag display . -.It f Bq save_filelist +.It f Bq toggle_fullscreen . -Save the current filelist as -.Qq feh_PID_ID_filelist +Toggle fullscreen . .It g Bq toggle_fixed_geometry . @@ -1436,10 +1478,15 @@ When enabled, .Nm will keep zoom and X, Y offset when switching images. . +.It L Bq save_filelist +. +Save the current filelist as +.Qq feh_PID_ID_filelist +. .It m Bq toggle_menu . Show menu. -Use the arrow keys and return to select items, +Use the arrow keys and return to select items, and .Aq escape to close the menu. . @@ -1472,10 +1519,6 @@ Useful for webcams Save the current image as .Qq feh_PID_ID_FILENAME . -.It v Bq toggle_fullscreen -. -Toggle fullscreen -. .It w Bq size_to_image . Change window size to fit current image size @@ -1503,8 +1546,14 @@ are grouped together. . .It < , > Bq orient_3 , orient_1 . -In place editing - rotate the image 90 degrees (counter)clockwise. -The rotation is lossless, but may create artifacts in some image corners when +rotate the image 90 degrees (counter)clockwise. +. +.Pp +. +When +.Cm --edit +is used, this also rotates the image in the underlying file. +Rotation is lossless, but may create artifacts in some image corners when used with JPEG images. Rotating in the reverse direction will make them go away. See @@ -1524,11 +1573,19 @@ for details on how to change this flag. . .It _ Bq flip . -In place editing - vertical flip +Vertically flip image. +When +.Cm --edit +is used, this also flips the image in the underlying file +.Pq see above . . .It | Bq mirror . -In place editing - horizontal flip +Horizontally flip image. +When +.Cm --edit +is used, this also flips the image in the underlying file +.Pq see above . . .It 0 .. 9 Bq action_0 .. action_9 . @@ -1587,8 +1644,8 @@ Scroll up .It Ao keypad Down Ac , Ao Ctrl+Down Ac Bq scroll_down . Scroll down. -Note that the scroll keys work without anti-aliasing for performance reasons, -hit the render key after scrolling to antialias the image. +Note that the scroll keys work without anti-aliasing for performance reasons; +hit the render key after scrolling to anti-alias the image. . .It Aq Alt+Left Bq scroll_left_page . @@ -1608,7 +1665,7 @@ Scroll down by one page . .It R, Ao keypad begin Ac Bq render . -Antialias the image. +Anti-alias the image. Opens the currently selected image in thumbnail mode. . .It Ao keypad + Ac , Ao Up Ac Bq zoom_in @@ -1800,7 +1857,7 @@ So, to enlarge a specific part of an image, click the zoom button on that part. . .Sh SIGNALS . -In slideshow mode, +In slideshow and multiwindow mode, .Nm handles the following signals: . @@ -1808,11 +1865,15 @@ handles the following signals: . .It Dv SIGUSR1 . -Switch to next image +Slideshow mode: switch to next image; +reload current image if the slideshow consists of a single file. +Multiwindow mode: reload all images. . .It Dv SIGUSR2 . -Switch to previous image +Slideshow mode: switch to previous image; +reload current image if the slideshow consists of a single file. +Multiwindow mode: reload all images. . .El . @@ -1821,7 +1882,7 @@ Switch to previous image . Here are some examples of useful option combinations. See also: -.Aq http://feh.finalrewind.org/examples/ +.Aq https://feh.finalrewind.org/examples/ . .Bl -tag -width indent . @@ -1880,49 +1941,56 @@ automatically change to the next image after 5 seconds View all images in ~/Pictures and below, sorted by width, move an image to ~/image/image_name when enter is pressed . -.It feh --start-at ./foo.jpg \&. +.It feh --start-at ~/Pictures/foo.jpg . -View all images in the current directory, starting with foo.jpg. +View all images in ~/Pictures, starting with foo.jpg. All other images are still in the slideshow and can be viewed normally . -.It feh --start-at foo.jpg * +.It feh --start-at ~/Pictures/foo.jpg ~/Pictures . -Same as above +Same as above. . .It feh --info \&"exifgrep '\&(Model\&|DateTimeOriginal\&|FNumber\&|ISO\&|Flash\&)' %F \&| cut -d \&. -f 4-\&" \&. . Show some EXIF information, extracted by exifprobe/exifgrep . -.It feh --action 'rm %F' -rl --max-dim 1000x800 +.It feh --action 'rm %F' -rl --max-dimension 1000x800 . Recursively remove all images with dimensions below or equal to 1000x800 pixels from the current directory. . +.It feh -L '%w %h %f' \&| awk '{ if \&($1 > $2\&) { print $0 } }' \&| cut -d ' ' -f 3- \&| feh -f - +. +Show landscape pictures +.Pq image width greater than height +in the current directory. +. .El . . .Sh DEPENDENCIES . +When +.Cm --edit +is used, .Nm -requires the +needs the .Cm jpegtran and .Cm jpegexiforient binaries .Pq usually distributed in Qo libjpeg-progs Qc or similar -for lossless rotation. +for lossless JPEG rotation. . .Pp . -To view images from URLs such as http://, you need +To view images from URLs such as "http://", .Nm -compiled with libcurl support (enabled by default). -See the -.Sx VERSION -section. +must be compiled with libcurl support. +It is $MAN_CURL$ in this build . . -.Sh BUGS +.Sh KNOWN BUGS . On systems with giflib 5.1.2, .Nm @@ -1942,6 +2010,12 @@ upgrade to giflib 5.1.4. . .Pp . +While loading images using libcurl, +.Nm +will not react to key or mouse actions. +. +.Pp +. Thumbnail mode is somewhat inefficient, and because of that not nearly as fast as it could be. . @@ -1956,7 +2030,7 @@ window slightly too large. If you find a bug, please report it to .Aq derf+feh@finalrewind.org or via -.Aq http://github.com/derf/feh/issues . +.Aq https://github.com/derf/feh/issues . You are also welcome to direct any feh-related comments/questions/... to #feh on irc.oftc.net. . @@ -2026,4 +2100,4 @@ Tom Gilbert .Pp . See also: -http://feh.finalrewind.org +https://feh.finalrewind.org diff --git a/man/gen-cam-menu.pre b/man/gen-cam-menu.pre deleted file mode 100644 index 18064f1..0000000 --- a/man/gen-cam-menu.pre +++ /dev/null @@ -1,33 +0,0 @@ -.Dd $DATE$ -.Dt GEN-CAM-MENU 1 -.Os -. -.Sh NAME -.Nm gen-cam-menu -.Nd utility for updating Enlightenment user menus for feh-cam -.Sh SYNOPSIS -.Nm -. -.Sh VERSION -This manual documents gen-cam-menu, shipped with feh version $VERSION$ -. -.Sh DEPRECATION WARNING -. -This tool will be removed from the feh distribution by 2013. -. -.Pp -. -If you still use it, please contact me at -.Aq derf@finalrewind.org -. -.Sh DESCRIPTION -.Nm -is a shell script which creates Enlightenment user menu entries for the -bookmarks stored by -.Xr feh-cam 1 -in -.Pa ~/.enlightenment/ . -. -.Sh SEE ALSO -.Xr feh 1 , -.Xr feh-cam 1 diff --git a/share/applications/feh.pre b/share/applications/feh.pre index 8eb592a..e5efc5b 100644 --- a/share/applications/feh.pre +++ b/share/applications/feh.pre @@ -3,8 +3,8 @@ Name=Feh Name[en_US]=feh GenericName=Image viewer GenericName[en_US]=Image viewer -Comment=Fast Imlib2-based Image Viewer -Exec=feh %U +Comment=Image viewer and cataloguer +Exec=feh --start-at %f Terminal=false Type=Application Icon=feh diff --git a/share/images/menubg_aluminium.png b/share/images/menubg_aluminium.png Binary files differdeleted file mode 100644 index eed00f1..0000000 --- a/share/images/menubg_aluminium.png +++ /dev/null diff --git a/share/images/menubg_aqua.png b/share/images/menubg_aqua.png Binary files differdeleted file mode 100644 index 3a72590..0000000 --- a/share/images/menubg_aqua.png +++ /dev/null diff --git a/share/images/menubg_black.png b/share/images/menubg_black.png Binary files differdeleted file mode 100644 index 08b4c2b..0000000 --- a/share/images/menubg_black.png +++ /dev/null diff --git a/share/images/menubg_brushed.png b/share/images/menubg_brushed.png Binary files differdeleted file mode 100644 index 32fad47..0000000 --- a/share/images/menubg_brushed.png +++ /dev/null diff --git a/share/images/menubg_sky.png b/share/images/menubg_sky.png Binary files differdeleted file mode 100644 index e0be8ca..0000000 --- a/share/images/menubg_sky.png +++ /dev/null diff --git a/src/Makefile b/src/Makefile index 8a9f97e..ac4d2fe 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,7 +1,6 @@ include ../config.mk TARGETS = \ - collage.c \ events.c \ feh_png.c \ filelist.c \ diff --git a/src/collage.c b/src/collage.c deleted file mode 100644 index 2a4d9f9..0000000 --- a/src/collage.c +++ /dev/null @@ -1,208 +0,0 @@ -/* collage.c - -Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2018 Daniel Friesel. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies of the Software and its documentation and acknowledgment shall be -given in the documentation and software packages that this Software was -used. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -*/ - -#include "feh.h" -#include "winwidget.h" -#include "filelist.h" -#include "options.h" - -void init_collage_mode(void) -{ - Imlib_Image im_main; - Imlib_Image im_temp; - int ww, hh, www, hhh, xxx, yyy; - int w = 800, h = 600; - int bg_w = 0, bg_h = 0; - winwidget winwid = NULL; - Imlib_Image bg_im = NULL, im_thumb = NULL; - feh_file *file = NULL; - unsigned char trans_bg = 0; - gib_list *l, *last = NULL; - - mode = "collage"; - - weprintf("the --collage option (aka collage mode) is deprecated\n" - "and will be removed soon\n"); - - /* Use bg image dimensions for default size */ - if (opt.bg && opt.bg_file) { - if (!strcmp(opt.bg_file, "trans")) - trans_bg = 1; - else { - - D(("Time to apply a background to blend onto\n")); - if (feh_load_image_char(&bg_im, opt.bg_file) != 0) { - bg_w = gib_imlib_image_get_width(bg_im); - bg_h = gib_imlib_image_get_height(bg_im); - } - } - } - - if (!opt.limit_w || !opt.limit_h) { - if (bg_im) { - if (opt.verbose) - fputs(PACKAGE - ": No size restriction specified for collage.\n" - " You did specify a background however, so the\n" - " collage size has defaulted to the size of the image\n", - stderr); - opt.limit_w = bg_w; - opt.limit_h = bg_h; - } else { - if (opt.verbose) - fputs(PACKAGE - ": No size restriction specified for collage.\n" - " - For collage mode, you need to specify width and height.\n" - " Using defaults (width 800, height 600)\n", - stderr); - opt.limit_w = 800; - opt.limit_h = 600; - } - } - - w = opt.limit_w; - h = opt.limit_h; - D(("Limiting width to %d and height to %d\n", w, h)); - - im_main = imlib_create_image(w, h); - - if (!im_main) - eprintf("Imlib error creating image"); - - if (bg_im) - gib_imlib_blend_image_onto_image(im_main, bg_im, - gib_imlib_image_has_alpha(bg_im), 0, 0, - bg_w, bg_h, 0, 0, w, h, 1, 0, 0); - else if (trans_bg) { - gib_imlib_image_fill_rectangle(im_main, 0, 0, w, h, 0, 0, 0, 0); - gib_imlib_image_set_has_alpha(im_main, 1); - } else { - /* Colour the background */ - gib_imlib_image_fill_rectangle(im_main, 0, 0, w, h, 0, 0, 0, 255); - } - - if (opt.display) { - winwid = winwidget_create_from_image(im_main, WIN_TYPE_SINGLE); - winwidget_rename(winwid, PACKAGE " [collage mode]"); - winwidget_show(winwid); - } - - for (l = filelist; l; l = l->next) { - file = FEH_FILE(l->data); - if (last) { - filelist = feh_file_remove_from_list(filelist, last); - last = NULL; - } - D(("About to load image %s\n", file->filename)); - if (feh_load_image(&im_temp, file) != 0) { - D(("Successfully loaded %s\n", file->filename)); - if (opt.verbose) - feh_display_status('.'); - www = opt.thumb_w; - hhh = opt.thumb_h; - ww = gib_imlib_image_get_width(im_temp); - hh = gib_imlib_image_get_height(im_temp); - - if (opt.aspect) { - double ratio = 0.0; - - /* Keep the aspect ratio for the thumbnail */ - ratio = ((double) ww / hh) / ((double) www / hhh); - - if (ratio > 1.0) - hhh = opt.thumb_h / ratio; - else if (ratio != 1.0) - www = opt.thumb_w * ratio; - } - - if ((!opt.stretch) && ((www > ww) || (hhh > hh))) { - /* Don't make the image larger unless stretch is specified */ - www = ww; - hhh = hh; - } - - /* pick random coords for thumbnail */ - xxx = ((w - www) * ((double) rand() / RAND_MAX)); - yyy = ((h - hhh) * ((double) rand() / RAND_MAX)); - D(("image going on at x=%d, y=%d\n", xxx, yyy)); - - im_thumb = gib_imlib_create_cropped_scaled_image(im_temp, - 0, 0, ww, hh, www, hhh, 1); - gib_imlib_free_image_and_decache(im_temp); - - if (opt.alpha) { - DATA8 atab[256]; - - D(("Applying alpha options\n")); - gib_imlib_image_set_has_alpha(im_thumb, 1); - memset(atab, opt.alpha_level, sizeof(atab)); - gib_imlib_apply_color_modifier_to_rectangle(im_thumb, - 0, 0, www, hhh, NULL, NULL, NULL, atab); - } - gib_imlib_blend_image_onto_image(im_main, im_thumb, - gib_imlib_image_has_alpha(im_thumb), 0, 0, www, hhh, xxx, - yyy,www, hhh, 1, gib_imlib_image_has_alpha(im_thumb), 0); - gib_imlib_free_image_and_decache(im_thumb); - } else { - last = l; - if (opt.verbose) - feh_display_status('x'); - } - if (opt.display) { - winwidget_render_image(winwid, 0, 0); - if (!feh_main_iteration(0)) - exit(0); - } - } - if (opt.verbose) - fputs("\n", stderr); - - if (opt.output && opt.output_file) { - char output_buf[1024]; - if (opt.output_dir) - snprintf(output_buf, 1024, "%s/%s", opt.output_dir, opt.output_file); - else { - strncpy(output_buf, opt.output_file, 1023); - output_buf[1023] = '\0'; - } - gib_imlib_save_image(im_main, output_buf); - if (opt.verbose) { - int tw, th; - - tw = gib_imlib_image_get_width(im_main); - th = gib_imlib_image_get_height(im_main); - fprintf(stderr, PACKAGE ": File saved as %s\n", output_buf); - fprintf(stderr, - " - Image is %dx%d pixels and contains %d thumbnails\n", - tw, th, (tw / opt.thumb_w) * (th / opt.thumb_h)); - } - } - - if (!opt.display) - gib_imlib_free_image_and_decache(im_main); - - return; -} @@ -132,7 +132,6 @@ void init_xinerama(void); #endif /* HAVE_LIBXINERAMA */ void init_multiwindow_mode(void); void init_thumbnail_mode(void); -void init_collage_mode(void); void init_index_mode(void); void init_slideshow_mode(void); void init_list_mode(void); diff --git a/src/filelist.c b/src/filelist.c index 870e463..e3ae020 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -30,6 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "feh.h" #include "filelist.h" +#include "signals.h" #include "options.h" gib_list *filelist = NULL; @@ -327,6 +328,10 @@ gib_list *feh_file_info_preload(gib_list * list) feh_display_status('s'); } else if (opt.verbose) feh_display_status('.'); + if (sig_exit) { + feh_display_status(0); + exit(sig_exit); + } } if (opt.verbose) feh_display_status(0); @@ -486,7 +491,7 @@ void feh_prepare_filelist(void) * we can create a properly sized thumbnail list. */ if (opt.list || opt.preload || opt.customlist || (opt.sort > SORT_MTIME) - || (opt.filter_by_dimensions && (opt.index || opt.collage || opt.thumbs || opt.bgmode))) { + || (opt.filter_by_dimensions && (opt.index || opt.thumbs || opt.bgmode))) { /* For these sort options, we have to preload images */ filelist = feh_file_info_preload(filelist); if (!gib_list_length(filelist)) diff --git a/src/gib_imlib.c b/src/gib_imlib.c index 8f401aa..7858cb7 100644 --- a/src/gib_imlib.c +++ b/src/gib_imlib.c @@ -717,3 +717,15 @@ void gib_imlib_image_orientate(Imlib_Image im, int orientation) imlib_context_set_image(im); imlib_image_orientate(orientation); } + +void gib_imlib_image_flip_horizontal(Imlib_Image im) +{ + imlib_context_set_image(im); + imlib_image_flip_horizontal(); +} + +void gib_imlib_image_flip_vertical(Imlib_Image im) +{ + imlib_context_set_image(im); + imlib_image_flip_vertical(); +} diff --git a/src/gib_imlib.h b/src/gib_imlib.h index 6a16a0c..07daabe 100644 --- a/src/gib_imlib.h +++ b/src/gib_imlib.h @@ -181,6 +181,8 @@ void gib_imlib_parse_color(char *col, int *r, int *g, int *b, int *a); void gib_imlib_parse_fontpath(char *path); Imlib_Font gib_imlib_load_font(char *name); void gib_imlib_image_orientate(Imlib_Image im, int orientation); +void gib_imlib_image_flip_horizontal(Imlib_Image im); +void gib_imlib_image_flip_vertical(Imlib_Image im); #ifdef __cplusplus } diff --git a/src/gib_list.c b/src/gib_list.c index 5384d98..a8ba1dd 100644 --- a/src/gib_list.c +++ b/src/gib_list.c @@ -362,7 +362,7 @@ gib_list_randomize(gib_list * list) } for (i = 0; i < len - 1; i++) { - r = i + rand() / (RAND_MAX / (len - i) + 1 ); + r = i + random() / (RAND_MAX / (len - i) + 1 ); t = farray[r]; farray[r] = farray[i]; farray[i] = t; diff --git a/src/help.raw b/src/help.raw index 2532325..7a9a658 100644 --- a/src/help.raw +++ b/src/help.raw @@ -35,6 +35,7 @@ OPTIONS -d, --draw-filename Show the filename in the image window --draw-tinted Show overlay texts on semi-transparent background --draw-exif Show some Exif information (if compiled with exif=1) + --edit Make flip/rotation keys flip/rotate the underlying file --auto-rotate Rotate images according to Exif info (if compiled with exif=1) -^, --title TITLE Set window title (see FORMAT SPECIFIERS) -D, --slideshow-delay NUM Set delay between automatically changing slides @@ -87,12 +88,13 @@ OPTIONS -M, --menu-font FONT Use FONT for the font in menus. -B, --image-bg STYLE Set background for transparent images and the like. Accepted values: default, checks, or a XColor (eg. #428bdd) + --xinerama-index I Assumee that I is the active xinerama screen -N, --no-menus Don't load or show any menus. --no-xinerama Disable Xinerama support --no-screen-clip Do not limit window size to screen size -Y, --hide-pointer Hide the pointer - --magick-timeout INT Load unknown files with ImageMagick, timeout after - INT seconds (0: no timeout) + --conversion-timeout INT Load unknown files with dcraw or ImageMagick, + timeout after INT seconds (0: no timeout) --min-dimension WxH Only show images with width >= W and height >= H --max-dimension WxH Only show images with width <= W and height <= H --scroll-step COUNT scroll COUNT pixels when movement key is pressed @@ -124,13 +126,14 @@ INDEX MODE OPTIONS FORMAT SPECIFIERS %f image path/filename %F image path/filename (shell-escaped) + %g window dimensions (\"width,height\") in pixels %h image height %l total number of files in the filelist %L path to temporary copy of filelist %m current mode (slideshow, multiwindow...) %n image name %N image name (shell-escaped) - %o x,y offset of top-left image corner to window in pixels + %o offset of top-left image corner to window (\"x,y\") in pixels %p image pixel size %P image pixel size in kilo-/megapixels %r image rotation. half right turn == 3.1415 (pi) @@ -141,34 +144,39 @@ FORMAT SPECIFIERS %w image width %v " PACKAGE " version %V process ID - %z current image zoom + %z current image zoom, rounded to two decimal places + %Z current image zoom, high precision %% % \\n newline -KEYS +DEFAULT KEYS a Toggle action display (--draw-actions) A Toggle anti-aliasing c Enable caption entry mode d Toggle filename display (--draw-filename) e Toggle exif tag display (if compiled with exif=1) - f Save current filelist to unique filename + f Toggle fullscreen + g Toggle fixed geometry mode h pause/continue slideshow i Toggle --info display k Toggle zoom/viewport freeze when switching images - m Show menu + L Save current filelist to unique filename + m Show/hide menu n, <SPACE>, <RIGHT> Go to next image o Toggle pointer visibility p, <BACKSPACE>, <LEFT> Go to previous image q, <ESCAPE> Quit r Reload image + R Render/anti-alias image s Save current image to unique filename - v Toggle fullscreen w Resize window to current image dimensions x Close current window z Jump to a random position in the current filelist - <, > In place editing, rotate 90 degrees right/left - _ In place editing, vertical flip - | In place editing, horizontal flip + Z Toggle auto-zoom + [, ] Jump to previous/next directory + <, > Rotate 90 degrees right/left + _ Vertical flip + | Horizontal flip 0, <ENTER> Run action specified by --action option 1-9 Run action 1-9 specified by --action[1-9] options <HOME> Go to first slide @@ -192,7 +200,7 @@ KEYS This program is free software, see the file COPYING for licensing info. Copyright Tom Gilbert (and various contributors) 1999-2003. -Copyright Daniel Friesel (and various contributors) 2010-2016. +Copyright Daniel Friesel (and various contributors) 2010-2018. Homepage: http://feh.finalrewind.org Report bugs to <derf+feh@finalrewind.org> or #feh on irc.oftc.net. diff --git a/src/imlib.c b/src/imlib.c index f41cdcd..4d2f2fa 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -26,6 +26,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "feh.h" #include "filelist.h" +#include "signals.h" #include "winwidget.h" #include "options.h" @@ -294,10 +295,22 @@ int feh_load_image(Imlib_Image * im, feh_file * file) } file->ed = exifData; - if (orientation == 3) + if (orientation == 2) + gib_imlib_image_flip_horizontal(*im); + else if (orientation == 3) gib_imlib_image_orientate(*im, 2); + else if (orientation == 4) + gib_imlib_image_flip_vertical(*im); + else if (orientation == 5) { + gib_imlib_image_orientate(*im, 3); + gib_imlib_image_flip_vertical(*im); + } else if (orientation == 6) gib_imlib_image_orientate(*im, 1); + else if (orientation == 7) { + gib_imlib_image_orientate(*im, 3); + gib_imlib_image_flip_horizontal(*im); + } else if (orientation == 8) gib_imlib_image_orientate(*im, 3); #endif @@ -529,6 +542,24 @@ static char *feh_magick_load_image(char *filename) #ifdef HAVE_LIBCURL +static int curl_quit_function(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) +{ + // ignore "unused parameter" warnings + (void)clientp; + (void)dltotal; + (void)dlnow; + (void)ultotal; + (void)ulnow; + if (sig_exit) { + /* + * The user wants to quit feh. Tell libcurl to abort the transfer and + * return control to the main loop, where we can quit gracefully. + */ + return 1; + } + return 0; +} + static char *feh_http_load_image(char *url) { CURL *curl; @@ -571,12 +602,21 @@ static char *feh_http_load_image(char *url) #ifdef DEBUG curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); #endif + /* + * Do not allow requests to take longer than 30 minutes. + * This should be sufficiently high to accomodate use cases with + * unusually high latencies, while at the sime time avoiding + * feh hanging indefinitely in unattended slideshows. + */ + curl_easy_setopt(curl, CURLOPT_TIMEOUT, 1800); curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_WRITEDATA, sfp); ebuff = emalloc(CURL_ERROR_SIZE); curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, ebuff); curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); + curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, curl_quit_function); + curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0); if (opt.insecure_ssl) { curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); @@ -589,7 +629,9 @@ static char *feh_http_load_image(char *url) res = curl_easy_perform(curl); curl_easy_cleanup(curl); if (res != CURLE_OK) { - weprintf("open url: %s", ebuff); + if (res != CURLE_ABORTED_BY_CALLBACK) { + weprintf("open url: %s", ebuff); + } unlink(sfn); close(fd); free(sfn); @@ -1192,6 +1234,26 @@ void feh_edit_inplace(winwidget w, int op) if (!w->file || !w->file->data || !FEH_FILE(w->file->data)->filename) return; + if (!opt.edit) { + imlib_context_set_image(w->im); + if (op == INPLACE_EDIT_FLIP) + imlib_image_flip_vertical(); + else if (op == INPLACE_EDIT_MIRROR) + imlib_image_flip_horizontal(); + else { + imlib_image_orientate(op); + tmp = w->im_w; + w->im_w = w->im_h; + w->im_h = tmp; + if (FEH_FILE(w->file->data)->info) { + FEH_FILE(w->file->data)->info->width = w->im_w; + FEH_FILE(w->file->data)->info->height = w->im_h; + } + } + winwidget_render_image(w, 1, 0); + return; + } + if (!strcmp(gib_imlib_image_format(w->im), "jpeg") && !path_is_url(FEH_FILE(w->file->data)->filename)) { feh_edit_inplace_lossless(w, op); @@ -1229,8 +1291,12 @@ void feh_edit_inplace(winwidget w, int op) else { imlib_image_orientate(op); tmp = w->im_w; - FEH_FILE(w->file->data)->info->width = w->im_w = w->im_h; - FEH_FILE(w->file->data)->info->height = w->im_h = tmp; + w->im_w = w->im_h; + w->im_h = tmp; + if (FEH_FILE(w->file->data)->info) { + FEH_FILE(w->file->data)->info->width = w->im_w; + FEH_FILE(w->file->data)->info->height = w->im_h; + } } im_weprintf(w, "unable to edit in place. Changes have not been saved."); winwidget_render_image(w, 1, 0); diff --git a/src/keyevents.c b/src/keyevents.c index 689aebd..6c2f06e 100644 --- a/src/keyevents.c +++ b/src/keyevents.c @@ -195,10 +195,10 @@ void init_keyevents(void) { feh_set_kb("toggle_caption" , 0, XK_c, 0, 0, 0, 0); feh_set_kb("toggle_pause" , 0, XK_h, 0, 0, 0, 0); feh_set_kb("toggle_menu" , 0, XK_m, 0, 0, 0, 0); - feh_set_kb("toggle_fullscreen" , 0, XK_v, 0, 0, 0, 0); + feh_set_kb("toggle_fullscreen" , 0, XK_f, 0, 0, 0, 0); feh_set_kb("reload_image" , 0, XK_r, 0, 0, 0, 0); feh_set_kb("save_image" , 0, XK_s, 0, 0, 0, 0); - feh_set_kb("save_filelist" , 0, XK_f, 0, 0, 0, 0); + feh_set_kb("save_filelist" , 0, XK_L, 0, 0, 0, 0); feh_set_kb("orient_1" , 0, XK_greater, 0, 0, 0, 0); feh_set_kb("orient_3" , 0, XK_less, 0, 0, 0, 0); feh_set_kb("flip" , 0, XK_underscore, 0, 0, 0, 0); @@ -686,7 +686,7 @@ void feh_event_handle_generic(winwidget winwid, unsigned int state, KeySym keysy } else if (feh_is_kp(EVENT_jump_random, state, keysym, button)) { if (winwid->type == WIN_TYPE_THUMBNAIL) - feh_thumbnail_select_next(winwid, rand() % (filelist_len - 1)); + feh_thumbnail_select_next(winwid, random() % (filelist_len - 1)); else slideshow_change_image(winwid, SLIDE_RAND, 1); } @@ -46,7 +46,7 @@ int main(int argc, char **argv) { atexit(feh_clean_exit); - srand(getpid() * time(NULL) % ((unsigned int) -1)); + srandom(getpid() * time(NULL) % ((unsigned int) -1)); setup_signal_handlers(); init_parse_options(argc, argv); @@ -72,8 +72,6 @@ int main(int argc, char **argv) if (opt.index) init_index_mode(); - else if (opt.collage) - init_collage_mode(); else if (opt.multiwindow) init_multiwindow_mode(); else if (opt.list || opt.customlist) @@ -205,7 +203,7 @@ int feh_main_iteration(int block) && ((errno == ENOMEM) || (errno == EINVAL) || (errno == EBADF))) eprintf("Connection to X display lost"); - if ((ft) && (count == 0)) { + if (count == 0) { /* This means the timer is due to be executed. If count was > 0, that would mean an X event had woken us, we're not interested in that */ @@ -246,7 +244,6 @@ void feh_clean_exit(void) { delete_rm_files(); - free(opt.menu_bg); free(opt.menu_font); #ifdef HAVE_INOTIFY @@ -134,7 +134,7 @@ feh_menu *feh_menu_new(void) menus = l; if (!bg) { - feh_load_image_char(&bg, opt.menu_bg); + feh_load_image_char(&bg, PREFIX "/share/feh/images/menubg_default.png"); if (bg) { border.left = border.right = border.top = border.bottom = 4; diff --git a/src/options.c b/src/options.c index 364fb42..2a5aae8 100644 --- a/src/options.c +++ b/src/options.c @@ -61,7 +61,6 @@ void init_parse_options(int argc, char **argv) opt.scroll_step = 20; opt.menu_font = estrdup(DEFAULT_MENU_FONT); opt.font = NULL; - opt.menu_bg = estrdup(PREFIX "/share/feh/images/menubg_default.png"); opt.max_height = opt.max_width = UINT_MAX; opt.start_list_at = NULL; @@ -131,6 +130,7 @@ static void feh_load_options_for_theme(char *theme) char *rcpath = NULL; char *oldrcpath = NULL; char *confbase = getenv("XDG_CONFIG_HOME"); + // s, s1 and s2 must always have identical size char s[1024], s1[1024], s2[1024]; int cont = 0; int bspos; @@ -167,11 +167,19 @@ static void feh_load_options_for_theme(char *theme) s2[0] = '\0'; if (cont) { + /* + * fgets ensures that s contains no more than 1023 characters + * (+ 1 null byte) + */ sscanf(s, " %[^\n]\n", (char *) &s2); if (!*s2) break; D(("Got continued options %s\n", s2)); } else { + /* + * fgets ensures that s contains no more than 1023 characters + * (+ 1 null byte) + */ sscanf(s, "%s %[^\n]\n", (char *) &s1, (char *) &s2); if (!(*s1) || (!*s2) || (*s1 == '\n') || (*s1 == '#')) { cont = 0; @@ -313,12 +321,11 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) { int discard; static char stropts[] = - "a:A:b:B:cC:dD:e:E:f:Fg:GhH:iIj:J:kK:lL:mM:nNo:O:pPqrR:sS:tT:uUvVwW:xXy:YzZ" - ".@:^:~:):|:+:<:>:"; + "a:A:b:B:C:dD:e:E:f:Fg:GhH:iIj:J:kK:lL:mM:nNo:O:pPqrR:sS:tT:uUvVwW:xXy:YzZ" + ".@:^:~:|:+:<:>:"; /* (*name, has_arg, *flag, val) See: struct option in getopts.h */ static struct option lopts[] = { - {"menu-bg" , 1, 0, ')'}, {"debug" , 0, 0, '+'}, {"scale-down" , 0, 0, '.'}, {"max-dimension" , 1, 0, '<'}, @@ -353,7 +360,6 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) {"title" , 1, 0, '^'}, {"alpha" , 1, 0, 'a'}, {"bg" , 1, 0, 'b'}, - {"collage" , 0, 0, 'c'}, {"draw-filename" , 0, 0, 'd'}, {"font" , 1, 0, 'e'}, {"filelist" , 1, 0, 'f'}, @@ -398,11 +404,11 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) {"bg-fill" , 0, 0, 218}, {"bg-max" , 0, 0, 219}, {"no-jump-on-resort", 0, 0, 220}, + {"edit" , 0, 0, 221}, #ifdef HAVE_LIBEXIF {"draw-exif" , 0, 0, 223}, {"auto-rotate" , 0, 0, 242}, #endif - {"cycle-once" , 0, 0, 224}, {"no-xinerama" , 0, 0, 225}, {"draw-tinted" , 0, 0, 229}, {"info" , 1, 0, 234}, @@ -430,11 +436,6 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) switch (optch) { case 0: break; - case ')': - free(opt.menu_bg); - opt.menu_bg = estrdup(optarg); - weprintf("The --menu-bg option is deprecated and will be removed by 2012"); - break; case '+': opt.debug = 1; break; @@ -471,6 +472,8 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) if (opt.slideshow_delay < 0.0) { opt.slideshow_delay *= (-1); opt.paused = 1; + } else { + opt.paused = 0; } break; case 'E': @@ -580,9 +583,6 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) opt.bg = 1; opt.bg_file = estrdup(optarg); break; - case 'c': - opt.collage = 1; - break; case 'd': opt.draw_filename = 1; break; @@ -736,6 +736,9 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) case 220: opt.jump_on_resort = 0; break; + case 221: + opt.edit = 1; + break; #ifdef HAVE_LIBEXIF case 223: opt.draw_exif = 1; @@ -744,10 +747,6 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) opt.auto_rotate = 1; break; #endif - case 224: - weprintf("--cycle-once is deprecated, please use --on-last-slide=quit instead"); - opt.on_last_slide = ON_LAST_SLIDE_QUIT; - break; case 225: opt.xinerama = 0; break; @@ -756,10 +755,12 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) break; case 234: opt.info_cmd = estrdup(optarg); - if (opt.info_cmd[0] == ';') + if (opt.info_cmd[0] == ';') { + opt.draw_info = 0; opt.info_cmd++; - else + } else { opt.draw_info = 1; + } break; case 235: opt.force_aliasing = 1; @@ -831,8 +832,19 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) add_file_to_filelist_recursively(argv[optind++], FILELIST_FIRST); } } - else if (finalrun && !opt.filelistfile && !opt.bgmode) - add_file_to_filelist_recursively(".", FILELIST_FIRST); + else if (finalrun && !opt.filelistfile && !opt.bgmode) { + if (opt.start_list_at && !path_is_url(opt.start_list_at) && strrchr(opt.start_list_at, '/')) { + char *target_directory = estrdup(opt.start_list_at); + char *filename_start = strrchr(target_directory, '/'); + if (filename_start) { + *filename_start = '\0'; + } + add_file_to_filelist_recursively(target_directory, FILELIST_FIRST); + free(target_directory); + } else { + add_file_to_filelist_recursively(".", FILELIST_FIRST); + } + } /* So that we can safely be called again */ optind = 0; @@ -860,17 +872,11 @@ static void check_options(void) } } - if ((opt.index + opt.collage) > 1) { - weprintf("you can't use collage mode and index mode together.\n" - " I'm going with index"); - opt.collage = 0; - } - if (opt.full_screen && opt.multiwindow) { eprintf("You cannot combine --fullscreen with --multiwindow"); } - if (opt.list && (opt.multiwindow || opt.index || opt.collage)) { + if (opt.list && (opt.multiwindow || opt.index)) { eprintf("You cannot combine --list with other modes"); } @@ -910,6 +916,10 @@ static void show_version(void) "stat64 " #endif +#ifdef HAVE_VERSCMP + "verscmp " +#endif + #ifdef HAVE_LIBXINERAMA "xinerama " #endif diff --git a/src/options.h b/src/options.h index cae04ec..883c8e2 100644 --- a/src/options.h +++ b/src/options.h @@ -36,7 +36,6 @@ enum on_last_slide_action { struct __fehoptions { unsigned char multiwindow; unsigned char montage; - unsigned char collage; unsigned char index; unsigned char thumbs; unsigned char slideshow; @@ -85,6 +84,7 @@ struct __fehoptions { unsigned char keep_zoom_vp; unsigned char insecure_ssl; unsigned char filter_by_dimensions; + unsigned char edit; char *output_file; char *output_dir; @@ -100,7 +100,6 @@ struct __fehoptions { char *filelistfile; char *menu_font; char *customlist; - char *menu_bg; char *caption_path; char *start_list_at; char *info_cmd; diff --git a/src/signals.c b/src/signals.c index aeaf889..85d81bc 100644 --- a/src/signals.c +++ b/src/signals.c @@ -24,11 +24,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "feh.h" +#include "filelist.h" #include "winwidget.h" #include "options.h" void feh_handle_signal(int); -int sig_exit = 0; +volatile int sig_exit = 0; void setup_signal_handlers() { @@ -94,10 +95,14 @@ void feh_handle_signal(int signo) winwid = winwidget_get_first_window_of_type(WIN_TYPE_SLIDESHOW); if (winwid) { - if (signo == SIGUSR1) - slideshow_change_image(winwid, SLIDE_NEXT, 1); - else if (signo == SIGUSR2) - slideshow_change_image(winwid, SLIDE_PREV, 1); + if (filelist_len > 1) { + if (signo == SIGUSR1) + slideshow_change_image(winwid, SLIDE_NEXT, 1); + else if (signo == SIGUSR2) + slideshow_change_image(winwid, SLIDE_PREV, 1); + } else { + feh_reload_image(winwid, 0, 0); + } } else if (opt.multiwindow) { for (i = window_num - 1; i >= 0; i--) feh_reload_image(windows[i], 0, 0); diff --git a/src/signals.h b/src/signals.h index 090ab0b..bff737e 100644 --- a/src/signals.h +++ b/src/signals.h @@ -27,5 +27,5 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define SIGNALS_H void setup_signal_handlers(); -extern int sig_exit; +extern volatile int sig_exit; #endif diff --git a/src/slideshow.c b/src/slideshow.c index 3770677..145ced1 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -37,6 +37,24 @@ void init_slideshow_mode(void) int success = 0; gib_list *l = filelist, *last = NULL; + /* + * In theory, --start-at FILENAME is simple: Look for a file called + * FILENAME, start the filelist there, done. + * + * In practice, there are cases where this isn't sufficient. For instance, + * a user running 'feh --start-at hello.jpg /tmp' will expect feh to start + * at /tmp/hello.jpg, as if they had used + * 'feh --start-at /tmp/hello.jpg /tmp'. Similarly, XDG Desktop files + * may lead to the invocation 'feh --start-at /tmp/hello.jpg .' in /tmp, + * expecting the behaviour of 'feh --start-at ./hello.jpg .'. + * + * Since a good user experience is not about being technically correct, but + * about delivering the expected behaviour, we do some fuzzy matching + * here. In the worst case, this will cause --start-at to start at the + * wrong file. + */ + + // Try finding an exact filename match first for (; l && opt.start_list_at; l = l->next) { if (!strcmp(opt.start_list_at, FEH_FILE(l->data)->filename)) { opt.start_list_at = NULL; @@ -44,6 +62,34 @@ void init_slideshow_mode(void) } } + /* + * If it didn't work (opt.start_list_at is still set): Fall back to + * comparing just the filenames without directory prefixes. This may lead + * to false positives, but for now that's just the way it is. + */ + if (opt.start_list_at) { + char *current_filename; + char *start_at_filename = strrchr(opt.start_list_at, '/'); + if (start_at_filename) { + start_at_filename++; // We only care about the part after the '/' + } else { + start_at_filename = opt.start_list_at; + } + for (l = filelist; l && opt.start_list_at; l = l->next) { + current_filename = strrchr(FEH_FILE(l->data)->filename, '/'); + if (current_filename) { + current_filename++; // We only care about the part after the '/' + } else { + current_filename = FEH_FILE(l->data)->filename; + } + if (!strcmp(start_at_filename, current_filename)) { + opt.start_list_at = NULL; + break; + } + } + } + + // If that didn't work either, we're out of luck. if (opt.start_list_at) eprintf("--start-at %s: File not found in filelist", opt.start_list_at); @@ -258,7 +304,7 @@ void slideshow_change_image(winwidget winwid, int change, int render) case SLIDE_RAND: if (filelist_len > 1) { current_file = feh_list_jump(filelist, current_file, FORWARD, - (rand() % (filelist_len - 1)) + 1); + (random() % (filelist_len - 1)) + 1); change = SLIDE_NEXT; } break; @@ -615,16 +661,24 @@ void slideshow_save_image(winwidget win) { char *tmpname; Imlib_Load_Error err; + char *base_dir = ""; + if (opt.output_dir) { + base_dir = estrjoin("", opt.output_dir, "/", NULL); + } if (win->file) { - tmpname = feh_unique_filename("", FEH_FILE(win->file->data)->name); + tmpname = feh_unique_filename(base_dir, FEH_FILE(win->file->data)->name); } else if (mode) { char *tmp; tmp = estrjoin(".", mode, "png", NULL); - tmpname = feh_unique_filename("", tmp); + tmpname = feh_unique_filename(base_dir, tmp); free(tmp); } else { - tmpname = feh_unique_filename("", "noname.png"); + tmpname = feh_unique_filename(base_dir, "noname.png"); + } + + if (opt.output_dir) { + free(base_dir); } if (opt.verbose) diff --git a/src/utils.c b/src/utils.c index ec30d4a..087e7f6 100644 --- a/src/utils.c +++ b/src/utils.c @@ -152,6 +152,7 @@ char path_is_url(char *path) { return 0; } +/* Note: path must end with a trailing / or be an empty string */ /* free the result please */ char *feh_unique_filename(char *path, char *basename) { diff --git a/src/wallpaper.c b/src/wallpaper.c index db14a8c..9df259f 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -252,7 +252,7 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, XGCValues gcval; GC gc; char bgname[20]; - int num = (int) rand(); + int num = (int) random(); char bgfil[4096]; char sendbuf[4096]; @@ -502,15 +502,16 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, } fputc(' ', fp); if (use_filelist) { - for (int i = 0; i < cmdargc; i++) { - if (filelist_pos && !strcmp(FEH_FILE(filelist_pos->data)->filename, cmdargv[i])) { - /* argument is a file */ - absolute_path = feh_absolute_path(cmdargv[i]); - fputs(shell_escape(absolute_path), fp); - filelist_pos = filelist_pos->next; - free(absolute_path); - fputc(' ', fp); - } +#ifdef HAVE_LIBXINERAMA + for (int i = 0; (i < opt.xinerama ? num_xinerama_screens : 1) && filelist_pos; i++) { +#else + for (int i = 0; (i < 1 ) && filelist_pos; i++) { +#endif + absolute_path = feh_absolute_path(FEH_FILE(filelist_pos->data)->filename); + fputs(shell_escape(absolute_path), fp); + filelist_pos = filelist_pos->next; + free(absolute_path); + fputc(' ', fp); } } else if (fil) { absolute_path = feh_absolute_path(fil); diff --git a/src/winwidget.c b/src/winwidget.c index 4993fb6..020ee5b 100644 --- a/src/winwidget.c +++ b/src/winwidget.c @@ -211,7 +211,6 @@ void winwidget_create_window(winwidget ret, int w, int h) } if (opt.paused) { - printf("name %s\n", ret->name); tmpname = estrjoin(" ", ret->name, "[Paused]", NULL); free(ret->name); ret->name = tmpname; @@ -821,8 +820,6 @@ void winwidget_show(winwidget winwid) void winwidget_move(winwidget winwid, int x, int y) { if (winwid && ((winwid->x != x) || (winwid->y != y))) { - winwid->x = x; - winwid->y = y; winwid->x = (x > scr->width) ? scr->width : x; winwid->y = (y > scr->height) ? scr->height : y; XMoveWindow(disp, winwid->win, winwid->x, winwid->y); diff --git a/test/feh-i.t b/test/feh-i.t index ff247a2..24775e3 100755 --- a/test/feh-i.t +++ b/test/feh-i.t @@ -138,28 +138,28 @@ SendKeys('{RIG}'); test_win_title( $win, 'feh slideshow 2/3 jpg' ); feh_stop(); -feh_start( '--cycle-once', 'test/ok/png test/ok/jpg' ); +feh_start( '--on-last-slide=quit', 'test/ok/png test/ok/jpg' ); for ( 1 .. 2 ) { SendKeys('{RIG}'); } -test_no_win("--cycle-once -> window closed"); +test_no_win("--on-last-slide=quit -> window closed"); feh_start( - '--cycle-once --slideshow-delay 0.5', + '--on-last-slide=quit --slideshow-delay 0.5', 'test/ok/png test/ok/jpg test/ok/gif' ); sleep(1.5); -test_no_win('cycle-once + slideshow-delay -> window closed'); +test_no_win('on-last-slide=quit + slideshow-delay -> window closed'); $win = feh_start( - '--cycle-once --slideshow-delay -0.01', + '--on-last-slide=quit --slideshow-delay -0.01', 'test/ok/png test/ok/jpg test/ok/gif' ); test_win_title( $win, 'feh [1 of 3] - test/ok/png [Paused]' ); SendKeys('h'); -test_no_win('cycle-once + negative delay + [h]'); +test_no_win('on-last-slide=quit + negative delay + [h]'); $win = feh_start( q{}, 'test/ok/png test/ok/gif test/ok/gif test/ok/jpg' ); for ( 1 .. 2 ) { diff --git a/test/mandoc.t b/test/mandoc.t index 638c5e9..9e7ffc3 100755 --- a/test/mandoc.t +++ b/test/mandoc.t @@ -3,7 +3,7 @@ use strict; use warnings; use 5.010; -use Test::More tests => 3; +use Test::More tests => 1; SKIP: { my $mandoc_present = 0; @@ -17,10 +17,10 @@ SKIP: { if ( not $mandoc_present ) { diag('mandoc not installed, test skipped. This is NOT fatal.'); - skip( 'mandoc not installed', 3 ); + skip( 'mandoc not installed', 1 ); } - for my $file ( 'feh', 'feh-cam', 'gen-cam-menu' ) { + for my $file ('feh') { qx{mandoc -Tlint -Werror man/${file}.1}; is( $?, 0, "${file}.1: Valid mdoc syntax" ); } diff --git a/test/status b/test/status index 2cda6d8..6db362e 100644 --- a/test/status +++ b/test/status @@ -76,15 +76,13 @@ Overall test status, what's covered / missing [x] correct caption display ---collage - --customlist [x] correct output [x] format specifiers ---cycle-once +--on-last-slide=quit [x] closes feh window at end of slideshow [x] combination with --slideshow-delay |