From 71c7ff9ff8eca3008f4b08ef1c4a670b9eb7c7fa Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 30 Jan 2013 13:05:14 +0100 Subject: Add option and keybinding to keep zoom and viewport settings. Patch by sdaau on IRC. Thanks! --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index cca0525..08a028b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +git HEAD + * Add --keep-zoom-vp option to keep zoom and offsets when switching + images (patch by sdaau). Press 'k' to toggle it. + Mon, 24 Dec 2012 15:45:54 +0100 Daniel Friesel * Release v2.8 -- cgit v1.2.3 From e1121600936f8f2753dc214ff71799e218d11fd2 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 31 Jan 2013 11:20:29 +0100 Subject: add a desktop file (closes #98) --- .gitignore | 1 + ChangeLog | 2 ++ Makefile | 18 +++++++++++++++--- config.mk | 1 + share/applications/Makefile | 24 ++++++++++++++++++++++++ share/applications/feh.pre | 10 ++++++++++ 6 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 share/applications/Makefile create mode 100644 share/applications/feh.pre (limited to 'ChangeLog') diff --git a/.gitignore b/.gitignore index bbfa508..3620e7e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +/share/applications/*.desktop /src/deps.mk /src/*.o /src/*.inc diff --git a/ChangeLog b/ChangeLog index 08a028b..29238dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ git HEAD * Add --keep-zoom-vp option to keep zoom and offsets when switching images (patch by sdaau). Press 'k' to toggle it. + * Add --sort mtime option (patch by guns) + * Add a desktop file (installed to share/applications/feh.desktop) Mon, 24 Dec 2012 15:45:54 +0100 Daniel Friesel diff --git a/Makefile b/Makefile index 16c15e2..94d811b 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ include config.mk -all: build-src build-man +all: build-src build-man build-applications build-src: @${MAKE} -C src @@ -8,6 +8,9 @@ build-src: build-man: @${MAKE} -C man +build-applications: + @${MAKE} -C share/applications + test: all @PACKAGE=${PACKAGE} prove test @@ -16,7 +19,7 @@ test-x11: all prove test/feh-bg.i install: install-man install-doc install-bin install-font install-img -install: install-examples +install: install-examples install-applications install-man: @echo installing manuals to ${man_dir} @@ -57,12 +60,19 @@ install-examples: @cp examples/* ${example_dir} @chmod 644 ${example_dir}/* +install-applications: + @echo installing desktop file to ${desktop_dir} + @mkdir -p ${desktop_dir} + @cp share/applications/feh.desktop ${desktop_dir} + @chmod 644 ${desktop_dir}/feh.desktop + uninstall: rm -f ${man_dir}/man1/feh.1 ${man_dir}/man1/feh-cam.1 rm -f ${man_dir}/man1/gen-cam-menu.1 rm -rf ${doc_dir} rm -f ${bin_dir}/feh ${bin_dir}/feh-cam ${bin_dir}/gen-cam-menu + rm -f ${desktop_dir}/feh.desktop rm -rf ${font_dir} rm -rf ${image_dir} @@ -86,6 +96,8 @@ disttest: dist clean: @${MAKE} -C src clean @${MAKE} -C man clean + @${MAKE} -C share/applications clean .PHONY: all test test-x11 install uninstall clean install-man install-doc \ - install-bin install-font install-img install-examples dist + install-bin install-font install-img install-examples \ + install-applications dist diff --git a/config.mk b/config.mk index ffbecfd..d17c0ab 100644 --- a/config.mk +++ b/config.mk @@ -12,6 +12,7 @@ doc_dir = ${main_dir}/share/doc/feh image_dir = ${main_dir}/share/feh/images font_dir = ${main_dir}/share/feh/fonts example_dir = ${main_dir}/share/doc/feh/examples +desktop_dir = ${main_dir}/share/applications # default CFLAGS CFLAGS ?= -g -O2 diff --git a/share/applications/Makefile b/share/applications/Makefile new file mode 100644 index 0000000..5f4da44 --- /dev/null +++ b/share/applications/Makefile @@ -0,0 +1,24 @@ +include ../../config.mk + +SOURCES = ${shell echo *.pre} +TARGETS = ${SOURCES:.pre=.desktop} + +all: ${TARGETS} + +.pre.desktop: + sed \ + -e 's/\$$VERSION\$$/${VERSION}/g' \ + -e 's/\$$DATE\$$/'"$$(date '+%B %d, %Y')"/g \ + -e 's/\$$MAN_CURL\$$/${MAN_CURL}/' \ + -e 's/\$$MAN_DEBUG\$$/${MAN_DEBUG}/' \ + -e 's/\$$MAN_EXIF\$$/${MAN_EXIF}/' \ + -e 's/\$$MAN_XINERAMA\$$/${MAN_XINERAMA}/' \ + -e 's:\$$IMAGEDIR\$$:${image_dir}:' \ + < ${@:.desktop=.pre} > $@ + +clean: + rm -f *.1 + +.SUFFIXES: .pre .desktop + +.PHONY: clean diff --git a/share/applications/feh.pre b/share/applications/feh.pre new file mode 100644 index 0000000..d7b22c7 --- /dev/null +++ b/share/applications/feh.pre @@ -0,0 +1,10 @@ +[Desktop Entry] +Name=Feh +Comment=Fast Imlib2-based Image Viewer +Exec=feh %f +Terminal=false +Type=Application +Icon=$IMAGEDIR$/logo.svg +Categories=Graphics;2DGraphics;Viewer; +MimeType=image/bmp;image/gif;image/jpeg;image/jpg;image/pjpeg;image/png;image/tiff;image/x-bmp;image/x-pcx;image/x-png;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-tga;image/x-xbitmap; +Name[en_US]=feh -- cgit v1.2.3 From 6ea43a3213bb264525e04c729c67204f82c7a2c8 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 1 Feb 2013 17:46:50 +0100 Subject: support "feh -" to read from stdin. closes #118 --- ChangeLog | 1 + man/feh.pre | 4 ++++ src/filelist.c | 5 +++++ src/imlib.c | 40 +++++++++++++++++++++++++++++++++++++++- 4 files changed, 49 insertions(+), 1 deletion(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 29238dd..561abfd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ git HEAD images (patch by sdaau). Press 'k' to toggle it. * Add --sort mtime option (patch by guns) * Add a desktop file (installed to share/applications/feh.desktop) + * Use "feh -" to read image from stdin Mon, 24 Dec 2012 15:45:54 +0100 Daniel Friesel diff --git a/man/feh.pre b/man/feh.pre index cecc58f..a1df25a 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -72,6 +72,10 @@ image in it, the keyboard and mouse can be used to change slides In slideshow mode, images can be deleted either from the filelist or from the disk, the new filelist can then be saved to the disk and reopened at a later time. +An image can also be read from stdin via +.Qq feh - . +However, you should not combine reading from stdin with normal file / filelist +usage. . .Pp . diff --git a/src/filelist.c b/src/filelist.c index 8f3bfe9..3ea0928 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -185,6 +185,11 @@ void add_file_to_filelist_recursively(char *origpath, unsigned char level) /* We'll download it later... */ free(path); return; + } else if ((len == 1) && (path[0] == '-')) { + D(("Addig stdin (-) to filelist\n")); + filelist = gib_list_add_front(filelist, feh_file_new(path)); + free(path); + return; } else if (opt.filelistfile) { char *newpath = feh_absolute_path(path); diff --git a/src/imlib.c b/src/imlib.c index e9f92ad..bdf54ac 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -61,6 +61,7 @@ int num_xinerama_screens; int childpid = 0; +static char *feh_stdin_load_image(); static char *feh_http_load_image(char *url); static char *feh_magick_load_image(char *filename); @@ -209,7 +210,8 @@ void feh_imlib_print_load_error(char *file, winwidget w, Imlib_Load_Error err) int feh_load_image(Imlib_Image * im, feh_file * file) { Imlib_Load_Error err; - enum { SRC_IMLIB, SRC_HTTP, SRC_MAGICK } image_source = SRC_IMLIB; + enum { SRC_IMLIB, SRC_HTTP, SRC_MAGICK, SRC_STDIN } image_source = + SRC_IMLIB; char *tmpname = NULL; char *real_filename = NULL; @@ -225,6 +227,10 @@ int feh_load_image(Imlib_Image * im, feh_file * file) tmpname = feh_http_load_image(file->filename); } + if ((strlen(file->filename) == 1) && (file->filename[0] == '-')) { + image_source = SRC_STDIN; + tmpname = feh_stdin_load_image(); + } else *im = imlib_load_image_with_error_return(file->filename, &err); @@ -269,6 +275,38 @@ int feh_load_image(Imlib_Image * im, feh_file * file) return(1); } +static char *feh_stdin_load_image() +{ + char buf[1024]; + size_t readsize; + char *sfn = estrjoin("_", "/tmp/feh_stdin", "XXXXXX", NULL); + int fd = mkstemp(sfn); + FILE *outfile; + + if (fd == -1) { + free(sfn); + return NULL; + } + + outfile = fdopen(fd, "w"); + + if (outfile == NULL) { + free(sfn); + return NULL; + } + + while ((readsize = fread(buf, sizeof(char), sizeof(buf), stdin)) > 0) { + if (fwrite(buf, sizeof(char), readsize, outfile) < readsize) { + free(sfn); + return NULL; + } + } + + fclose(outfile); + + return sfn; +} + static char *feh_magick_load_image(char *filename) { char argv_fd[12]; -- cgit v1.2.3