Mercurial > hg > forks > geeqie
changeset 2418:8ff8a1df17c9
Command line option to print current filename
Command line remote option to print the filename of the currently
displayed image.
geeqie --remote --tell
Originator:
https://sourceforge.net/p/geeqie/mailman/geeqie-
devel/thread/20161227192724.GC1622%40hodi/#msg35573019
author | Colin Clark <cclark@mcb.net> |
---|---|
date | Thu, 29 Dec 2016 16:33:08 +0000 |
parents | e5533195963f |
children | 0333d7eefc8c |
files | doc/docbook/GuideReferenceCommandLine.xml src/remote.c |
diffstat | 2 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/docbook/GuideReferenceCommandLine.xml Sat Dec 24 13:44:25 2016 +0100 +++ b/doc/docbook/GuideReferenceCommandLine.xml Thu Dec 29 16:33:08 2016 +0000 @@ -194,6 +194,11 @@ </row> <row> <entry /> + <entry>--tell</entry> + <entry>Print filename of current image</entry> + </row> + <row> + <entry /> <entry>view:<file></entry> <entry>Open new window containing <file></entry> </row>
--- a/src/remote.c Sat Dec 24 13:44:25 2016 +0100 +++ b/src/remote.c Thu Dec 29 16:33:08 2016 +0000 @@ -24,6 +24,7 @@ #include "collect.h" #include "filedata.h" +#include "image.h" #include "img-view.h" #include "layout.h" #include "layout_image.h" @@ -522,6 +523,14 @@ g_free(filename); } +static void gr_file_tell(const gchar *text, GIOChannel *channel, gpointer data) +{ + LayoutWindow *lw = NULL; /* NULL to force layout_valid() to do some magic */ + if (!layout_valid(&lw)) return; + if (image_get_path(lw->image)) + printf_term("%s %s\n", GQ_APPNAME, image_get_path(lw->image)); +} + static void gr_config_load(const gchar *text, GIOChannel *channel, gpointer data) { gchar *filename = expand_tilde(text); @@ -666,6 +675,7 @@ { NULL, "--get-sidecars:", gr_get_sidecars, TRUE, FALSE, N_("<FILE>"), N_("get list of sidecars of FILE") }, { NULL, "--get-destination:", gr_get_destination, TRUE, FALSE, N_("<FILE>"), N_("get destination path of FILE") }, { NULL, "file:", gr_file_load, TRUE, FALSE, N_("<FILE>"), N_("open FILE") }, + { NULL, "--tell", gr_file_tell, FALSE, FALSE, NULL, N_("print filename of current image") }, { NULL, "view:", gr_file_view, TRUE, FALSE, N_("<FILE>"), N_("open FILE in new window") }, { NULL, "--list-clear", gr_list_clear, FALSE, FALSE, NULL, N_("clear command line collection list") }, { NULL, "--list-add:", gr_list_add, TRUE, FALSE, N_("<FILE>"), N_("add FILE to command line collection list") },