diff options
author | James Edwards-Jones <git@jamedjo.co.uk> | 2021-03-17 15:55:21 +0000 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-06-17 11:47:49 +0200 |
commit | d13090be546d19d487c872f7bc79bb98f8e17873 (patch) | |
tree | 60031d8768c0eedf93992c79155b89a208fdb7c8 /swaynag/config.c | |
parent | 75a4122f7a8b7313a090587d5e0074c7636c0fae (diff) |
swaynag: adds option to set wayland shell layer
Uses --layer/-y set to overlay|top|bottom|background
Diffstat (limited to 'swaynag/config.c')
-rw-r--r-- | swaynag/config.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/swaynag/config.c b/swaynag/config.c index c6b4e431..6db7cce5 100644 --- a/swaynag/config.c +++ b/swaynag/config.c @@ -59,6 +59,7 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag, {"config", required_argument, NULL, 'c'}, {"debug", no_argument, NULL, 'd'}, {"edge", required_argument, NULL, 'e'}, + {"layer", required_argument, NULL, 'y'}, {"font", required_argument, NULL, 'f'}, {"help", no_argument, NULL, 'h'}, {"detailed-message", no_argument, NULL, 'l'}, @@ -104,6 +105,8 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag, " -c, --config <path> Path to config file.\n" " -d, --debug Enable debugging.\n" " -e, --edge top|bottom Set the edge to use.\n" + " -y, --layer overlay|top|bottom|background\n" + " Set the layer to use.\n" " -f, --font <font> Set the font to use.\n" " -h, --help Show help message and quit.\n" " -l, --detailed-message Read a detailed message from stdin.\n" @@ -133,7 +136,7 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag, optind = 1; while (1) { - int c = getopt_long(argc, argv, "b:B:z:Z:c:de:f:hlL:m:o:s:t:v", opts, NULL); + int c = getopt_long(argc, argv, "b:B:z:Z:c:de:y:f:hlL:m:o:s:t:v", opts, NULL); if (c == -1) { break; } @@ -184,6 +187,24 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag, } } break; + case 'y': // Layer + if (type) { + if (strcmp(optarg, "background") == 0) { + type->layer = ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND; + } else if (strcmp(optarg, "bottom") == 0) { + type->layer = ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM; + } else if (strcmp(optarg, "top") == 0) { + type->layer = ZWLR_LAYER_SHELL_V1_LAYER_TOP; + } else if (strcmp(optarg, "overlay") == 0) { + type->layer = ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY; + } else { + fprintf(stderr, "Invalid layer: %s\n" + "Usage: --layer overlay|top|bottom|background\n", + optarg); + return EXIT_FAILURE; + } + } + break; case 'f': // Font if (type) { free(type->font); |