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 | fix typo in sway-output.5.scd (diff) | |
download | sway-d13090be546d19d487c872f7bc79bb98f8e17873.tar.gz sway-d13090be546d19d487c872f7bc79bb98f8e17873.tar.zst sway-d13090be546d19d487c872f7bc79bb98f8e17873.zip |
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, | |||
59 | {"config", required_argument, NULL, 'c'}, | 59 | {"config", required_argument, NULL, 'c'}, |
60 | {"debug", no_argument, NULL, 'd'}, | 60 | {"debug", no_argument, NULL, 'd'}, |
61 | {"edge", required_argument, NULL, 'e'}, | 61 | {"edge", required_argument, NULL, 'e'}, |
62 | {"layer", required_argument, NULL, 'y'}, | ||
62 | {"font", required_argument, NULL, 'f'}, | 63 | {"font", required_argument, NULL, 'f'}, |
63 | {"help", no_argument, NULL, 'h'}, | 64 | {"help", no_argument, NULL, 'h'}, |
64 | {"detailed-message", no_argument, NULL, 'l'}, | 65 | {"detailed-message", no_argument, NULL, 'l'}, |
@@ -104,6 +105,8 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag, | |||
104 | " -c, --config <path> Path to config file.\n" | 105 | " -c, --config <path> Path to config file.\n" |
105 | " -d, --debug Enable debugging.\n" | 106 | " -d, --debug Enable debugging.\n" |
106 | " -e, --edge top|bottom Set the edge to use.\n" | 107 | " -e, --edge top|bottom Set the edge to use.\n" |
108 | " -y, --layer overlay|top|bottom|background\n" | ||
109 | " Set the layer to use.\n" | ||
107 | " -f, --font <font> Set the font to use.\n" | 110 | " -f, --font <font> Set the font to use.\n" |
108 | " -h, --help Show help message and quit.\n" | 111 | " -h, --help Show help message and quit.\n" |
109 | " -l, --detailed-message Read a detailed message from stdin.\n" | 112 | " -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, | |||
133 | 136 | ||
134 | optind = 1; | 137 | optind = 1; |
135 | while (1) { | 138 | while (1) { |
136 | int c = getopt_long(argc, argv, "b:B:z:Z:c:de:f:hlL:m:o:s:t:v", opts, NULL); | 139 | int c = getopt_long(argc, argv, "b:B:z:Z:c:de:y:f:hlL:m:o:s:t:v", opts, NULL); |
137 | if (c == -1) { | 140 | if (c == -1) { |
138 | break; | 141 | break; |
139 | } | 142 | } |
@@ -184,6 +187,24 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag, | |||
184 | } | 187 | } |
185 | } | 188 | } |
186 | break; | 189 | break; |
190 | case 'y': // Layer | ||
191 | if (type) { | ||
192 | if (strcmp(optarg, "background") == 0) { | ||
193 | type->layer = ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND; | ||
194 | } else if (strcmp(optarg, "bottom") == 0) { | ||
195 | type->layer = ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM; | ||
196 | } else if (strcmp(optarg, "top") == 0) { | ||
197 | type->layer = ZWLR_LAYER_SHELL_V1_LAYER_TOP; | ||
198 | } else if (strcmp(optarg, "overlay") == 0) { | ||
199 | type->layer = ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY; | ||
200 | } else { | ||
201 | fprintf(stderr, "Invalid layer: %s\n" | ||
202 | "Usage: --layer overlay|top|bottom|background\n", | ||
203 | optarg); | ||
204 | return EXIT_FAILURE; | ||
205 | } | ||
206 | } | ||
207 | break; | ||
187 | case 'f': // Font | 208 | case 'f': // Font |
188 | if (type) { | 209 | if (type) { |
189 | free(type->font); | 210 | free(type->font); |