2019-08-17 21:19:32 -04:00
|
|
|
/*
|
2020-01-06 19:42:52 -05:00
|
|
|
* Copyright (C) 2019-2020 Scoopta
|
2019-08-17 21:19:32 -04:00
|
|
|
* This file is part of Wofi
|
|
|
|
* Wofi is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Wofi is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Wofi. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <getopt.h>
|
|
|
|
#include <string.h>
|
2020-03-26 02:05:46 -04:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <signal.h>
|
|
|
|
|
|
|
|
#include <map.h>
|
|
|
|
#include <wofi.h>
|
|
|
|
#include <utils.h>
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include <wayland-client.h>
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
2019-08-17 21:19:32 -04:00
|
|
|
|
2020-02-29 05:27:59 -05:00
|
|
|
static const char* nyan_colors[] = {"#FF0000", "#FFA500", "#FFFF00", "#00FF00", "#0000FF", "#FF00FF"};
|
|
|
|
static size_t nyan_color_l = sizeof(nyan_colors) / sizeof(char*);
|
|
|
|
|
2019-08-17 21:19:32 -04:00
|
|
|
static char* CONFIG_LOCATION;
|
|
|
|
static char* COLORS_LOCATION;
|
|
|
|
static struct map* config;
|
|
|
|
static char* config_path;
|
|
|
|
static char* stylesheet;
|
|
|
|
static char* color_path;
|
2020-02-29 05:27:59 -05:00
|
|
|
static uint8_t nyan_shift = 0;
|
2019-08-17 21:19:32 -04:00
|
|
|
|
2020-01-25 02:36:56 -05:00
|
|
|
struct option_node {
|
|
|
|
char* option;
|
|
|
|
struct wl_list link;
|
|
|
|
};
|
|
|
|
|
2019-08-18 00:15:59 -04:00
|
|
|
static char* get_exec_name(char* path) {
|
|
|
|
char* slash = strrchr(path, '/');
|
2019-08-17 21:19:32 -04:00
|
|
|
uint64_t offset;
|
|
|
|
if(slash == NULL) {
|
|
|
|
offset = 0;
|
|
|
|
} else {
|
2019-08-18 00:15:59 -04:00
|
|
|
offset = (slash - path) + 1;
|
2019-08-17 21:19:32 -04:00
|
|
|
}
|
2019-08-18 00:15:59 -04:00
|
|
|
return path + offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void print_usage(char** argv) {
|
|
|
|
printf("%s [options]\n", get_exec_name(argv[0]));
|
2019-08-17 21:19:32 -04:00
|
|
|
printf("Options:\n");
|
2021-10-29 15:34:49 -04:00
|
|
|
printf("--help\t\t\t-h\tDisplays this help message\n");
|
|
|
|
printf("--fork\t\t\t-f\tForks the menu so you can close the terminal\n");
|
|
|
|
printf("--conf\t\t\t-c\tSelects a config file to use\n");
|
|
|
|
printf("--style\t\t\t-s\tSelects a stylesheet to use\n");
|
|
|
|
printf("--color\t\t\t-C\tSelects a colors file to use\n");
|
|
|
|
printf("--dmenu\t\t\t-d\tRuns in dmenu mode\n");
|
2022-02-14 00:04:32 -05:00
|
|
|
printf("--show\t\t\t-S\tSpecifies the mode to run in. A list can be found in wofi(7)\n");
|
2021-10-29 15:34:49 -04:00
|
|
|
printf("--width\t\t\t-W\tSpecifies the surface width\n");
|
|
|
|
printf("--height\t\t-H\tSpecifies the surface height\n");
|
|
|
|
printf("--prompt\t\t-p\tPrompt to display\n");
|
|
|
|
printf("--xoffset\t\t-x\tThe x offset\n");
|
|
|
|
printf("--yoffset\t\t-y\tThe y offset\n");
|
|
|
|
printf("--normal-window\t\t-n\tRender to a normal window\n");
|
|
|
|
printf("--allow-images\t\t-I\tAllows images to be rendered\n");
|
|
|
|
printf("--allow-markup\t\t-m\tAllows pango markup\n");
|
|
|
|
printf("--cache-file\t\t-k\tSets the cache file to use\n");
|
|
|
|
printf("--term\t\t\t-t\tSpecifies the terminal to use when running in a term\n");
|
|
|
|
printf("--password\t\t-P\tRuns in password mode\n");
|
|
|
|
printf("--exec-search\t\t-e\tMakes enter always use the search contents not the first result\n");
|
|
|
|
printf("--hide-scroll\t\t-b\tHides the scroll bars\n");
|
|
|
|
printf("--matching\t\t-M\tSets the matching method, default is contains\n");
|
|
|
|
printf("--insensitive\t\t-i\tAllows case insensitive searching\n");
|
|
|
|
printf("--parse-search\t\t-q\tParses the search text removing image escapes and pango\n");
|
|
|
|
printf("--version\t\t-v\tPrints the version and then exits\n");
|
|
|
|
printf("--location\t\t-l\tSets the location\n");
|
|
|
|
printf("--no-actions\t\t-a\tDisables multiple actions for modes that support it\n");
|
|
|
|
printf("--define\t\t-D\tSets a config option\n");
|
|
|
|
printf("--lines\t\t\t-L\tSets the height in number of lines\n");
|
|
|
|
printf("--columns\t\t-w\tSets the number of columns to display\n");
|
|
|
|
printf("--sort-order\t\t-O\tSets the sort order\n");
|
|
|
|
printf("--gtk-dark\t\t-G\tUses the dark variant of the current GTK theme\n");
|
|
|
|
printf("--search\t\t-Q\tSearch for something immediately on open\n");
|
|
|
|
printf("--monitor\t\t-o\tSets the monitor to open on\n");
|
|
|
|
printf("--pre-display-cmd\t-r\tRuns command for the displayed entries, without changing the output. %%s for the real string\n");
|
2019-08-17 21:19:32 -04:00
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
2020-02-29 05:27:59 -05:00
|
|
|
void wofi_load_css(bool nyan) {
|
2019-08-17 21:19:32 -04:00
|
|
|
if(access(stylesheet, R_OK) == 0) {
|
|
|
|
FILE* file = fopen(stylesheet, "r");
|
|
|
|
fseek(file, 0, SEEK_END);
|
|
|
|
ssize_t size = ftell(file);
|
|
|
|
fseek(file, 0, SEEK_SET);
|
|
|
|
char* data = malloc(size + 1);
|
2021-10-30 04:04:22 -04:00
|
|
|
if (fread(data, 1, size, file) == 0) {
|
2021-11-09 10:37:24 -05:00
|
|
|
fprintf(stderr, "failed to read stylesheet data from file\n");
|
2021-10-29 15:34:49 -04:00
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
2019-08-17 21:19:32 -04:00
|
|
|
fclose(file);
|
|
|
|
|
|
|
|
data[size] = 0;
|
|
|
|
struct wl_list lines;
|
|
|
|
struct node {
|
|
|
|
char* line;
|
|
|
|
struct wl_list link;
|
|
|
|
};
|
|
|
|
wl_list_init(&lines);
|
2020-02-29 05:27:59 -05:00
|
|
|
if(nyan) {
|
2020-02-29 06:16:23 -05:00
|
|
|
for(ssize_t count = nyan_shift; count < 100 + nyan_shift; ++count) {
|
2020-02-29 05:27:59 -05:00
|
|
|
size_t i = count % nyan_color_l;
|
2019-08-17 21:19:32 -04:00
|
|
|
struct node* entry = malloc(sizeof(struct node));
|
2020-02-29 05:27:59 -05:00
|
|
|
entry->line = strdup(nyan_colors[i]);
|
2019-08-17 21:19:32 -04:00
|
|
|
wl_list_insert(&lines, &entry->link);
|
|
|
|
}
|
2020-02-29 05:27:59 -05:00
|
|
|
nyan_shift = (nyan_shift + 1) % nyan_color_l;
|
|
|
|
} else {
|
|
|
|
if(access(color_path, R_OK) == 0) {
|
|
|
|
file = fopen(color_path, "r");
|
|
|
|
char* line = NULL;
|
|
|
|
size_t line_size = 0;
|
|
|
|
ssize_t line_l = 0;
|
|
|
|
while((line_l = getline(&line, &line_size, file)) != -1) {
|
|
|
|
struct node* entry = malloc(sizeof(struct node));
|
|
|
|
line[line_l - 1] = 0;
|
|
|
|
entry->line = malloc(line_l + 1);
|
|
|
|
strcpy(entry->line, line);
|
|
|
|
wl_list_insert(&lines, &entry->link);
|
|
|
|
}
|
|
|
|
fclose(file);
|
|
|
|
free(line);
|
|
|
|
}
|
2019-08-17 21:19:32 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
ssize_t count = wl_list_length(&lines) - 1;
|
|
|
|
if(count > 99) {
|
2020-02-29 06:16:23 -05:00
|
|
|
fprintf(stderr, "Woah there that's a lot of colors. Try having no more than 100, thanks\n");
|
2019-08-17 21:19:32 -04:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
struct node* node;
|
|
|
|
wl_list_for_each(node, &lines, link) {
|
|
|
|
//Do --wofi-color replace
|
|
|
|
const char* color = node->line;
|
|
|
|
const char* wofi_color = "--wofi-color";
|
|
|
|
char count_str[3];
|
2019-11-03 23:20:00 -05:00
|
|
|
snprintf(count_str, 3, "%zu", count--);
|
2019-08-17 21:19:32 -04:00
|
|
|
char* needle = utils_concat(2, wofi_color, count_str);
|
|
|
|
size_t color_len = strlen(color);
|
|
|
|
size_t needle_len = strlen(needle);
|
|
|
|
if(color_len > needle_len) {
|
|
|
|
free(needle);
|
|
|
|
fprintf(stderr, "What color format is this, try #FFFFFF, kthxbi\n");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
char* replace = strstr(data, needle);
|
|
|
|
while(replace != NULL) {
|
|
|
|
memcpy(replace, color, color_len);
|
|
|
|
memset(replace + color_len, ' ', needle_len - color_len);
|
|
|
|
replace = strstr(data, needle);
|
|
|
|
}
|
|
|
|
free(needle);
|
|
|
|
|
|
|
|
|
|
|
|
//Do --wofi-rgb-color replace
|
|
|
|
if(color_len < 7) {
|
|
|
|
fprintf(stderr, "What color format is this, try #FFFFFF, kthxbi\n");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
const char* wofi_rgb_color = "--wofi-rgb-color";
|
|
|
|
needle = utils_concat(2, wofi_rgb_color, count_str);
|
|
|
|
needle_len = strlen(needle);
|
|
|
|
replace = strstr(data, needle);
|
|
|
|
while(replace != NULL) {
|
|
|
|
char r[3];
|
|
|
|
char g[3];
|
|
|
|
char b[3];
|
|
|
|
memcpy(r, color + 1, 2);
|
|
|
|
memcpy(g, color + 3, 2);
|
|
|
|
memcpy(b, color + 5, 2);
|
|
|
|
r[2] = 0;
|
|
|
|
g[2] = 0;
|
|
|
|
b[2] = 0;
|
|
|
|
char rgb[14];
|
|
|
|
snprintf(rgb, 14, "%ld, %ld, %ld", strtol(r, NULL, 16), strtol(g, NULL, 16), strtol(b, NULL, 16));
|
|
|
|
size_t rgb_len = strlen(rgb);
|
|
|
|
memcpy(replace, rgb, rgb_len);
|
|
|
|
memset(replace + rgb_len, ' ', needle_len - rgb_len);
|
|
|
|
replace = strstr(data, needle);
|
|
|
|
}
|
|
|
|
free(needle);
|
|
|
|
}
|
|
|
|
GtkCssProvider* css = gtk_css_provider_new();
|
|
|
|
gtk_css_provider_load_from_data(css, data, strlen(data), NULL);
|
|
|
|
free(data);
|
|
|
|
struct node* tmp;
|
|
|
|
wl_list_for_each_safe(node, tmp, &lines, link) {
|
|
|
|
free(node->line);
|
|
|
|
wl_list_remove(&node->link);
|
|
|
|
free(node);
|
|
|
|
}
|
|
|
|
gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), GTK_STYLE_PROVIDER(css), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-01 00:55:28 -05:00
|
|
|
static void sig(int32_t signum) {
|
|
|
|
switch(signum) {
|
|
|
|
case SIGTERM:
|
|
|
|
exit(1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-17 21:19:32 -04:00
|
|
|
int main(int argc, char** argv) {
|
|
|
|
|
|
|
|
const struct option opts[] = {
|
|
|
|
{
|
|
|
|
.name = "help",
|
|
|
|
.has_arg = no_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'h'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "fork",
|
|
|
|
.has_arg = no_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'f'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "conf",
|
|
|
|
.has_arg = required_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'c'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "style",
|
|
|
|
.has_arg = required_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 's'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "color",
|
|
|
|
.has_arg = required_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'C'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "dmenu",
|
|
|
|
.has_arg = no_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'd'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "show",
|
|
|
|
.has_arg = required_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'S'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "width",
|
|
|
|
.has_arg = required_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'W'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "height",
|
|
|
|
.has_arg = required_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'H'
|
|
|
|
},
|
2019-11-04 20:49:34 -05:00
|
|
|
{
|
|
|
|
.name = "prompt",
|
|
|
|
.has_arg = required_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'p'
|
|
|
|
},
|
2019-08-17 21:19:32 -04:00
|
|
|
{
|
|
|
|
.name = "xoffset",
|
|
|
|
.has_arg = required_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'x'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "yoffset",
|
|
|
|
.has_arg = required_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'y'
|
|
|
|
},
|
2019-08-17 22:22:09 -04:00
|
|
|
{
|
|
|
|
.name = "normal-window",
|
|
|
|
.has_arg = no_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'n'
|
|
|
|
},
|
2019-08-28 02:15:18 -04:00
|
|
|
{
|
|
|
|
.name = "allow-images",
|
|
|
|
.has_arg = no_argument,
|
|
|
|
.flag = NULL,
|
2019-11-29 01:27:06 -05:00
|
|
|
.val = 'I'
|
2019-08-28 02:15:18 -04:00
|
|
|
},
|
2019-08-28 03:58:45 -04:00
|
|
|
{
|
|
|
|
.name = "allow-markup",
|
|
|
|
.has_arg = no_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'm'
|
|
|
|
},
|
2019-08-28 23:14:38 -04:00
|
|
|
{
|
|
|
|
.name = "cache-file",
|
|
|
|
.has_arg = required_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'k'
|
|
|
|
},
|
2019-09-27 02:24:48 -04:00
|
|
|
{
|
|
|
|
.name = "term",
|
|
|
|
.has_arg = required_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 't'
|
|
|
|
},
|
2019-10-23 00:19:57 -04:00
|
|
|
{
|
|
|
|
.name = "password",
|
|
|
|
.has_arg = optional_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'P'
|
|
|
|
},
|
2019-11-04 20:46:39 -05:00
|
|
|
{
|
|
|
|
.name = "exec-search",
|
|
|
|
.has_arg = no_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'e'
|
|
|
|
},
|
2019-11-18 16:42:40 -05:00
|
|
|
{
|
|
|
|
.name = "hide-scroll",
|
|
|
|
.has_arg = no_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'b'
|
|
|
|
},
|
2019-11-21 04:01:27 -05:00
|
|
|
{
|
|
|
|
.name = "matching",
|
|
|
|
.has_arg = required_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'M'
|
|
|
|
},
|
2019-11-25 17:56:46 -05:00
|
|
|
{
|
|
|
|
.name = "insensitive",
|
|
|
|
.has_arg = no_argument,
|
|
|
|
.flag = NULL,
|
2019-11-29 01:27:06 -05:00
|
|
|
.val = 'i'
|
2019-11-25 17:56:46 -05:00
|
|
|
},
|
2019-12-16 21:36:21 -05:00
|
|
|
{
|
|
|
|
.name = "parse-search",
|
|
|
|
.has_arg = no_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'q'
|
|
|
|
},
|
2019-12-17 02:55:48 -05:00
|
|
|
{
|
|
|
|
.name = "version",
|
|
|
|
.has_arg = no_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'v'
|
|
|
|
},
|
2020-01-06 03:28:57 -05:00
|
|
|
{
|
|
|
|
.name = "location",
|
|
|
|
.has_arg = required_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'l'
|
|
|
|
},
|
2020-01-10 17:34:49 -05:00
|
|
|
{
|
|
|
|
.name = "no-actions",
|
2020-01-25 02:44:55 -05:00
|
|
|
.has_arg = no_argument,
|
2020-01-10 17:34:49 -05:00
|
|
|
.flag = NULL,
|
|
|
|
.val = 'a'
|
|
|
|
},
|
2020-01-25 02:36:56 -05:00
|
|
|
{
|
|
|
|
.name = "define",
|
|
|
|
.has_arg = required_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'D'
|
|
|
|
},
|
2020-02-03 01:29:44 -05:00
|
|
|
{
|
|
|
|
.name = "lines",
|
|
|
|
.has_arg = required_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'L'
|
|
|
|
},
|
2020-02-06 21:22:50 -05:00
|
|
|
{
|
|
|
|
.name = "columns",
|
|
|
|
.has_arg = required_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'w'
|
|
|
|
},
|
2020-02-07 21:04:37 -05:00
|
|
|
{
|
|
|
|
.name = "sort-order",
|
|
|
|
.has_arg = required_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'O'
|
|
|
|
},
|
add switch to use the dark gtk theme
Since some time now, GTK3 themes can ship an optional "dark" variant
and applications like picture viewers can make use of such a variant to
appear dark (to not distract from the picture) without overwriting the
current theme (and risking optical breakage). While wofi is not a
picture viewer it may still be desirable to use a dark theme, for
example to contrast the (light) application displaying in the
background.
Of course, wofi can already be fully customized through CSS and/or the
colors file, but using the existing dark variant may be easier than
fully restyling it, if all you want is a darker appearance. The only
way to set an arbitrary GTK application to use the dark theme seems to
be setting an environment variable, but that bears two problems:
For one, one needs to specify the full theme + dark modifier in the
variable, so one would have to keep the global GTK theme and the one
used by wofi manually in sync.
More critical though, the environment variable would be propagated to
the programs wofi launches (for now at least). That would lead to all
GTK applications launched through wofi to use the dark theme, which may
not be desirable. Wofi could also unset that variable before launching
a program, but at this point adding a simple switch is probably easier.
Side note: It may be that there is some way to configure the CSS file
to include the CSS of the dark variant of the current theme, but I have
not been able to find out how. Gnome-terminal uses a switch like this
too (just with dconf), so this may just be the way to go.
2020-03-03 06:09:55 -05:00
|
|
|
{
|
|
|
|
.name = "gtk-dark",
|
|
|
|
.has_arg = no_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'G'
|
|
|
|
},
|
2020-06-14 06:03:00 -04:00
|
|
|
{
|
|
|
|
.name = "search",
|
2020-06-14 06:10:31 -04:00
|
|
|
.has_arg = required_argument,
|
2020-06-14 06:03:00 -04:00
|
|
|
.flag = NULL,
|
|
|
|
.val = 'Q'
|
|
|
|
},
|
2020-07-18 16:32:05 -04:00
|
|
|
{
|
|
|
|
.name = "monitor",
|
|
|
|
.has_arg = required_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'o'
|
|
|
|
},
|
2021-10-29 15:34:49 -04:00
|
|
|
{
|
|
|
|
.name = "pre-display-cmd",
|
|
|
|
.has_arg = required_argument,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 'r'
|
|
|
|
},
|
2019-08-17 21:19:32 -04:00
|
|
|
{
|
|
|
|
.name = NULL,
|
|
|
|
.has_arg = 0,
|
|
|
|
.flag = NULL,
|
|
|
|
.val = 0
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const char* config_str = NULL;
|
|
|
|
char* style_str = NULL;
|
|
|
|
char* color_str = NULL;
|
|
|
|
char* mode = NULL;
|
|
|
|
char* prompt = NULL;
|
|
|
|
char* width = NULL;
|
|
|
|
char* height = NULL;
|
|
|
|
char* x = NULL;
|
|
|
|
char* y = NULL;
|
2019-08-17 22:22:09 -04:00
|
|
|
char* normal_window = NULL;
|
2019-08-28 02:15:18 -04:00
|
|
|
char* allow_images = NULL;
|
2019-08-28 03:58:45 -04:00
|
|
|
char* allow_markup = NULL;
|
2019-08-28 23:14:38 -04:00
|
|
|
char* cache_file = NULL;
|
2019-09-27 02:24:48 -04:00
|
|
|
char* terminal = NULL;
|
2019-10-23 00:19:57 -04:00
|
|
|
char* password_char = "false";
|
2019-11-04 20:46:39 -05:00
|
|
|
char* exec_search = NULL;
|
2019-11-18 16:42:40 -05:00
|
|
|
char* hide_scroll = NULL;
|
2019-11-21 04:01:27 -05:00
|
|
|
char* matching = NULL;
|
2019-11-25 17:56:46 -05:00
|
|
|
char* insensitive = NULL;
|
2019-12-16 21:36:21 -05:00
|
|
|
char* parse_search = NULL;
|
2020-01-06 03:28:57 -05:00
|
|
|
char* location = NULL;
|
2020-01-10 17:34:49 -05:00
|
|
|
char* no_actions = NULL;
|
2020-02-03 01:29:44 -05:00
|
|
|
char* lines = NULL;
|
2020-02-06 21:22:50 -05:00
|
|
|
char* columns = NULL;
|
2020-02-07 21:04:37 -05:00
|
|
|
char* sort_order = NULL;
|
add switch to use the dark gtk theme
Since some time now, GTK3 themes can ship an optional "dark" variant
and applications like picture viewers can make use of such a variant to
appear dark (to not distract from the picture) without overwriting the
current theme (and risking optical breakage). While wofi is not a
picture viewer it may still be desirable to use a dark theme, for
example to contrast the (light) application displaying in the
background.
Of course, wofi can already be fully customized through CSS and/or the
colors file, but using the existing dark variant may be easier than
fully restyling it, if all you want is a darker appearance. The only
way to set an arbitrary GTK application to use the dark theme seems to
be setting an environment variable, but that bears two problems:
For one, one needs to specify the full theme + dark modifier in the
variable, so one would have to keep the global GTK theme and the one
used by wofi manually in sync.
More critical though, the environment variable would be propagated to
the programs wofi launches (for now at least). That would lead to all
GTK applications launched through wofi to use the dark theme, which may
not be desirable. Wofi could also unset that variable before launching
a program, but at this point adding a simple switch is probably easier.
Side note: It may be that there is some way to configure the CSS file
to include the CSS of the dark variant of the current theme, but I have
not been able to find out how. Gnome-terminal uses a switch like this
too (just with dconf), so this may just be the way to go.
2020-03-03 06:09:55 -05:00
|
|
|
char* gtk_dark = NULL;
|
2020-06-14 06:03:00 -04:00
|
|
|
char* search = NULL;
|
2020-07-18 16:32:05 -04:00
|
|
|
char* monitor = NULL;
|
2021-10-29 15:34:49 -04:00
|
|
|
char* pre_display_cmd = NULL;
|
2020-01-25 02:36:56 -05:00
|
|
|
|
|
|
|
struct wl_list options;
|
|
|
|
wl_list_init(&options);
|
|
|
|
struct option_node* node;
|
|
|
|
|
2019-11-03 23:20:00 -05:00
|
|
|
int opt;
|
2021-10-29 15:34:49 -04:00
|
|
|
while((opt = getopt_long(argc, argv, "hfc:s:C:dS:W:H:p:x:y:nImk:t:P::ebM:iqvl:aD:L:w:O:GQ:o:r:", opts, NULL)) != -1) {
|
2019-08-17 21:19:32 -04:00
|
|
|
switch(opt) {
|
|
|
|
case 'h':
|
|
|
|
print_usage(argv);
|
|
|
|
break;
|
|
|
|
case 'f':
|
|
|
|
if(fork() > 0) {
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
fclose(stdout);
|
|
|
|
fclose(stderr);
|
|
|
|
fclose(stdin);
|
|
|
|
break;
|
|
|
|
case 'c':
|
|
|
|
config_str = optarg;
|
|
|
|
break;
|
|
|
|
case 's':
|
|
|
|
style_str = optarg;
|
|
|
|
break;
|
|
|
|
case 'C':
|
|
|
|
color_str = optarg;
|
|
|
|
break;
|
|
|
|
case 'd':
|
|
|
|
mode = "dmenu";
|
|
|
|
break;
|
|
|
|
case 'S':
|
|
|
|
mode = optarg;
|
|
|
|
break;
|
|
|
|
case 'W':
|
|
|
|
width = optarg;
|
|
|
|
break;
|
|
|
|
case 'H':
|
|
|
|
height = optarg;
|
|
|
|
break;
|
|
|
|
case 'p':
|
|
|
|
prompt = optarg;
|
|
|
|
break;
|
|
|
|
case 'x':
|
|
|
|
x = optarg;
|
|
|
|
break;
|
|
|
|
case 'y':
|
|
|
|
y = optarg;
|
|
|
|
break;
|
2019-08-17 22:22:09 -04:00
|
|
|
case 'n':
|
|
|
|
normal_window = "true";
|
|
|
|
break;
|
2019-11-29 01:27:06 -05:00
|
|
|
case 'I':
|
2019-08-28 02:15:18 -04:00
|
|
|
allow_images = "true";
|
|
|
|
break;
|
2019-08-28 03:58:45 -04:00
|
|
|
case 'm':
|
|
|
|
allow_markup = "true";
|
|
|
|
break;
|
2019-08-28 23:14:38 -04:00
|
|
|
case 'k':
|
|
|
|
cache_file = optarg;
|
|
|
|
break;
|
2019-09-27 02:24:48 -04:00
|
|
|
case 't':
|
|
|
|
terminal = optarg;
|
|
|
|
break;
|
2019-10-23 00:19:57 -04:00
|
|
|
case 'P':
|
|
|
|
password_char = optarg;
|
|
|
|
break;
|
2019-11-04 20:46:39 -05:00
|
|
|
case 'e':
|
|
|
|
exec_search = "true";
|
|
|
|
break;
|
2019-11-18 16:42:40 -05:00
|
|
|
case 'b':
|
|
|
|
hide_scroll = "true";
|
|
|
|
break;
|
2019-11-21 04:01:27 -05:00
|
|
|
case 'M':
|
|
|
|
matching = optarg;
|
|
|
|
break;
|
2019-11-29 01:27:06 -05:00
|
|
|
case 'i':
|
2019-11-25 17:56:46 -05:00
|
|
|
insensitive = "true";
|
|
|
|
break;
|
2019-12-16 21:36:21 -05:00
|
|
|
case 'q':
|
|
|
|
parse_search = "true";
|
|
|
|
break;
|
2019-12-17 02:55:48 -05:00
|
|
|
case 'v':
|
|
|
|
printf(VERSION"\n");
|
|
|
|
exit(0);
|
|
|
|
break;
|
2020-01-06 03:28:57 -05:00
|
|
|
case 'l':
|
|
|
|
location = optarg;
|
|
|
|
break;
|
2020-01-10 17:34:49 -05:00
|
|
|
case 'a':
|
|
|
|
no_actions = "true";
|
|
|
|
break;
|
2020-01-25 02:36:56 -05:00
|
|
|
case 'D':
|
|
|
|
node = malloc(sizeof(struct option_node));
|
|
|
|
node->option = optarg;
|
|
|
|
wl_list_insert(&options, &node->link);
|
|
|
|
break;
|
2020-02-03 01:29:44 -05:00
|
|
|
case 'L':
|
|
|
|
lines = optarg;
|
|
|
|
break;
|
2020-02-06 21:22:50 -05:00
|
|
|
case 'w':
|
|
|
|
columns = optarg;
|
|
|
|
break;
|
2020-02-07 21:04:37 -05:00
|
|
|
case 'O':
|
|
|
|
sort_order = optarg;
|
|
|
|
break;
|
add switch to use the dark gtk theme
Since some time now, GTK3 themes can ship an optional "dark" variant
and applications like picture viewers can make use of such a variant to
appear dark (to not distract from the picture) without overwriting the
current theme (and risking optical breakage). While wofi is not a
picture viewer it may still be desirable to use a dark theme, for
example to contrast the (light) application displaying in the
background.
Of course, wofi can already be fully customized through CSS and/or the
colors file, but using the existing dark variant may be easier than
fully restyling it, if all you want is a darker appearance. The only
way to set an arbitrary GTK application to use the dark theme seems to
be setting an environment variable, but that bears two problems:
For one, one needs to specify the full theme + dark modifier in the
variable, so one would have to keep the global GTK theme and the one
used by wofi manually in sync.
More critical though, the environment variable would be propagated to
the programs wofi launches (for now at least). That would lead to all
GTK applications launched through wofi to use the dark theme, which may
not be desirable. Wofi could also unset that variable before launching
a program, but at this point adding a simple switch is probably easier.
Side note: It may be that there is some way to configure the CSS file
to include the CSS of the dark variant of the current theme, but I have
not been able to find out how. Gnome-terminal uses a switch like this
too (just with dconf), so this may just be the way to go.
2020-03-03 06:09:55 -05:00
|
|
|
case 'G':
|
|
|
|
gtk_dark = "true";
|
|
|
|
break;
|
2020-06-14 06:03:00 -04:00
|
|
|
case 'Q':
|
|
|
|
search = optarg;
|
|
|
|
break;
|
2020-07-18 16:32:05 -04:00
|
|
|
case 'o':
|
|
|
|
monitor = optarg;
|
|
|
|
break;
|
2021-10-29 15:34:49 -04:00
|
|
|
case 'r':
|
|
|
|
pre_display_cmd = optarg;
|
|
|
|
break;
|
2019-08-17 21:19:32 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* home_dir = getenv("HOME");
|
|
|
|
const char* xdg_conf = getenv("XDG_CONFIG_HOME");
|
|
|
|
if(xdg_conf == NULL) {
|
|
|
|
CONFIG_LOCATION = utils_concat(2, home_dir, "/.config/wofi");
|
|
|
|
} else {
|
|
|
|
CONFIG_LOCATION = utils_concat(2, xdg_conf, "/wofi");
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* xdg_cache = getenv("XDG_CACHE_HOME");
|
|
|
|
if(xdg_cache == NULL) {
|
|
|
|
COLORS_LOCATION = utils_concat(2, home_dir, "/.cache/wal/colors");
|
|
|
|
} else {
|
|
|
|
COLORS_LOCATION = utils_concat(2, xdg_cache, "/wal/colors");
|
|
|
|
}
|
|
|
|
|
|
|
|
config = map_init();
|
|
|
|
|
|
|
|
//Check if --conf was specified
|
|
|
|
if(config_str == NULL) {
|
|
|
|
const char* config_f = "/config";
|
|
|
|
config_path = utils_concat(2, CONFIG_LOCATION, config_f);
|
|
|
|
} else {
|
|
|
|
config_path = strdup(config_str);
|
|
|
|
}
|
|
|
|
if(access(config_path, R_OK) == 0) {
|
|
|
|
config_load(config, config_path);
|
|
|
|
}
|
|
|
|
free(config_path);
|
|
|
|
|
2020-01-13 01:20:37 -05:00
|
|
|
if(style_str == NULL) {
|
|
|
|
style_str = map_get(config, "style");
|
|
|
|
}
|
|
|
|
|
2019-08-17 21:19:32 -04:00
|
|
|
//Check if --style was specified
|
|
|
|
if(style_str == NULL) {
|
|
|
|
style_str = map_get(config, "stylesheet");
|
|
|
|
if(style_str == NULL) {
|
|
|
|
const char* style_f = "/style.css";
|
|
|
|
stylesheet = utils_concat(2, CONFIG_LOCATION, style_f);
|
|
|
|
} else {
|
|
|
|
if(style_str[0] == '/') {
|
|
|
|
stylesheet = strdup(style_str);
|
|
|
|
} else {
|
|
|
|
stylesheet = utils_concat(3, CONFIG_LOCATION, "/", style_str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
stylesheet = strdup(style_str);
|
|
|
|
}
|
|
|
|
|
2020-01-13 01:20:37 -05:00
|
|
|
if(color_str == NULL) {
|
|
|
|
color_str = map_get(config, "color");
|
|
|
|
}
|
|
|
|
|
2019-08-17 21:19:32 -04:00
|
|
|
//Check if --color was specified
|
|
|
|
if(color_str == NULL) {
|
|
|
|
color_str = map_get(config, "colors");
|
|
|
|
if(color_str == NULL) {
|
|
|
|
color_path = strdup(COLORS_LOCATION);
|
|
|
|
} else {
|
|
|
|
if(color_str[0] == '/') {
|
|
|
|
color_path = strdup(color_str);
|
|
|
|
} else {
|
|
|
|
color_path = utils_concat(3, CONFIG_LOCATION, "/", color_str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
color_path = strdup(color_str);
|
|
|
|
}
|
|
|
|
|
add switch to use the dark gtk theme
Since some time now, GTK3 themes can ship an optional "dark" variant
and applications like picture viewers can make use of such a variant to
appear dark (to not distract from the picture) without overwriting the
current theme (and risking optical breakage). While wofi is not a
picture viewer it may still be desirable to use a dark theme, for
example to contrast the (light) application displaying in the
background.
Of course, wofi can already be fully customized through CSS and/or the
colors file, but using the existing dark variant may be easier than
fully restyling it, if all you want is a darker appearance. The only
way to set an arbitrary GTK application to use the dark theme seems to
be setting an environment variable, but that bears two problems:
For one, one needs to specify the full theme + dark modifier in the
variable, so one would have to keep the global GTK theme and the one
used by wofi manually in sync.
More critical though, the environment variable would be propagated to
the programs wofi launches (for now at least). That would lead to all
GTK applications launched through wofi to use the dark theme, which may
not be desirable. Wofi could also unset that variable before launching
a program, but at this point adding a simple switch is probably easier.
Side note: It may be that there is some way to configure the CSS file
to include the CSS of the dark variant of the current theme, but I have
not been able to find out how. Gnome-terminal uses a switch like this
too (just with dconf), so this may just be the way to go.
2020-03-03 06:09:55 -05:00
|
|
|
//Check if --gtk-dark was specified
|
|
|
|
if(gtk_dark == NULL) {
|
|
|
|
gtk_dark = map_get(config, "gtk_dark");
|
|
|
|
}
|
|
|
|
|
2019-08-17 21:19:32 -04:00
|
|
|
free(COLORS_LOCATION);
|
|
|
|
|
2020-01-25 02:36:56 -05:00
|
|
|
struct option_node* tmp;
|
|
|
|
wl_list_for_each_safe(node, tmp, &options, link) {
|
|
|
|
config_put(config, node->option);
|
|
|
|
wl_list_remove(&node->link);
|
|
|
|
free(node);
|
|
|
|
}
|
|
|
|
|
2019-11-01 19:57:24 -04:00
|
|
|
if(map_get(config, "show") != NULL) {
|
|
|
|
map_put(config, "mode", map_get(config, "show"));
|
|
|
|
}
|
|
|
|
|
2019-08-18 00:15:59 -04:00
|
|
|
if(strcmp(get_exec_name(argv[0]), "dmenu") == 0) {
|
|
|
|
map_put(config, "mode", "dmenu");
|
2019-11-06 03:17:22 -05:00
|
|
|
cache_file = "/dev/null";
|
2020-02-21 02:51:54 -05:00
|
|
|
} else if(strcmp(get_exec_name(argv[0]), "wofi-askpass") == 0) {
|
|
|
|
map_put(config, "mode", "dmenu");
|
|
|
|
cache_file = "/dev/null";
|
|
|
|
password_char = "*";
|
|
|
|
prompt = "Password";
|
2019-08-18 00:15:59 -04:00
|
|
|
} else if(mode != NULL) {
|
2019-08-17 21:19:32 -04:00
|
|
|
map_put(config, "mode", mode);
|
2019-08-17 21:40:48 -04:00
|
|
|
} else if(map_get(config, "mode") == NULL) {
|
|
|
|
fprintf(stderr, "I need a mode, please give me a mode, that's what --show is for\n");
|
|
|
|
exit(1);
|
2019-08-17 21:19:32 -04:00
|
|
|
}
|
2019-09-13 03:25:25 -04:00
|
|
|
|
|
|
|
map_put(config, "config_dir", CONFIG_LOCATION);
|
|
|
|
|
2019-08-17 21:19:32 -04:00
|
|
|
if(width != NULL) {
|
|
|
|
map_put(config, "width", width);
|
|
|
|
}
|
|
|
|
if(height != NULL) {
|
|
|
|
map_put(config, "height", height);
|
|
|
|
}
|
|
|
|
if(prompt != NULL) {
|
|
|
|
map_put(config, "prompt", prompt);
|
|
|
|
}
|
2019-11-01 19:57:24 -04:00
|
|
|
if(map_get(config, "xoffset") != NULL) {
|
|
|
|
map_put(config, "x", map_get(config, "xoffset"));
|
|
|
|
}
|
2019-08-17 21:19:32 -04:00
|
|
|
if(x != NULL) {
|
|
|
|
map_put(config, "x", x);
|
|
|
|
}
|
2019-11-01 19:57:24 -04:00
|
|
|
if(map_get(config, "yoffset") != NULL) {
|
|
|
|
map_put(config, "y", map_get(config, "yoffset"));
|
|
|
|
}
|
2019-08-17 21:19:32 -04:00
|
|
|
if(y != NULL) {
|
|
|
|
map_put(config, "y", y);
|
|
|
|
}
|
2019-08-17 22:22:09 -04:00
|
|
|
if(normal_window != NULL) {
|
|
|
|
map_put(config, "normal_window", normal_window);
|
|
|
|
}
|
2019-08-28 02:15:18 -04:00
|
|
|
if(allow_images != NULL) {
|
|
|
|
map_put(config, "allow_images", allow_images);
|
|
|
|
}
|
2019-08-28 03:58:45 -04:00
|
|
|
if(allow_markup != NULL) {
|
|
|
|
map_put(config, "allow_markup", allow_markup);
|
|
|
|
}
|
2019-08-28 23:14:38 -04:00
|
|
|
if(cache_file != NULL) {
|
|
|
|
map_put(config, "cache_file", cache_file);
|
|
|
|
}
|
2019-09-27 02:24:48 -04:00
|
|
|
if(terminal != NULL) {
|
|
|
|
map_put(config, "term", terminal);
|
|
|
|
}
|
2019-11-01 19:57:24 -04:00
|
|
|
if(map_get(config, "password") != NULL) {
|
|
|
|
map_put(config, "password_char", map_get(config, "password"));
|
|
|
|
}
|
2019-10-23 00:19:57 -04:00
|
|
|
if(password_char == NULL || (password_char != NULL && strcmp(password_char, "false") != 0)) {
|
|
|
|
if(password_char == NULL) {
|
|
|
|
password_char = "*";
|
|
|
|
}
|
|
|
|
map_put(config, "password_char", password_char);
|
|
|
|
}
|
2019-11-04 20:46:39 -05:00
|
|
|
if(exec_search != NULL) {
|
|
|
|
map_put(config, "exec_search", exec_search);
|
|
|
|
}
|
2019-11-18 16:42:40 -05:00
|
|
|
if(hide_scroll != NULL) {
|
|
|
|
map_put(config, "hide_scroll", hide_scroll);
|
|
|
|
}
|
2019-11-21 04:01:27 -05:00
|
|
|
if(matching != NULL) {
|
|
|
|
map_put(config, "matching", matching);
|
|
|
|
}
|
2019-11-25 17:56:46 -05:00
|
|
|
if(insensitive != NULL) {
|
|
|
|
map_put(config, "insensitive", insensitive);
|
|
|
|
}
|
2019-12-16 21:36:21 -05:00
|
|
|
if(parse_search != NULL) {
|
|
|
|
map_put(config, "parse_search", parse_search);
|
|
|
|
}
|
2020-01-06 03:28:57 -05:00
|
|
|
if(location != NULL) {
|
|
|
|
map_put(config, "location", location);
|
|
|
|
}
|
2020-01-10 17:34:49 -05:00
|
|
|
if(no_actions != NULL) {
|
|
|
|
map_put(config, "no_actions", no_actions);
|
|
|
|
}
|
2020-02-03 01:29:44 -05:00
|
|
|
if(lines != NULL) {
|
|
|
|
map_put(config, "lines", lines);
|
|
|
|
}
|
2020-02-06 21:22:50 -05:00
|
|
|
if(columns != NULL) {
|
|
|
|
map_put(config, "columns", columns);
|
|
|
|
}
|
2020-02-07 21:04:37 -05:00
|
|
|
if(sort_order != NULL) {
|
|
|
|
map_put(config, "sort_order", sort_order);
|
|
|
|
}
|
2020-06-14 06:03:00 -04:00
|
|
|
if(search != NULL) {
|
|
|
|
map_put(config, "search", search);
|
|
|
|
}
|
2020-07-18 16:32:05 -04:00
|
|
|
if(monitor != NULL) {
|
|
|
|
map_put(config, "monitor", monitor);
|
|
|
|
}
|
2021-10-29 15:34:49 -04:00
|
|
|
if(pre_display_cmd != NULL) {
|
|
|
|
map_put(config, "pre_display_cmd", pre_display_cmd);
|
|
|
|
}
|
2019-11-25 17:56:46 -05:00
|
|
|
|
2020-06-13 01:25:20 -04:00
|
|
|
struct sigaction sigact = {0};
|
2020-02-01 00:55:28 -05:00
|
|
|
sigact.sa_handler = sig;
|
|
|
|
sigaction(SIGTERM, &sigact, NULL);
|
|
|
|
|
2019-08-17 21:19:32 -04:00
|
|
|
|
|
|
|
gtk_init(&argc, &argv);
|
|
|
|
|
add switch to use the dark gtk theme
Since some time now, GTK3 themes can ship an optional "dark" variant
and applications like picture viewers can make use of such a variant to
appear dark (to not distract from the picture) without overwriting the
current theme (and risking optical breakage). While wofi is not a
picture viewer it may still be desirable to use a dark theme, for
example to contrast the (light) application displaying in the
background.
Of course, wofi can already be fully customized through CSS and/or the
colors file, but using the existing dark variant may be easier than
fully restyling it, if all you want is a darker appearance. The only
way to set an arbitrary GTK application to use the dark theme seems to
be setting an environment variable, but that bears two problems:
For one, one needs to specify the full theme + dark modifier in the
variable, so one would have to keep the global GTK theme and the one
used by wofi manually in sync.
More critical though, the environment variable would be propagated to
the programs wofi launches (for now at least). That would lead to all
GTK applications launched through wofi to use the dark theme, which may
not be desirable. Wofi could also unset that variable before launching
a program, but at this point adding a simple switch is probably easier.
Side note: It may be that there is some way to configure the CSS file
to include the CSS of the dark variant of the current theme, but I have
not been able to find out how. Gnome-terminal uses a switch like this
too (just with dconf), so this may just be the way to go.
2020-03-03 06:09:55 -05:00
|
|
|
if(gtk_dark != NULL && strcmp(gtk_dark, "true") == 0) {
|
|
|
|
g_object_set(gtk_settings_get_default(),
|
2020-03-05 22:51:49 -05:00
|
|
|
"gtk-application-prefer-dark-theme", TRUE, NULL);
|
add switch to use the dark gtk theme
Since some time now, GTK3 themes can ship an optional "dark" variant
and applications like picture viewers can make use of such a variant to
appear dark (to not distract from the picture) without overwriting the
current theme (and risking optical breakage). While wofi is not a
picture viewer it may still be desirable to use a dark theme, for
example to contrast the (light) application displaying in the
background.
Of course, wofi can already be fully customized through CSS and/or the
colors file, but using the existing dark variant may be easier than
fully restyling it, if all you want is a darker appearance. The only
way to set an arbitrary GTK application to use the dark theme seems to
be setting an environment variable, but that bears two problems:
For one, one needs to specify the full theme + dark modifier in the
variable, so one would have to keep the global GTK theme and the one
used by wofi manually in sync.
More critical though, the environment variable would be propagated to
the programs wofi launches (for now at least). That would lead to all
GTK applications launched through wofi to use the dark theme, which may
not be desirable. Wofi could also unset that variable before launching
a program, but at this point adding a simple switch is probably easier.
Side note: It may be that there is some way to configure the CSS file
to include the CSS of the dark variant of the current theme, but I have
not been able to find out how. Gnome-terminal uses a switch like this
too (just with dconf), so this may just be the way to go.
2020-03-03 06:09:55 -05:00
|
|
|
}
|
2020-02-29 05:27:59 -05:00
|
|
|
wofi_load_css(false);
|
2019-08-17 21:19:32 -04:00
|
|
|
|
|
|
|
wofi_init(config);
|
|
|
|
gtk_main();
|
|
|
|
return 0;
|
|
|
|
}
|