diff --git a/man/wofi.1 b/man/wofi.1 index c04866c..33b1982 100644 --- a/man/wofi.1 +++ b/man/wofi.1 @@ -103,6 +103,9 @@ Specifies the number of columns to display, default is 1. .TP .B \-O, \-\-sort\-order=\fIORDER\fR Specifies the default sort order. There are currently two orders, default and alphabetical. See \fBwofi\fR(7) for details. +.TP +.B \-G, \-\-gtk\-dark +Instructs wofi to use the dark variant of the current GTK theme, if available. .SH CONFIGURATION Wofi has 3 main files used for configuration. All files are completely optional. diff --git a/man/wofi.5 b/man/wofi.5 index 324e747..4f4d6bb 100644 --- a/man/wofi.5 +++ b/man/wofi.5 @@ -100,6 +100,9 @@ Specifies the number of columns to display, default is 1. .B sort_order=\fIORDER\fR Specifies the default sort order. There are currently two orders, default and alphabetical. See \fBwofi\fR(7) for details. .TP +.B gtk_dark=\fIBOOL\fR +If true, instructs wofi to use the dark variant of the current GTK theme (if available). Default is false. +.TP .B orientation=\fIORIENTATION\fR Specifies the orientation, it can be either horizontal or vertical, default is vertical. .TP diff --git a/src/main.c b/src/main.c index 8fef12c..1d47d80 100644 --- a/src/main.c +++ b/src/main.c @@ -87,6 +87,7 @@ static void print_usage(char** argv) { printf("--lines\t\t-L\tSets the height in number of lines\n"); printf("--columns\t-w\tSets the number of columns to display\n"); printf("--sort-order\t-O\tSets the sort order\n"); + printf("--gtk-dark\t-G\tUses the dark variant of the current GTK theme\n"); exit(0); } @@ -394,6 +395,12 @@ int main(int argc, char** argv) { .flag = NULL, .val = 'O' }, + { + .name = "gtk-dark", + .has_arg = no_argument, + .flag = NULL, + .val = 'G' + }, { .name = NULL, .has_arg = 0, @@ -427,13 +434,14 @@ int main(int argc, char** argv) { char* lines = NULL; char* columns = NULL; char* sort_order = NULL; + char* gtk_dark = NULL; struct wl_list options; wl_list_init(&options); struct option_node* node; int opt; - while((opt = getopt_long(argc, argv, "hfc:s:C:dS:W:H:p:x:y:nImk:t:P::ebM:iqvl:aD:L:w:O:", opts, NULL)) != -1) { + while((opt = getopt_long(argc, argv, "hfc:s:C:dS:W:H:p:x:y:nImk:t:P::ebM:iqvl:aD:L:w:O:G", opts, NULL)) != -1) { switch(opt) { case 'h': print_usage(argv); @@ -533,6 +541,9 @@ int main(int argc, char** argv) { case 'O': sort_order = optarg; break; + case 'G': + gtk_dark = "true"; + break; } } @@ -606,6 +617,11 @@ int main(int argc, char** argv) { color_path = strdup(color_str); } + //Check if --gtk-dark was specified + if(gtk_dark == NULL) { + gtk_dark = map_get(config, "gtk_dark"); + } + free(COLORS_LOCATION); struct option_node* tmp; @@ -720,6 +736,10 @@ int main(int argc, char** argv) { gtk_init(&argc, &argv); + if(gtk_dark != NULL && strcmp(gtk_dark, "true") == 0) { + g_object_set(gtk_settings_get_default(), + "gtk-application-prefer-dark-theme", 1, NULL); + } wofi_load_css(false); wofi_init(config);