diff --git a/commands.c b/commands.c index 7c44ace..97cadf2 100644 --- a/commands.c +++ b/commands.c @@ -59,6 +59,13 @@ bool cg_quit(arg_t status) return None; /* silence tcc warning */ } +bool cg_pick_quit(arg_t status) +{ + if (options->to_stdout && markcnt == 0) + printf("%s%c", files[fileidx].name, options->using_null ? '\0' : '\n'); + return cg_quit(status); +} + bool cg_switch_mode(arg_t _) { if (mode == MODE_IMAGE) { diff --git a/commands.h b/commands.h index 76b1330..4e694f0 100644 --- a/commands.h +++ b/commands.h @@ -12,6 +12,7 @@ bool cg_n_or_last(arg_t); bool cg_navigate_marked(arg_t); bool cg_prefix_external(arg_t); bool cg_quit(arg_t); +bool cg_pick_quit(arg_t); bool cg_reload_image(arg_t); bool cg_remove_image(arg_t); bool cg_reverse_marks(arg_t); @@ -57,6 +58,7 @@ bool ct_select(arg_t); #define g_navigate_marked { cg_navigate_marked, MODE_ALL } #define g_prefix_external { cg_prefix_external, MODE_ALL } #define g_quit { cg_quit, MODE_ALL } +#define g_pick_quit { cg_pick_quit, MODE_ALL } #define g_reload_image { cg_reload_image, MODE_ALL } #define g_remove_image { cg_remove_image, MODE_ALL } #define g_reverse_marks { cg_reverse_marks, MODE_ALL } diff --git a/config.def.h b/config.def.h index a0935f6..5d4e97a 100644 --- a/config.def.h +++ b/config.def.h @@ -92,6 +92,7 @@ static const KeySym KEYHANDLER_ABORT = XK_Escape; static const keymap_t keys[] = { /* modifiers key function argument */ { 0, XK_q, g_quit, 0 }, + { 0, XK_Q, g_pick_quit, 0 }, { 0, XK_Return, g_switch_mode, None }, { 0, XK_f, g_toggle_fullscreen, None }, { 0, XK_b, g_toggle_bar, None }, diff --git a/etc/nsxiv.1 b/etc/nsxiv.1 index a75a0a0..10f131a 100644 --- a/etc/nsxiv.1 +++ b/etc/nsxiv.1 @@ -135,6 +135,10 @@ Prefix the next command with a number (denoted via .B q Quit nsxiv. .TP +.B Q +Quit nsxiv, but additionally print the current filename when \-o is active and +no files have been marked. +.TP .B Return Switch to thumbnail mode / open selected image in image mode. .TP