aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-12-20 03:55:27 +0100
committerPřemysl Eric Janouch <p@janouch.name>2021-12-20 03:55:53 +0100
commit63955e881dcc958fa871731157a1230a8a41abc0 (patch)
tree7716cf0a87d0543828eb6998268ab05f3ad71435
parent6130f527d473cab7681024a25fe8d46c9c144c3b (diff)
downloadfiv-63955e881dcc958fa871731157a1230a8a41abc0.tar.gz
fiv-63955e881dcc958fa871731157a1230a8a41abc0.tar.xz
fiv-63955e881dcc958fa871731157a1230a8a41abc0.zip
Add a convenience dark theme variant toggle
-rw-r--r--fastiv.c11
1 files changed, 10 insertions, 1 deletions
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);