mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-06-28 13:14:16 -04:00
feat: support group
This commit is contained in:
parent
0fc7559c3c
commit
d1cab2c4b7
14 changed files with 483 additions and 233 deletions
|
|
@ -545,83 +545,32 @@ void deck(Monitor *m) {
|
|||
}
|
||||
}
|
||||
|
||||
void monocle(Monitor *m) {
|
||||
Client *c = NULL, *fc = NULL;
|
||||
void // 17
|
||||
monocle(Monitor *m) {
|
||||
Client *c = NULL;
|
||||
struct wlr_box geom;
|
||||
|
||||
int32_t cur_gappov = enablegaps ? m->gappov : 0;
|
||||
int32_t cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
int32_t cur_gapiv = enablegaps ? m->gappiv : 0;
|
||||
int32_t cur_gapih = enablegaps ? m->gappih : 0;
|
||||
|
||||
if (config.smartgaps && m->visible_fake_tiling_clients == 1) {
|
||||
cur_gappov = cur_gappoh = cur_gapiv = cur_gapih = 0;
|
||||
}
|
||||
|
||||
int n = m->visible_fake_tiling_clients;
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
wl_list_for_each(c, &fstack, flink) {
|
||||
if (c->iskilling || c->isunglobal || !ISFAKETILED(c))
|
||||
continue;
|
||||
if (VISIBLEON(c, m)) {
|
||||
fc = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (n == 1) {
|
||||
geom.x = m->w.x + cur_gappoh;
|
||||
geom.y = m->w.y + cur_gappov;
|
||||
geom.width = m->w.width - 2 * cur_gappoh;
|
||||
geom.height = m->w.height - 2 * cur_gappov;
|
||||
client_tile_resize(fc, geom, 0);
|
||||
monocle_set_focus(fc, true);
|
||||
return;
|
||||
}
|
||||
|
||||
int tab_bar_height = config.tab_bar_height;
|
||||
|
||||
int tab_bar_inner_gap_height =
|
||||
config.tab_bar_height > 0 ? 2 * cur_gapiv : 0;
|
||||
int tab_bar_y_offset = config.tab_bar_height > 0 ? cur_gapiv : 0;
|
||||
|
||||
int tab_y = m->w.y + cur_gappov;
|
||||
int main_y = tab_y + tab_bar_height + tab_bar_y_offset;
|
||||
int main_height = m->w.height - 2 * cur_gappov - tab_bar_inner_gap_height -
|
||||
tab_bar_height;
|
||||
|
||||
int tab_area_width = m->w.width - 2 * cur_gappoh;
|
||||
|
||||
int total_gaps = (n - 1) * cur_gapih;
|
||||
int base_width = (tab_area_width - total_gaps) / n;
|
||||
int remainder = (tab_area_width - total_gaps) % n;
|
||||
|
||||
int tab_x = m->w.x + cur_gappoh;
|
||||
int idx = 0;
|
||||
cur_gappoh = config.smartgaps && m->visible_fake_tiling_clients == 1
|
||||
? 0
|
||||
: cur_gappoh;
|
||||
cur_gappov = config.smartgaps && m->visible_fake_tiling_clients == 1
|
||||
? 0
|
||||
: cur_gappov;
|
||||
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (!VISIBLEON(c, m) || !ISFAKETILED(c))
|
||||
continue;
|
||||
|
||||
if (c == fc) {
|
||||
monocle_set_focus(c, true);
|
||||
} else {
|
||||
monocle_set_focus(c, false);
|
||||
}
|
||||
|
||||
geom.x = m->w.x + cur_gappoh;
|
||||
geom.y = main_y;
|
||||
geom.y = m->w.y + cur_gappov;
|
||||
geom.width = m->w.width - 2 * cur_gappoh;
|
||||
geom.height = main_height;
|
||||
geom.height = m->w.height - 2 * cur_gappov;
|
||||
client_tile_resize(c, geom, 0);
|
||||
|
||||
int tw = base_width + (idx < remainder ? 1 : 0);
|
||||
global_draw_tab_bar(c, tab_x, tab_y, tw, tab_bar_height);
|
||||
|
||||
tab_x += tw + cur_gapih;
|
||||
idx++;
|
||||
}
|
||||
if ((c = focustop(m)))
|
||||
wlr_scene_node_raise_to_top(&c->scene->node);
|
||||
}
|
||||
|
||||
// 网格布局窗口大小和位置计算
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue