summarylogtreecommitdiffstats
path: root/gaps.patch
blob: 0aadb64119d8bf5c2c34fa183888ffd7c18f1041 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
--- a/defaults/defaults	2021-01-12 21:42:12.000000000 +0200
+++ b/defaults/defaults	2023-06-19 18:12:23.427093361 +0200
@@ -25,6 +25,12 @@
 frame_border_top=0
 frame_opacity=100
 full_width_title=true
+gap_bottom=0
+gap_inner=0
+gap_left=0
+gap_maximize=true
+gap_right=0
+gap_top=0
 horiz_scroll_opacity=false
 inactive_opacity=100
 maximized_offset=0
--- a/src/client.c	2022-12-01 12:47:40.000000000 +0200
+++ b/src/client.c	2023-06-19 18:12:12.000426078 +0200
@@ -3295,6 +3295,9 @@
 static gboolean
 clientNewTileSize (Client *c, XWindowChanges *wc, GdkRectangle *rect, tilePositionType tile)
 {
+    ScreenInfo *screen_info;
+    screen_info = c->screen_info;
+
     GdkRectangle full;
 
     clientMaxSpaceForGeometry (c, rect, &full);
@@ -3318,36 +3321,60 @@
             wc->y = full.y + frameExtentTop (c);
             wc->width = full.width / 2 - frameExtentLeft (c) - frameExtentRight (c);
             wc->height = full.height - frameExtentTop (c) - frameExtentBottom (c);
+            wc->x += screen_info->params->gap_left;
+            wc->y += screen_info->params->gap_top;
+            wc->width -= screen_info->params->gap_left + (screen_info->params->gap_inner / 2);
+            wc->height -= screen_info->params->gap_top + screen_info->params->gap_bottom;
             break;
         case TILE_RIGHT:
             wc->x = full.x + full.width / 2 + frameExtentLeft (c);
             wc->y = full.y + frameExtentTop (c);
             wc->width = full.width - full.width / 2 - frameExtentLeft (c) - frameExtentRight (c);
             wc->height = full.height - frameExtentTop (c) - frameExtentBottom (c);
+            wc->x += screen_info->params->gap_inner / 2;
+            wc->y += screen_info->params->gap_top;
+            wc->width -= screen_info->params->gap_right + (screen_info->params->gap_inner / 2);
+            wc->height -= screen_info->params->gap_top + screen_info->params->gap_bottom;
             break;
         case TILE_DOWN_LEFT:
             wc->x = full.x + frameExtentLeft (c);
             wc->y = full.y + full.height / 2 + frameExtentTop (c);
             wc->width = full.width / 2 - frameExtentLeft (c) - frameExtentRight (c);
             wc->height = full.height - full.height / 2 - frameExtentTop (c) - frameExtentBottom (c);
+            wc->x += screen_info->params->gap_left;
+            wc->y += screen_info->params->gap_inner / 2;
+            wc->width -= screen_info->params->gap_left + (screen_info->params->gap_inner / 2);
+            wc->height -= screen_info->params->gap_bottom + (screen_info->params->gap_inner / 2);
             break;
         case TILE_DOWN_RIGHT:
             wc->x = full.x + full.width /2 + frameExtentLeft (c);
             wc->y = full.y + full.height / 2 + frameExtentTop (c);
             wc->width = full.width - full.width / 2 - frameExtentLeft (c) - frameExtentRight (c);
             wc->height = full.height - full.height / 2 - frameExtentTop (c) - frameExtentBottom (c);
+            wc->x += screen_info->params->gap_inner / 2;
+            wc->y += screen_info->params->gap_inner / 2;
+            wc->width -= screen_info->params->gap_right + (screen_info->params->gap_inner / 2);
+            wc->height -= screen_info->params->gap_bottom + (screen_info->params->gap_inner / 2);
             break;
         case TILE_UP_LEFT:
             wc->x = full.x + frameExtentLeft (c);
             wc->y = full.y + frameExtentTop (c);
             wc->width = full.width / 2 - frameExtentLeft (c) - frameExtentRight (c);
             wc->height = full.height / 2 - frameExtentTop (c) - frameExtentBottom (c);
+            wc->x += screen_info->params->gap_left;
+            wc->y += screen_info->params->gap_top;
+            wc->width -= screen_info->params->gap_left + (screen_info->params->gap_inner / 2);
+            wc->height -= screen_info->params->gap_top + (screen_info->params->gap_inner / 2);
             break;
         case TILE_UP_RIGHT:
             wc->x = full.x + full.width /2 + frameExtentLeft (c);
             wc->y = full.y + frameExtentTop (c);
             wc->width = full.width - full.width / 2 - frameExtentLeft (c) - frameExtentRight (c);
             wc->height = full.height / 2 - frameExtentTop (c) - frameExtentBottom (c);
+            wc->x += screen_info->params->gap_inner / 2;
+            wc->y += screen_info->params->gap_top;
+            wc->width -= screen_info->params->gap_right + (screen_info->params->gap_inner / 2);
+            wc->height -= screen_info->params->gap_top + (screen_info->params->gap_inner / 2);
             break;
         default:
             break;
@@ -3360,6 +3387,9 @@
 static gboolean
 clientNewMaxSize (Client *c, XWindowChanges *wc, GdkRectangle *rect)
 {
+    ScreenInfo *screen_info;
+    screen_info = c->screen_info;
+
     GdkRectangle full;
 
     clientMaxSpaceForGeometry (c, rect, &full);
@@ -3378,6 +3408,13 @@
         wc->height = full.height - frameExtentTop (c) - frameExtentBottom (c);
     }
 
+    if (screen_info->params->gap_maximize) {
+        wc->x += screen_info->params->gap_left;
+        wc->y += screen_info->params->gap_top;
+        wc->width -= screen_info->params->gap_left + screen_info->params->gap_right;
+        wc->height -= screen_info->params->gap_top + screen_info->params->gap_bottom;
+    }
+
     return ((wc->height >= c->size->min_height) && (wc->height <= c->size->max_height) &&
             (wc->width >= c->size->min_width) && (wc->width <= c->size->max_width));
 }
--- a/src/settings.c	2022-11-12 22:57:54.000000000 +0200
+++ b/src/settings.c	2023-06-19 18:17:00.867108334 +0200
@@ -693,6 +693,12 @@
         {"frame_opacity", NULL, G_TYPE_INT, TRUE},
         {"frame_border_top", NULL, G_TYPE_INT, TRUE},
         {"full_width_title", NULL, G_TYPE_BOOLEAN, TRUE},
+        {"gap_bottom", NULL, G_TYPE_INT, TRUE},
+        {"gap_inner", NULL, G_TYPE_INT, TRUE},
+        {"gap_left", NULL, G_TYPE_INT, TRUE},
+        {"gap_maximize", NULL, G_TYPE_BOOLEAN, TRUE},
+        {"gap_right", NULL, G_TYPE_INT, TRUE},
+        {"gap_top", NULL, G_TYPE_INT, TRUE},
         {"horiz_scroll_opacity", NULL, G_TYPE_BOOLEAN, FALSE},
         {"inactive_opacity", NULL, G_TYPE_INT, TRUE},
         {"margin_bottom", NULL, G_TYPE_INT, FALSE},
@@ -793,6 +799,18 @@
         getBoolValue ("focus_hint", rc);
     screen_info->params->focus_new =
         getBoolValue ("focus_new", rc);
+    screen_info->params->gap_bottom =
+        getIntValue ("gap_bottom", rc);
+    screen_info->params->gap_inner =
+        getIntValue ("gap_inner", rc);
+    screen_info->params->gap_left =
+        getIntValue ("gap_left", rc);
+    screen_info->params->gap_maximize =
+        getBoolValue ("gap_maximize", rc);
+    screen_info->params->gap_right =
+        getIntValue ("gap_right", rc);
+    screen_info->params->gap_top =
+        getIntValue ("gap_top", rc);
     screen_info->params->horiz_scroll_opacity =
         getBoolValue ("horiz_scroll_opacity", rc);
     screen_info->params->mousewheel_rollup =
@@ -1238,6 +1256,26 @@
                 {
                     screen_info->params->cycle_tabwin_mode = CLAMP (g_value_get_int(value), 0, 1);
                 }
+                else if (!strcmp (name, "gap_bottom"))
+                {
+                    screen_info->params->gap_bottom = g_value_get_int(value);
+                }
+                else if (!strcmp (name, "gap_inner"))
+                {
+                    screen_info->params->gap_inner = g_value_get_int(value);
+                }
+                else if (!strcmp (name, "gap_left"))
+                {
+                    screen_info->params->gap_left = g_value_get_int(value);
+                }
+                else if (!strcmp (name, "gap_right"))
+                {
+                    screen_info->params->gap_right = g_value_get_int(value);
+                }
+                else if (!strcmp (name, "gap_top"))
+                {
+                    screen_info->params->gap_top = g_value_get_int(value);
+                }
                 else if ((!strcmp (name, "button_offset"))
                       || (!strcmp (name, "button_spacing"))
                       || (!strcmp (name, "double_click_time"))
@@ -1278,6 +1316,10 @@
                 {
                     screen_info->params->focus_new = g_value_get_boolean (value);
                 }
+                else if (!strcmp (name, "gap_maximize"))
+                {
+                    screen_info->params->gap_maximize = g_value_get_boolean (value);
+                }
                 else if (!strcmp (name, "raise_on_focus"))
                 {
                     screen_info->params->raise_on_focus = g_value_get_boolean (value);
--- a/src/settings.h	2022-11-12 22:57:54.000000000 +0200
+++ b/src/settings.h	2023-06-19 18:12:01.503758845 +0200
@@ -190,6 +190,11 @@
     int focus_delay;
     int frame_opacity;
     int frame_border_top;
+    int gap_bottom;
+    int gap_inner;
+    int gap_left;
+    int gap_right;
+    int gap_top;
     int inactive_opacity;
     int maximized_offset;
     int move_opacity;
@@ -209,6 +214,7 @@
     int title_shadow[2];
     int wrap_resistance;
     gboolean borderless_maximize;
+    gboolean gap_maximize;
     gboolean titleless_maximize;
     gboolean box_move;
     gboolean box_resize;