Skip to content

Instantly share code, notes, and snippets.

@derf
Created July 18, 2013 14:56
Show Gist options
  • Save derf/6030013 to your computer and use it in GitHub Desktop.
Save derf/6030013 to your computer and use it in GitHub Desktop.
feh patch for "toggle_info" button
diff --git a/src/events.c b/src/events.c
index fadae9b..0998a3c 100644
--- a/src/events.c
+++ b/src/events.c
@@ -108,6 +108,7 @@ void init_buttonbindings(void)
feh_set_bb(&buttons.next, 0, 5);
feh_set_bb(&buttons.blur, 4, 1);
feh_set_bb(&buttons.rotate, 4, 2);
+ feh_set_bb(&buttons.toggle_info, 4, 3);
home = getenv("HOME");
if (!home)
@@ -156,6 +157,8 @@ void init_buttonbindings(void)
cur_bb = &buttons.zoom_in;
else if (!strcmp(action, "zoom_out"))
cur_bb = &buttons.zoom_out;
+ else if (!strcmp(action, "toggle_info"))
+ cur_bb = &buttons.toggle_info;
else
weprintf("buttons: Invalid action: %s", action);
@@ -320,6 +323,10 @@ static void feh_event_handle_ButtonPress(XEvent * ev)
if (winwid->type == WIN_TYPE_SLIDESHOW)
slideshow_change_image(winwid, SLIDE_NEXT, 1);
+ } else if (feh_is_bb(&buttons.toggle_info, button, state)) {
+ opt.draw_info = !opt.draw_info;
+ winwidget_render_image(winwid, 0, 0);
+
} else {
D(("Received other ButtonPress event\n"));
}
diff --git a/src/options.h b/src/options.h
index 27d3d38..1fe6de5 100644
--- a/src/options.h
+++ b/src/options.h
@@ -209,6 +209,7 @@ struct __fehbb {
struct __fehbutton rotate;
struct __fehbutton zoom_in;
struct __fehbutton zoom_out;
+ struct __fehbutton toggle_info;
};
void init_parse_options(int argc, char **argv);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment