Skip to content
This repository was archived by the owner on Oct 30, 2024. It is now read-only.

Commit b203687

Browse files
committed
added patch for new version of Sway (1.10)
1 parent 3cb5d6b commit b203687

5 files changed

+110
-16
lines changed

README.md

+9-16
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,26 @@
33
this patch for Sway 1.9 which adds the 'disable_titlebar' option in the config file.
44

55
Instruction:
6-
1. Download latest Sway-1.9 source tarball: https://github.com/swaywm/sway/archive/refs/tags/1.9.tar.gz
7-
2. Download patch: [disable_titlebar_patch.tar.gz](https://github.com/neuromagus/disable_titlebar_in_sway/blob/main/disable_titlebar_patch.tar.gz)
8-
3. Extract Sway-1.9 tarball
9-
4. Extract patch and move to sway-1.9 folder
10-
5. Go to the sway-1.9 folder and apply the patch
11-
6. Compile and install sway
12-
(now we have different versions of Wlroots.
6+
1. Download latest Sway-1.10 source tarball: https://github.com/swaywm/sway/archive/refs/tags/1.10.tar.gz
7+
2. Download patch: [disable_titlebar_patch.tar.gz](https://github.com/neuromagus/disable_titlebar_in_sway/blob/main/disable_titlebar_patch-sway1-10.tar.gz)
8+
3. Extract Sway-1.10 tarball
9+
4. Extract patch and move to sway-1.10 folder
10+
5. Go to the sway-1.10 folder and apply the patch
11+
6. Compile and install sway (if you want use old Sway version, you need add this command for use old Wlroots!
1312
On Archlinux, for example, use this command:
1413
```export PKG_CONFIG_PATH='/usr/lib/wlroots0.17/pkgconfig``` before ```meson build/```):
1514

1615
```
17-
tar xf sway-1.9.tar.gz
18-
tar xf disable_titlebar_patch.tar.gz; mv disable_titlebar.patch sway-1.9/
19-
cd sway-1.9/; patch -p1 < disable_titlebar.patch
16+
tar xf sway-1.10.tar.gz
17+
tar xf disable_titlebar_patch_sway1-10.tar.gz; mv disable_titlebar_sway1-10.patch sway-1.10/
18+
cd sway-1.10/; patch -p1 < mv disable_titlebar_sway1-10.patch
2019
meson build/
21-
ninja -C build/
2220
sudo ninja -C build/ install
2321
```
2422

25-
2623
7. Edit ```~/.config/sway/config``` file and add the option: ```disable_titlebar yes``` or read ```man 5 sway``` xD.
2724
For example, a piece of my ~/.config/sway/config:
2825
```
29-
xwayland disable
3026
workspace_layout tabbed
3127
default_border none
3228
default_floating_border none
@@ -35,7 +31,4 @@ disable_titlebar yes
3531

3632
Enjoy.
3733

38-
***
39-
Thanks to y0nei for the feedback, I added a fix for drawing the top border.
40-
***
4134

1.35 KB
Binary file not shown.
File renamed without changes.

disable_titlebar_sway1-10.patch

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
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.
File renamed without changes.

0 commit comments

Comments
 (0)