This commit is contained in:
Wsevolod 2026-03-27 15:19:56 +00:00 committed by GitHub
commit de6ffce506
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 3 deletions

View file

@ -100,6 +100,7 @@ struct swaynag {
char *message; char *message;
list_t *buttons; list_t *buttons;
struct swaynag_details details; struct swaynag_details details;
bool no_dock;
}; };
void swaynag_setup(struct swaynag *swaynag); void swaynag_setup(struct swaynag *swaynag);

View file

@ -80,6 +80,7 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag,
{"detailed-message", no_argument, NULL, 'l'}, {"detailed-message", no_argument, NULL, 'l'},
{"detailed-button", required_argument, NULL, 'L'}, {"detailed-button", required_argument, NULL, 'L'},
{"message", required_argument, NULL, 'm'}, {"message", required_argument, NULL, 'm'},
{"no-dock", no_argument, NULL, 'n'},
{"output", required_argument, NULL, 'o'}, {"output", required_argument, NULL, 'o'},
{"dismiss-button", required_argument, NULL, 's'}, {"dismiss-button", required_argument, NULL, 's'},
{"type", required_argument, NULL, 't'}, {"type", required_argument, NULL, 't'},
@ -127,6 +128,7 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag,
" -l, --detailed-message Read a detailed message from stdin.\n" " -l, --detailed-message Read a detailed message from stdin.\n"
" -L, --detailed-button <text> Set the text of the detail button.\n" " -L, --detailed-button <text> Set the text of the detail button.\n"
" -m, --message <msg> Set the message text.\n" " -m, --message <msg> Set the message text.\n"
" -n, --no-dock Do not set the exclusive zone.\n"
" -o, --output <output> Set the output to use.\n" " -o, --output <output> Set the output to use.\n"
" -s, --dismiss-button <text> Set the dismiss button text.\n" " -s, --dismiss-button <text> Set the dismiss button text.\n"
" -t, --type <type> Set the message type.\n" " -t, --type <type> Set the message type.\n"
@ -151,7 +153,7 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag,
optind = 1; optind = 1;
while (1) { while (1) {
int c = getopt_long(argc, argv, "b:B:z:Z:c:de:y: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:nv", opts, NULL);
if (c == -1) { if (c == -1) {
break; break;
} }
@ -252,6 +254,11 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag,
swaynag->message = strdup(optarg); swaynag->message = strdup(optarg);
} }
break; break;
case 'n':
if (swaynag) {
swaynag->no_dock = true;
}
break;
case 'o': // Output case 'o': // Output
if (type) { if (type) {
free(type->output); free(type->output);

View file

@ -264,8 +264,10 @@ void render_frame(struct swaynag *swaynag) {
uint32_t height = render_to_cairo(cairo, swaynag); uint32_t height = render_to_cairo(cairo, swaynag);
if (height != swaynag->height) { if (height != swaynag->height) {
zwlr_layer_surface_v1_set_size(swaynag->layer_surface, 0, height); zwlr_layer_surface_v1_set_size(swaynag->layer_surface, 0, height);
zwlr_layer_surface_v1_set_exclusive_zone(swaynag->layer_surface, if (!swaynag->no_dock) {
height); zwlr_layer_surface_v1_set_exclusive_zone(swaynag->layer_surface,
height);
}
wl_surface_commit(swaynag->surface); wl_surface_commit(swaynag->surface);
wl_display_roundtrip(swaynag->display); wl_display_roundtrip(swaynag->display);
} else { } else {