Skip to content

Commit 7092605

Browse files
committed
add option to change theme
1 parent cdac8d5 commit 7092605

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

source.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,27 @@
1313

1414
struct GtkLock *gtklock = NULL;
1515

16-
static char *style_path = NULL;
17-
static char *module_path = NULL;
18-
1916
static gboolean should_daemonize = FALSE;
2017
static gboolean no_layer_shell = FALSE;
2118
static gboolean no_input_inhibit = FALSE;
2219

23-
static pid_t parent = -2;
20+
static char *gtk_theme = NULL;
21+
22+
static char *style_path = NULL;
23+
static char *module_path = NULL;
2424

2525
static GOptionEntry entries[] = {
2626
{ "daemonize", 'd', 0, G_OPTION_ARG_NONE, &should_daemonize, "Detach from the controlling terminal after locking", NULL },
2727
{ "no-layer-shell", 'l', 0, G_OPTION_ARG_NONE, &no_layer_shell, "Don't use wlr-layer-shell", NULL },
2828
{ "no-input-inhibit", 'i', 0, G_OPTION_ARG_NONE, &no_input_inhibit, "Don't use wlr-input-inhibitor", NULL },
29-
{ "style", 's', 0, G_OPTION_ARG_FILENAME, &style_path, "CSS style to use", NULL },
30-
{ "module", 'm', 0, G_OPTION_ARG_FILENAME, &module_path, "gtklock module to use", NULL },
29+
{ "gtk-theme", 'g', 0, G_OPTION_ARG_STRING, &gtk_theme, "Set GTK theme", NULL },
30+
{ "style", 's', 0, G_OPTION_ARG_FILENAME, &style_path, "Load CSS style file", NULL },
31+
{ "module", 'm', 0, G_OPTION_ARG_FILENAME, &module_path, "Load gtklock module", NULL },
3132
{ NULL },
3233
};
3334

35+
static pid_t parent = -2;
36+
3437
static void reload_outputs(void) {
3538
GdkDisplay *display = gdk_display_get_default();
3639

@@ -156,6 +159,11 @@ int main(int argc, char **argv) {
156159
if(!g_option_context_parse(option_context, &argc, &argv, &error))
157160
g_error("Option parsing failed: %s\n", error->message);
158161

162+
if(gtk_theme) {
163+
GtkSettings *settings = gtk_settings_get_default();
164+
g_object_set(settings, "gtk-theme-name", gtk_theme, NULL);
165+
}
166+
159167
gtklock = create_gtklock();
160168
gtklock->use_layer_shell = !no_layer_shell;
161169
gtklock->use_input_inhibit = !no_input_inhibit;

0 commit comments

Comments
 (0)