fix: argument protocol overriden by config file

This commit is contained in:
speedie 2023-06-02 19:00:09 +02:00
parent 692e3abc68
commit 17dd06139d
3 changed files with 7 additions and 1 deletions

View file

@ -21,8 +21,10 @@ void readargs(int argc, char *argv[]) {
loadbinds = 0;
} else if (!strcmp(argv[j], "-x11") || (!strcmp(argv[j], "--x11"))) {
protocol = 0;
protocol_override = 1;
} else if (!strcmp(argv[j], "-wl") || (!strcmp(argv[j], "--wayland"))) {
protocol = 1;
protocol_override = 1;
#if USECONFIG
} else if (!strcmp(argv[j], "-cf") || (!strcmp(argv[j], "--config-file"))) { // specify a config file
if (argv[j+1]) {

View file

@ -76,9 +76,12 @@ void conf_init(void) {
config_setting_lookup_int(conf, "managed", &managed); // spmenu.window.managed
config_setting_lookup_int(conf, "monitor", &mon); // spmenu.window.monitor
config_setting_lookup_int(conf, "alpha", &alpha); // spmenu.window.alpha
if (!protocol_override) {
config_setting_lookup_int(conf, "protocol", &protocol); // spmenu.window.protocol
}
}
}
// load options spmenu.properties
config_setting_t *prop_setting = config_lookup(&cfg, "spmenu.properties");

View file

@ -137,6 +137,7 @@ static int hplength = 0; // high priority
static char **hpitems = NULL; // high priority
static int *sel_index = NULL;
static unsigned int sel_size = 0;
static int protocol_override = 0;
static int itemn = 0; // item number
static char *embed; // X11 embed