From 78002992393c655a6da133153143e448dde12984 Mon Sep 17 00:00:00 2001 From: Raheman Vaiya Date: Mon, 8 Aug 2022 21:07:44 -0400 Subject: [PATCH] config: Prevent the main layer from being toggled This is technically a backwards incompatible change, but is almost always a product of the user's misapprehension of the layer model. Better to just make it illegal and and issue a warning. --- src/descriptor.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/descriptor.c b/src/descriptor.c index 3c3a676..9be1be2 100644 --- a/src/descriptor.c +++ b/src/descriptor.c @@ -209,6 +209,11 @@ int parse_descriptor(const char *descstr, switch (type) { case ARG_LAYER: + if (!strcmp(argstr, "main")) { + err("the main layer cannot be toggled"); + return -1; + } + arg->idx = config_get_layer_index(config, argstr); if (arg->idx == -1 || config->layers[arg->idx].type == LT_LAYOUT) { err("%s is not a valid layer", argstr);