diff options
-rw-r--r-- | include/sway/commands.h | 2 | ||||
-rw-r--r-- | include/sway/config.h | 3 | ||||
-rw-r--r-- | include/sway/tree/container.h | 6 | ||||
-rw-r--r-- | meson.build | 17 | ||||
-rw-r--r-- | sway/commands.c | 2 | ||||
-rw-r--r-- | sway/commands/titlebar_border_thickness.c | 30 | ||||
-rw-r--r-- | sway/commands/titlebar_padding.c | 42 | ||||
-rw-r--r-- | sway/config.c | 4 | ||||
-rw-r--r-- | sway/desktop/render.c | 71 | ||||
-rw-r--r-- | sway/meson.build | 2 | ||||
-rw-r--r-- | sway/sway.5.scd | 10 | ||||
-rw-r--r-- | sway/tree/container.c | 2 |
12 files changed, 135 insertions, 56 deletions
diff --git a/include/sway/commands.h b/include/sway/commands.h index b0339313..e6036e51 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h | |||
@@ -173,6 +173,8 @@ sway_cmd cmd_swaynag_command; | |||
173 | sway_cmd cmd_swap; | 173 | sway_cmd cmd_swap; |
174 | sway_cmd cmd_tiling_drag; | 174 | sway_cmd cmd_tiling_drag; |
175 | sway_cmd cmd_title_format; | 175 | sway_cmd cmd_title_format; |
176 | sway_cmd cmd_titlebar_border_thickness; | ||
177 | sway_cmd cmd_titlebar_padding; | ||
176 | sway_cmd cmd_unmark; | 178 | sway_cmd cmd_unmark; |
177 | sway_cmd cmd_urgent; | 179 | sway_cmd cmd_urgent; |
178 | sway_cmd cmd_workspace; | 180 | sway_cmd cmd_workspace; |
diff --git a/include/sway/config.h b/include/sway/config.h index 4927b8e0..a6920835 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -391,6 +391,9 @@ struct sway_config { | |||
391 | size_t font_height; | 391 | size_t font_height; |
392 | size_t font_baseline; | 392 | size_t font_baseline; |
393 | bool pango_markup; | 393 | bool pango_markup; |
394 | int titlebar_border_thickness; | ||
395 | int titlebar_h_padding; | ||
396 | int titlebar_v_padding; | ||
394 | size_t urgent_timeout; | 397 | size_t urgent_timeout; |
395 | enum sway_fowa focus_on_window_activation; | 398 | enum sway_fowa focus_on_window_activation; |
396 | enum sway_popup_during_fullscreen popup_during_fullscreen; | 399 | enum sway_popup_during_fullscreen popup_during_fullscreen; |
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index f907aad2..1d0a0ad1 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -10,12 +10,6 @@ | |||
10 | struct sway_view; | 10 | struct sway_view; |
11 | struct sway_seat; | 11 | struct sway_seat; |
12 | 12 | ||
13 | #define TITLEBAR_BORDER_THICKNESS 1 | ||
14 | |||
15 | // Padding includes titlebar border | ||
16 | #define TITLEBAR_H_PADDING 3 | ||
17 | #define TITLEBAR_V_PADDING 4 | ||
18 | |||
19 | enum sway_container_layout { | 13 | enum sway_container_layout { |
20 | L_NONE, | 14 | L_NONE, |
21 | L_HORIZ, | 15 | L_HORIZ, |
diff --git a/meson.build b/meson.build index bb60bc89..810a657e 100644 --- a/meson.build +++ b/meson.build | |||
@@ -108,13 +108,7 @@ if scdoc.found() | |||
108 | endforeach | 108 | endforeach |
109 | endif | 109 | endif |
110 | 110 | ||
111 | # If prefix is '/usr', sysconfdir will be explicitly set to '/etc' by Meson to | 111 | add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir)), language : 'c') |
112 | # enforce FHS compliance, so we should look for configs there as well. | ||
113 | if prefix == '/usr' | ||
114 | add_project_arguments('-DSYSCONFDIR="/@0@"'.format(sysconfdir), language : 'c') | ||
115 | else | ||
116 | add_project_arguments('-DSYSCONFDIR="/@0@/@1@"'.format(prefix, sysconfdir), language : 'c') | ||
117 | endif | ||
118 | 112 | ||
119 | version = get_option('sway-version') | 113 | version = get_option('sway-version') |
120 | if version != '' | 114 | if version != '' |
@@ -159,14 +153,7 @@ subdir('swaylock') | |||
159 | config = configuration_data() | 153 | config = configuration_data() |
160 | config.set('datadir', join_paths(prefix, datadir)) | 154 | config.set('datadir', join_paths(prefix, datadir)) |
161 | config.set('prefix', prefix) | 155 | config.set('prefix', prefix) |
162 | 156 | config.set('sysconfdir', join_paths(prefix, sysconfdir)) | |
163 | # If prefix is '/usr', sysconfdir will be explicitly set to '/etc' by Meson to | ||
164 | # enforce FHS compliance, so we should look for configs there as well. | ||
165 | if prefix == '/usr' | ||
166 | config.set('sysconfdir', sysconfdir) | ||
167 | else | ||
168 | config.set('sysconfdir', join_paths(prefix, sysconfdir)) | ||
169 | endif | ||
170 | 157 | ||
171 | configure_file( | 158 | configure_file( |
172 | configuration: config, | 159 | configuration: config, |
diff --git a/sway/commands.c b/sway/commands.c index 4b86c2fa..d35658d5 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -103,6 +103,8 @@ static struct cmd_handler handlers[] = { | |||
103 | { "smart_borders", cmd_smart_borders }, | 103 | { "smart_borders", cmd_smart_borders }, |
104 | { "smart_gaps", cmd_smart_gaps }, | 104 | { "smart_gaps", cmd_smart_gaps }, |
105 | { "tiling_drag", cmd_tiling_drag }, | 105 | { "tiling_drag", cmd_tiling_drag }, |
106 | { "titlebar_border_thickness", cmd_titlebar_border_thickness }, | ||
107 | { "titlebar_padding", cmd_titlebar_padding }, | ||
106 | { "workspace", cmd_workspace }, | 108 | { "workspace", cmd_workspace }, |
107 | { "workspace_auto_back_and_forth", cmd_ws_auto_back_and_forth }, | 109 | { "workspace_auto_back_and_forth", cmd_ws_auto_back_and_forth }, |
108 | }; | 110 | }; |
diff --git a/sway/commands/titlebar_border_thickness.c b/sway/commands/titlebar_border_thickness.c new file mode 100644 index 00000000..c1e9bb52 --- /dev/null +++ b/sway/commands/titlebar_border_thickness.c | |||
@@ -0,0 +1,30 @@ | |||
1 | #include <string.h> | ||
2 | #include "sway/commands.h" | ||
3 | #include "sway/config.h" | ||
4 | #include "sway/output.h" | ||
5 | #include "sway/tree/arrange.h" | ||
6 | #include "log.h" | ||
7 | |||
8 | struct cmd_results *cmd_titlebar_border_thickness(int argc, char **argv) { | ||
9 | struct cmd_results *error = NULL; | ||
10 | if ((error = checkarg(argc, "titlebar_border_thickness", EXPECTED_EQUAL_TO, 1))) { | ||
11 | return error; | ||
12 | } | ||
13 | |||
14 | char *inv; | ||
15 | int value = strtol(argv[0], &inv, 10); | ||
16 | if (*inv != '\0' || value < 0 || value > config->titlebar_v_padding) { | ||
17 | return cmd_results_new(CMD_FAILURE, "titlebar_border_thickness", | ||
18 | "Invalid size specified"); | ||
19 | } | ||
20 | |||
21 | config->titlebar_border_thickness = value; | ||
22 | |||
23 | for (int i = 0; i < root->outputs->length; ++i) { | ||
24 | struct sway_output *output = root->outputs->items[i]; | ||
25 | arrange_workspace(output_get_active_workspace(output)); | ||
26 | output_damage_whole(output); | ||
27 | } | ||
28 | |||
29 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
30 | } | ||
diff --git a/sway/commands/titlebar_padding.c b/sway/commands/titlebar_padding.c new file mode 100644 index 00000000..a642e945 --- /dev/null +++ b/sway/commands/titlebar_padding.c | |||
@@ -0,0 +1,42 @@ | |||
1 | #include <string.h> | ||
2 | #include "sway/commands.h" | ||
3 | #include "sway/config.h" | ||
4 | #include "sway/output.h" | ||
5 | #include "sway/tree/arrange.h" | ||
6 | #include "log.h" | ||
7 | |||
8 | struct cmd_results *cmd_titlebar_padding(int argc, char **argv) { | ||
9 | struct cmd_results *error = NULL; | ||
10 | if ((error = checkarg(argc, "titlebar_padding", EXPECTED_AT_LEAST, 1))) { | ||
11 | return error; | ||
12 | } | ||
13 | |||
14 | char *inv; | ||
15 | int h_value = strtol(argv[0], &inv, 10); | ||
16 | if (*inv != '\0' || h_value < 0 || h_value < config->titlebar_border_thickness) { | ||
17 | return cmd_results_new(CMD_FAILURE, "titlebar_padding", | ||
18 | "Invalid size specified"); | ||
19 | } | ||
20 | |||
21 | int v_value; | ||
22 | if (argc == 1) { | ||
23 | v_value = h_value; | ||
24 | } else { | ||
25 | v_value = strtol(argv[1], &inv, 10); | ||
26 | if (*inv != '\0' || v_value < 0 || v_value < config->titlebar_border_thickness) { | ||
27 | return cmd_results_new(CMD_FAILURE, "titlebar_padding", | ||
28 | "Invalid size specified"); | ||
29 | } | ||
30 | } | ||
31 | |||
32 | config->titlebar_v_padding = v_value; | ||
33 | config->titlebar_h_padding = h_value; | ||
34 | |||
35 | for (int i = 0; i < root->outputs->length; ++i) { | ||
36 | struct sway_output *output = root->outputs->items[i]; | ||
37 | arrange_workspace(output_get_active_workspace(output)); | ||
38 | output_damage_whole(output); | ||
39 | } | ||
40 | |||
41 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
42 | } | ||
diff --git a/sway/config.c b/sway/config.c index c1320acf..59edc6d8 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -213,6 +213,10 @@ static void config_defaults(struct sway_config *config) { | |||
213 | config->urgent_timeout = 500; | 213 | config->urgent_timeout = 500; |
214 | config->popup_during_fullscreen = POPUP_SMART; | 214 | config->popup_during_fullscreen = POPUP_SMART; |
215 | 215 | ||
216 | config->titlebar_border_thickness = 1; | ||
217 | config->titlebar_h_padding = 5; | ||
218 | config->titlebar_v_padding = 4; | ||
219 | |||
216 | // floating view | 220 | // floating view |
217 | config->floating_maximum_width = 0; | 221 | config->floating_maximum_width = 0; |
218 | config->floating_maximum_height = 0; | 222 | config->floating_maximum_height = 0; |
diff --git a/sway/desktop/render.c b/sway/desktop/render.c index 8d4a701b..51cb8980 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c | |||
@@ -368,6 +368,9 @@ static void render_titlebar(struct sway_output *output, | |||
368 | children->items[children->length - 1] == con; | 368 | children->items[children->length - 1] == con; |
369 | double output_x = output->wlr_output->lx; | 369 | double output_x = output->wlr_output->lx; |
370 | double output_y = output->wlr_output->ly; | 370 | double output_y = output->wlr_output->ly; |
371 | int titlebar_border_thickness = config->titlebar_border_thickness; | ||
372 | int titlebar_h_padding = config->titlebar_h_padding; | ||
373 | int titlebar_v_padding = config->titlebar_v_padding; | ||
371 | 374 | ||
372 | // Single pixel bar above title | 375 | // Single pixel bar above title |
373 | memcpy(&color, colors->border, sizeof(float) * 4); | 376 | memcpy(&color, colors->border, sizeof(float) * 4); |
@@ -375,7 +378,7 @@ static void render_titlebar(struct sway_output *output, | |||
375 | box.x = x; | 378 | box.x = x; |
376 | box.y = y; | 379 | box.y = y; |
377 | box.width = width; | 380 | box.width = width; |
378 | box.height = TITLEBAR_BORDER_THICKNESS; | 381 | box.height = titlebar_border_thickness; |
379 | scale_box(&box, output_scale); | 382 | scale_box(&box, output_scale); |
380 | render_rect(output->wlr_output, output_damage, &box, color); | 383 | render_rect(output->wlr_output, output_damage, &box, color); |
381 | 384 | ||
@@ -391,36 +394,36 @@ static void render_titlebar(struct sway_output *output, | |||
391 | } | 394 | } |
392 | } | 395 | } |
393 | box.x = x + left_offset; | 396 | box.x = x + left_offset; |
394 | box.y = y + container_titlebar_height() - TITLEBAR_BORDER_THICKNESS; | 397 | box.y = y + container_titlebar_height() - titlebar_border_thickness; |
395 | box.width = width - left_offset - right_offset; | 398 | box.width = width - left_offset - right_offset; |
396 | box.height = TITLEBAR_BORDER_THICKNESS; | 399 | box.height = titlebar_border_thickness; |
397 | scale_box(&box, output_scale); | 400 | scale_box(&box, output_scale); |
398 | render_rect(output->wlr_output, output_damage, &box, color); | 401 | render_rect(output->wlr_output, output_damage, &box, color); |
399 | 402 | ||
400 | if (layout == L_TABBED) { | 403 | if (layout == L_TABBED) { |
401 | // Single pixel left edge | 404 | // Single pixel left edge |
402 | box.x = x; | 405 | box.x = x; |
403 | box.y = y + TITLEBAR_BORDER_THICKNESS; | 406 | box.y = y + titlebar_border_thickness; |
404 | box.width = TITLEBAR_BORDER_THICKNESS; | 407 | box.width = titlebar_border_thickness; |
405 | box.height = | 408 | box.height = |
406 | container_titlebar_height() - TITLEBAR_BORDER_THICKNESS * 2; | 409 | container_titlebar_height() - titlebar_border_thickness * 2; |
407 | scale_box(&box, output_scale); | 410 | scale_box(&box, output_scale); |
408 | render_rect(output->wlr_output, output_damage, &box, color); | 411 | render_rect(output->wlr_output, output_damage, &box, color); |
409 | 412 | ||
410 | // Single pixel right edge | 413 | // Single pixel right edge |
411 | box.x = x + width - TITLEBAR_BORDER_THICKNESS; | 414 | box.x = x + width - titlebar_border_thickness; |
412 | box.y = y + TITLEBAR_BORDER_THICKNESS; | 415 | box.y = y + titlebar_border_thickness; |
413 | box.width = TITLEBAR_BORDER_THICKNESS; | 416 | box.width = titlebar_border_thickness; |
414 | box.height = | 417 | box.height = |
415 | container_titlebar_height() - TITLEBAR_BORDER_THICKNESS * 2; | 418 | container_titlebar_height() - titlebar_border_thickness * 2; |
416 | scale_box(&box, output_scale); | 419 | scale_box(&box, output_scale); |
417 | render_rect(output->wlr_output, output_damage, &box, color); | 420 | render_rect(output->wlr_output, output_damage, &box, color); |
418 | } | 421 | } |
419 | 422 | ||
420 | size_t inner_width = width - TITLEBAR_H_PADDING * 2; | 423 | size_t inner_width = width - titlebar_h_padding * 2; |
421 | int bg_y = y + TITLEBAR_BORDER_THICKNESS; | 424 | int bg_y = y + titlebar_border_thickness; |
422 | int ob_bg_height = scale_length( | 425 | int ob_bg_height = scale_length( |
423 | (TITLEBAR_V_PADDING - TITLEBAR_BORDER_THICKNESS) * 2 + | 426 | (titlebar_v_padding - titlebar_border_thickness) * 2 + |
424 | config->font_height, bg_y, output_scale); | 427 | config->font_height, bg_y, output_scale); |
425 | 428 | ||
426 | // Marks | 429 | // Marks |
@@ -438,7 +441,7 @@ static void render_titlebar(struct sway_output *output, | |||
438 | int ob_padding_below = ceil(ob_padding_total / 2.0); | 441 | int ob_padding_below = ceil(ob_padding_total / 2.0); |
439 | 442 | ||
440 | // Render texture | 443 | // Render texture |
441 | texture_box.x = round((x - output_x + width - TITLEBAR_H_PADDING) | 444 | texture_box.x = round((x - output_x + width - titlebar_h_padding) |
442 | * output_scale) - texture_box.width; | 445 | * output_scale) - texture_box.width; |
443 | texture_box.y = round((bg_y - output_y) * output_scale) + | 446 | texture_box.y = round((bg_y - output_y) * output_scale) + |
444 | ob_padding_above; | 447 | ob_padding_above; |
@@ -458,7 +461,7 @@ static void render_titlebar(struct sway_output *output, | |||
458 | memcpy(&color, colors->background, sizeof(float) * 4); | 461 | memcpy(&color, colors->background, sizeof(float) * 4); |
459 | premultiply_alpha(color, con->alpha); | 462 | premultiply_alpha(color, con->alpha); |
460 | box.x = texture_box.x + round(output_x * output_scale); | 463 | box.x = texture_box.x + round(output_x * output_scale); |
461 | box.y = round((y + TITLEBAR_BORDER_THICKNESS) * output_scale); | 464 | box.y = round((y + titlebar_border_thickness) * output_scale); |
462 | box.width = texture_box.width; | 465 | box.width = texture_box.width; |
463 | box.height = ob_padding_above; | 466 | box.height = ob_padding_above; |
464 | render_rect(output->wlr_output, output_damage, &box, color); | 467 | render_rect(output->wlr_output, output_damage, &box, color); |
@@ -480,14 +483,14 @@ static void render_titlebar(struct sway_output *output, | |||
480 | // The title texture might be shorter than the config->font_height, | 483 | // The title texture might be shorter than the config->font_height, |
481 | // in which case we need to pad it above and below. | 484 | // in which case we need to pad it above and below. |
482 | int ob_padding_above = round((config->font_baseline - | 485 | int ob_padding_above = round((config->font_baseline - |
483 | con->title_baseline + TITLEBAR_V_PADDING - | 486 | con->title_baseline + titlebar_v_padding - |
484 | TITLEBAR_BORDER_THICKNESS) * output_scale); | 487 | titlebar_border_thickness) * output_scale); |
485 | int ob_padding_below = ob_bg_height - ob_padding_above - | 488 | int ob_padding_below = ob_bg_height - ob_padding_above - |
486 | texture_box.height; | 489 | texture_box.height; |
487 | 490 | ||
488 | // Render texture | 491 | // Render texture |
489 | texture_box.x = | 492 | texture_box.x = |
490 | round((x - output_x + TITLEBAR_H_PADDING) * output_scale); | 493 | round((x - output_x + titlebar_h_padding) * output_scale); |
491 | texture_box.y = | 494 | texture_box.y = |
492 | round((bg_y - output_y) * output_scale) + ob_padding_above; | 495 | round((bg_y - output_y) * output_scale) + ob_padding_above; |
493 | 496 | ||
@@ -496,7 +499,7 @@ static void render_titlebar(struct sway_output *output, | |||
496 | WL_OUTPUT_TRANSFORM_NORMAL, | 499 | WL_OUTPUT_TRANSFORM_NORMAL, |
497 | 0.0, output->wlr_output->transform_matrix); | 500 | 0.0, output->wlr_output->transform_matrix); |
498 | 501 | ||
499 | int inner_x = x - output_x + TITLEBAR_H_PADDING; | 502 | int inner_x = x - output_x + titlebar_h_padding; |
500 | int ob_inner_width = scale_length(inner_width, inner_x, output_scale); | 503 | int ob_inner_width = scale_length(inner_width, inner_x, output_scale); |
501 | if (ob_inner_width - marks_ob_width < texture_box.width) { | 504 | if (ob_inner_width - marks_ob_width < texture_box.width) { |
502 | texture_box.width = ob_inner_width - marks_ob_width; | 505 | texture_box.width = ob_inner_width - marks_ob_width; |
@@ -508,7 +511,7 @@ static void render_titlebar(struct sway_output *output, | |||
508 | memcpy(&color, colors->background, sizeof(float) * 4); | 511 | memcpy(&color, colors->background, sizeof(float) * 4); |
509 | premultiply_alpha(color, con->alpha); | 512 | premultiply_alpha(color, con->alpha); |
510 | box.x = texture_box.x + round(output_x * output_scale); | 513 | box.x = texture_box.x + round(output_x * output_scale); |
511 | box.y = round((y + TITLEBAR_BORDER_THICKNESS) * output_scale); | 514 | box.y = round((y + titlebar_border_thickness) * output_scale); |
512 | box.width = texture_box.width; | 515 | box.width = texture_box.width; |
513 | box.height = ob_padding_above; | 516 | box.height = ob_padding_above; |
514 | render_rect(output->wlr_output, output_damage, &box, color); | 517 | render_rect(output->wlr_output, output_damage, &box, color); |
@@ -523,28 +526,28 @@ static void render_titlebar(struct sway_output *output, | |||
523 | box.width = | 526 | box.width = |
524 | round(inner_width * output_scale) - title_ob_width - marks_ob_width; | 527 | round(inner_width * output_scale) - title_ob_width - marks_ob_width; |
525 | if (box.width > 0) { | 528 | if (box.width > 0) { |
526 | box.x = round((x + TITLEBAR_H_PADDING) * output_scale) + title_ob_width; | 529 | box.x = round((x + titlebar_h_padding) * output_scale) + title_ob_width; |
527 | box.y = round(bg_y * output_scale); | 530 | box.y = round(bg_y * output_scale); |
528 | box.height = ob_bg_height; | 531 | box.height = ob_bg_height; |
529 | render_rect(output->wlr_output, output_damage, &box, color); | 532 | render_rect(output->wlr_output, output_damage, &box, color); |
530 | } | 533 | } |
531 | 534 | ||
532 | // Padding left of title | 535 | // Padding left of title |
533 | left_offset = (layout == L_TABBED) * TITLEBAR_BORDER_THICKNESS; | 536 | left_offset = (layout == L_TABBED) * titlebar_border_thickness; |
534 | box.x = x + left_offset; | 537 | box.x = x + left_offset; |
535 | box.y = y + TITLEBAR_BORDER_THICKNESS; | 538 | box.y = y + titlebar_border_thickness; |
536 | box.width = TITLEBAR_H_PADDING - left_offset; | 539 | box.width = titlebar_h_padding - left_offset; |
537 | box.height = (TITLEBAR_V_PADDING - TITLEBAR_BORDER_THICKNESS) * 2 + | 540 | box.height = (titlebar_v_padding - titlebar_border_thickness) * 2 + |
538 | config->font_height; | 541 | config->font_height; |
539 | scale_box(&box, output_scale); | 542 | scale_box(&box, output_scale); |
540 | render_rect(output->wlr_output, output_damage, &box, color); | 543 | render_rect(output->wlr_output, output_damage, &box, color); |
541 | 544 | ||
542 | // Padding right of marks | 545 | // Padding right of marks |
543 | right_offset = (layout == L_TABBED) * TITLEBAR_BORDER_THICKNESS; | 546 | right_offset = (layout == L_TABBED) * titlebar_border_thickness; |
544 | box.x = x + width - TITLEBAR_H_PADDING; | 547 | box.x = x + width - titlebar_h_padding; |
545 | box.y = y + TITLEBAR_BORDER_THICKNESS; | 548 | box.y = y + titlebar_border_thickness; |
546 | box.width = TITLEBAR_H_PADDING - right_offset; | 549 | box.width = titlebar_h_padding - right_offset; |
547 | box.height = (TITLEBAR_V_PADDING - TITLEBAR_BORDER_THICKNESS) * 2 + | 550 | box.height = (titlebar_v_padding - titlebar_border_thickness) * 2 + |
548 | config->font_height; | 551 | config->font_height; |
549 | scale_box(&box, output_scale); | 552 | scale_box(&box, output_scale); |
550 | render_rect(output->wlr_output, output_damage, &box, color); | 553 | render_rect(output->wlr_output, output_damage, &box, color); |
@@ -552,17 +555,17 @@ static void render_titlebar(struct sway_output *output, | |||
552 | if (connects_sides) { | 555 | if (connects_sides) { |
553 | // Left pixel in line with bottom bar | 556 | // Left pixel in line with bottom bar |
554 | box.x = x; | 557 | box.x = x; |
555 | box.y = y + container_titlebar_height() - TITLEBAR_BORDER_THICKNESS; | 558 | box.y = y + container_titlebar_height() - titlebar_border_thickness; |
556 | box.width = state->border_thickness * state->border_left; | 559 | box.width = state->border_thickness * state->border_left; |
557 | box.height = TITLEBAR_BORDER_THICKNESS; | 560 | box.height = titlebar_border_thickness; |
558 | scale_box(&box, output_scale); | 561 | scale_box(&box, output_scale); |
559 | render_rect(output->wlr_output, output_damage, &box, color); | 562 | render_rect(output->wlr_output, output_damage, &box, color); |
560 | 563 | ||
561 | // Right pixel in line with bottom bar | 564 | // Right pixel in line with bottom bar |
562 | box.x = x + width - state->border_thickness * state->border_right; | 565 | box.x = x + width - state->border_thickness * state->border_right; |
563 | box.y = y + container_titlebar_height() - TITLEBAR_BORDER_THICKNESS; | 566 | box.y = y + container_titlebar_height() - titlebar_border_thickness; |
564 | box.width = state->border_thickness * state->border_right; | 567 | box.width = state->border_thickness * state->border_right; |
565 | box.height = TITLEBAR_BORDER_THICKNESS; | 568 | box.height = titlebar_border_thickness; |
566 | scale_box(&box, output_scale); | 569 | scale_box(&box, output_scale); |
567 | render_rect(output->wlr_output, output_damage, &box, color); | 570 | render_rect(output->wlr_output, output_damage, &box, color); |
568 | } | 571 | } |
diff --git a/sway/meson.build b/sway/meson.build index 14822dbd..c8c95a96 100644 --- a/sway/meson.build +++ b/sway/meson.build | |||
@@ -89,6 +89,8 @@ sway_sources = files( | |||
89 | 'commands/swap.c', | 89 | 'commands/swap.c', |
90 | 'commands/tiling_drag.c', | 90 | 'commands/tiling_drag.c', |
91 | 'commands/title_format.c', | 91 | 'commands/title_format.c', |
92 | 'commands/titlebar_border_thickness.c', | ||
93 | 'commands/titlebar_padding.c', | ||
92 | 'commands/unmark.c', | 94 | 'commands/unmark.c', |
93 | 'commands/urgent.c', | 95 | 'commands/urgent.c', |
94 | 'commands/workspace.c', | 96 | 'commands/workspace.c', |
diff --git a/sway/sway.5.scd b/sway/sway.5.scd index 1a11015f..6ccb1acf 100644 --- a/sway/sway.5.scd +++ b/sway/sway.5.scd | |||
@@ -436,6 +436,16 @@ The default colors are: | |||
436 | *font* <font> | 436 | *font* <font> |
437 | Sets font for use in title bars in Pango format. | 437 | Sets font for use in title bars in Pango format. |
438 | 438 | ||
439 | *titlebar\_border\_thickness* <thickness> | ||
440 | Thickness of the titlebar border in pixels | ||
441 | |||
442 | *titlebar\_padding* <horizontal> [<vertical>] | ||
443 | Padding of the text in the titlebar. _horizontal_ value affects horizontal | ||
444 | padding of the text while _vertical_ value affects vertical padding (space | ||
445 | above and below text). Padding includes titlebar borders so their value | ||
446 | should be greater than titlebar\_border\_thickness. If _vertical_ value is | ||
447 | not specified it is set to the _horizontal_ value. | ||
448 | |||
439 | *for\_window* <criteria> <command> | 449 | *for\_window* <criteria> <command> |
440 | Whenever a window that matches _criteria_ appears, run list of commands. | 450 | Whenever a window that matches _criteria_ appears, run list of commands. |
441 | See *CRITERIA* for more details. | 451 | See *CRITERIA* for more details. |
diff --git a/sway/tree/container.c b/sway/tree/container.c index cf6f5b54..91e8dd7f 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -594,7 +594,7 @@ void container_update_representation(struct sway_container *con) { | |||
594 | } | 594 | } |
595 | 595 | ||
596 | size_t container_titlebar_height(void) { | 596 | size_t container_titlebar_height(void) { |
597 | return config->font_height + TITLEBAR_V_PADDING * 2; | 597 | return config->font_height + config->titlebar_v_padding * 2; |
598 | } | 598 | } |
599 | 599 | ||
600 | void container_init_floating(struct sway_container *con) { | 600 | void container_init_floating(struct sway_container *con) { |