summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2017-09-16 20:36:52 +0200
committerDaniel Friesel <derf@finalrewind.org>2017-09-16 20:36:52 +0200
commit7eb9d73e908d3c10c06521bb211dc571cb3a8e35 (patch)
treeaaabbb7a659c62f1559bb1a1ea9f68a15ddf670b
parenta6b5acb94f1d851c738f23a86020783d77173b4d (diff)
Add toggle_fixed_geometry ("g") keybinding to enable/disable window auto-resize
Closes #326
-rw-r--r--man/feh.pre4
-rw-r--r--src/keyevents.c12
-rw-r--r--src/options.h1
3 files changed, 17 insertions, 0 deletions
diff --git a/man/feh.pre b/man/feh.pre
index fb5e28f..ac9a81a 100644
--- a/man/feh.pre
+++ b/man/feh.pre
@@ -1258,6 +1258,10 @@ Toggle EXIF tag display
Save the current filelist as
.Qq feh_PID_ID_filelist
.
+.It g Bq toggle_fixed_geometry
+.
+Enable/Disable automatic window resize when changing images.
+.
.It h Bq toggle_pause
.
Pause/Continue the slideshow. When it is paused, it will not automatically
diff --git a/src/keyevents.c b/src/keyevents.c
index 14f1a14..d478a5a 100644
--- a/src/keyevents.c
+++ b/src/keyevents.c
@@ -196,6 +196,7 @@ void init_keyevents(void) {
feh_set_kb(&keys.reload_minus, 0, XK_minus, 0, 0, 0, 0);
feh_set_kb(&keys.reload_plus, 0, XK_plus, 0, 0, 0, 0);
feh_set_kb(&keys.toggle_keep_vp, 0, XK_k, 0, 0, 0, 0);
+ feh_set_kb(&keys.toggle_fixed_geometry, 0, XK_g, 0, 0, 0, 0);
home = getenv("HOME");
confhome = getenv("XDG_CONFIG_HOME");
@@ -504,6 +505,8 @@ fehkey *feh_str_to_kb(char *action)
return &keys.reload_plus;
else if (!strcmp(action, "toggle_keep_vp"))
return &keys.toggle_keep_vp;
+ else if (!strcmp(action, "toggle_fixed_geometry"))
+ return &keys.toggle_fixed_geometry;
return NULL;
}
@@ -871,5 +874,14 @@ void feh_event_handle_generic(winwidget winwid, unsigned int state, KeySym keysy
else if (feh_is_kp(&keys.toggle_keep_vp, state, keysym, button)) {
opt.keep_zoom_vp = !opt.keep_zoom_vp;
}
+ else if (feh_is_kp(&keys.toggle_fixed_geometry, state, keysym, button)) {
+ if (opt.geom_flags & ((WidthValue | HeightValue))) {
+ opt.geom_flags &= ~(WidthValue | HeightValue);
+ } else {
+ opt.geom_flags |= (WidthValue | HeightValue);
+ opt.geom_w = winwid->w;
+ opt.geom_h = winwid->h;
+ }
+ }
return;
}
diff --git a/src/options.h b/src/options.h
index 5a5ce84..ef7f471 100644
--- a/src/options.h
+++ b/src/options.h
@@ -208,6 +208,7 @@ struct __fehkb {
struct __fehkey reload;
struct __fehkey blur;
struct __fehkey rotate;
+ struct __fehkey toggle_fixed_geometry;
};
void init_parse_options(int argc, char **argv);