From 63955e881dcc958fa871731157a1230a8a41abc0 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch
Date: Mon, 20 Dec 2021 03:55:27 +0100 Subject: Add a convenience dark theme variant toggle --- fastiv.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/fastiv.c b/fastiv.c index df99908..a695ee2 100644 --- a/fastiv.c +++ b/fastiv.c @@ -548,6 +548,15 @@ on_key_press(G_GNUC_UNUSED GtkWidget *widget, GdkEventKey *event, G_GNUC_UNUSED gpointer data) { switch (event->state & gtk_accelerator_get_default_mod_mask()) { + case GDK_MOD1_MASK | GDK_SHIFT_MASK: + if (event->keyval == GDK_KEY_D) { + GtkSettings *settings = gtk_settings_get_default(); + const char *property = "gtk-application-prefer-dark-theme"; + gboolean set = FALSE; + g_object_get(settings, property, &set, NULL); + g_object_set(settings, property, !set, NULL); + } + break; case GDK_CONTROL_MASK: switch (event->keyval) { case GDK_KEY_o: @@ -1006,7 +1015,7 @@ main(int argc, char *argv[]) G_CALLBACK(on_button_press_view), NULL); gtk_container_add(GTK_CONTAINER(view_scroller), g.view); - // Maybe our custom widgets should derive colours from the theme instead. + // TODO(p): Base most colours on the theme, and make this configurable. g_object_set(gtk_settings_get_default(), "gtk-application-prefer-dark-theme", TRUE, NULL); -- cgit v1.2.3-70-g09d2