|
| 1 | +diff -Naur sway-1.10/include/sway/commands.h sway_without_titlebar/include/sway/commands.h |
| 2 | +--- sway-1.10/include/sway/commands.h 2024-10-27 23:44:01.000000000 +0300 |
| 3 | ++++ sway_without_titlebar/include/sway/commands.h 2024-10-29 19:56:48.986533618 +0300 |
| 4 | +@@ -125,6 +125,7 @@ |
| 5 | + sway_cmd cmd_default_border; |
| 6 | + sway_cmd cmd_default_floating_border; |
| 7 | + sway_cmd cmd_default_orientation; |
| 8 | ++sway_cmd cmd_disable_titlebar; |
| 9 | + sway_cmd cmd_exec; |
| 10 | + sway_cmd cmd_exec_always; |
| 11 | + sway_cmd cmd_exit; |
| 12 | +diff -Naur sway-1.10/include/sway/config.h sway_without_titlebar/include/sway/config.h |
| 13 | +--- sway-1.10/include/sway/config.h 2024-10-27 23:44:01.000000000 +0300 |
| 14 | ++++ sway_without_titlebar/include/sway/config.h 2024-10-29 19:54:56.981700498 +0300 |
| 15 | +@@ -514,6 +514,7 @@ |
| 16 | + int font_height; |
| 17 | + int font_baseline; |
| 18 | + bool pango_markup; |
| 19 | ++ bool disable_titlebar; |
| 20 | + int titlebar_border_thickness; |
| 21 | + int titlebar_h_padding; |
| 22 | + int titlebar_v_padding; |
| 23 | +diff -Naur sway-1.10/sway/commands/disable_titlebar.c sway_without_titlebar/sway/commands/disable_titlebar.c |
| 24 | +--- sway-1.10/sway/commands/disable_titlebar.c 1970-01-01 03:00:00.000000000 +0300 |
| 25 | ++++ sway_without_titlebar/sway/commands/disable_titlebar.c 2024-10-29 19:50:50.716803662 +0300 |
| 26 | +@@ -0,0 +1,14 @@ |
| 27 | ++#include "sway/commands.h" |
| 28 | ++#include "sway/config.h" |
| 29 | ++#include "util.h" |
| 30 | ++ |
| 31 | ++struct cmd_results *cmd_disable_titlebar(int argc, char **argv) { |
| 32 | ++ struct cmd_results *error = NULL; |
| 33 | ++ if ((error = checkarg(argc, "disable_titlebar", EXPECTED_EQUAL_TO, 1))) { |
| 34 | ++ return error; |
| 35 | ++ } |
| 36 | ++ |
| 37 | ++ config->disable_titlebar = parse_boolean(argv[0], config->disable_titlebar); |
| 38 | ++ |
| 39 | ++ return cmd_results_new(CMD_SUCCESS, NULL); |
| 40 | ++} |
| 41 | +diff -Naur sway-1.10/sway/commands.c sway_without_titlebar/sway/commands.c |
| 42 | +--- sway-1.10/sway/commands.c 2024-10-27 23:44:01.000000000 +0300 |
| 43 | ++++ sway_without_titlebar/sway/commands.c 2024-10-29 19:53:47.208426995 +0300 |
| 44 | +@@ -57,6 +57,7 @@ |
| 45 | + { "client.urgent", cmd_client_urgent }, |
| 46 | + { "default_border", cmd_default_border }, |
| 47 | + { "default_floating_border", cmd_default_floating_border }, |
| 48 | ++ { "disable_titlebar", cmd_disable_titlebar }, |
| 49 | + { "exec", cmd_exec }, |
| 50 | + { "exec_always", cmd_exec_always }, |
| 51 | + { "floating_maximum_size", cmd_floating_maximum_size }, |
| 52 | +diff -Naur sway-1.10/sway/config.c sway_without_titlebar/sway/config.c |
| 53 | +--- sway-1.10/sway/config.c 2024-10-27 23:44:01.000000000 +0300 |
| 54 | ++++ sway_without_titlebar/sway/config.c 2024-10-29 19:49:57.309715693 +0300 |
| 55 | +@@ -279,6 +279,7 @@ |
| 56 | + config->auto_back_and_forth = false; |
| 57 | + config->reading = false; |
| 58 | + config->show_marks = true; |
| 59 | ++ config->disable_titlebar = false; |
| 60 | + config->title_align = ALIGN_LEFT; |
| 61 | + config->tiling_drag = true; |
| 62 | + config->tiling_drag_threshold = 9; |
| 63 | +diff -Naur sway-1.10/sway/meson.build sway_without_titlebar/sway/meson.build |
| 64 | +--- sway-1.10/sway/meson.build 2024-10-27 23:44:01.000000000 +0300 |
| 65 | ++++ sway_without_titlebar/sway/meson.build 2024-10-29 20:03:27.137339544 +0300 |
| 66 | +@@ -52,6 +52,7 @@ |
| 67 | + 'commands/default_border.c', |
| 68 | + 'commands/default_floating_border.c', |
| 69 | + 'commands/default_orientation.c', |
| 70 | ++ 'commands/disable_titlebar.c', |
| 71 | + 'commands/exit.c', |
| 72 | + 'commands/exec.c', |
| 73 | + 'commands/exec_always.c', |
| 74 | +diff -Naur sway-1.10/sway/tree/container.c sway_without_titlebar/sway/tree/container.c |
| 75 | +--- sway-1.10/sway/tree/container.c 2024-10-27 23:44:01.000000000 +0300 |
| 76 | ++++ sway_without_titlebar/sway/tree/container.c 2024-10-29 19:46:23.612400449 +0300 |
| 77 | +@@ -811,7 +811,11 @@ |
| 78 | + } |
| 79 | + |
| 80 | + size_t container_titlebar_height(void) { |
| 81 | +- return config->font_height + config->titlebar_v_padding * 2; |
| 82 | ++ if(config->disable_titlebar) { |
| 83 | ++ return 0; |
| 84 | ++ } |
| 85 | ++ |
| 86 | ++ return config->font_height + config->titlebar_v_padding * 2; |
| 87 | + } |
| 88 | + |
| 89 | + void floating_calculate_constraints(int *min_width, int *max_width, |
| 90 | +diff -Naur sway-1.10/sway/tree/view.c sway_without_titlebar/sway/tree/view.c |
| 91 | +--- sway-1.10/sway/tree/view.c 2024-10-27 23:44:01.000000000 +0300 |
| 92 | ++++ sway_without_titlebar/sway/tree/view.c 2024-10-29 19:46:55.870632306 +0300 |
| 93 | +@@ -305,7 +305,7 @@ |
| 94 | + } |
| 95 | + } |
| 96 | + |
| 97 | +- if (!container_is_floating(con)) { |
| 98 | ++ if (!container_is_floating(con) && !config->disable_titlebar) { |
| 99 | + // In a tabbed or stacked container, the container's y is the top of the |
| 100 | + // title area. We have to offset the surface y by the height of the title, |
| 101 | + // bar, and disable any top border because we'll always have the title bar. |
0 commit comments