Compare commits

40 Commits

Author SHA1 Message Date
rasmusq
19151d5643 Merge branch 'main' into feature/dual-row-scroller 2025-11-27 19:59:02 +01:00
rasmusq
ffa496fa98 Merge branch 'main' of github.com:rasmusq/mangowc 2025-11-27 19:58:45 +01:00
0dfd7966b4 remove: unnecessary comments to fit comment style in rest of repo for possible pr in the future 2025-11-27 19:32:09 +01:00
5c63a0db7e add: keybinds for resizing row ratio 2025-11-27 19:25:40 +01:00
481d87b0d9 update update comments for readability and presentation 2025-11-16 20:06:34 +01:00
be6ed1764f fix do not scroll to index zero when no window in row is focused 2025-11-16 02:00:42 +01:00
3de0ce410a update use dedicated row identifiers 2025-11-16 01:19:44 +01:00
deae7862e3 add only respect scroller centering on bottom row 2025-11-16 00:57:12 +01:00
ccb2a99bfb fix row consistent movement and focus 2025-11-16 00:29:13 +01:00
7641a65a89 fix rows keep their position when left 2025-11-16 00:08:10 +01:00
6b75a50ed5 fix overlapping tiles 2025-11-16 00:00:08 +01:00
f18e43c2c6 add first running version 2025-11-15 23:52:02 +01:00
DreamMaoMao
8ab59c1aca feat: support scroll maximize and fullscreen window
Some checks failed
Close manually marked stale issues / close-issues (push) Has been cancelled
Lock Threads / lock (push) Has been cancelled
2025-11-15 00:08:57 +08:00
DreamMaoMao
b3578344dc opt: optimize init focus for x11 window 2025-11-14 17:13:26 +08:00
DreamMaoMao
389f417a3b feat: add windowrule option scroller_proportion_single 2025-11-14 15:39:04 +08:00
DreamMaoMao
d2e0df024d opt: optimize code struct 2025-11-14 12:32:07 +08:00
DreamMaoMao
bd6a71f05e fix: fix border color change when swithc mon focus 2025-11-14 12:21:06 +08:00
DreamMaoMao
cfb66111de fix: tagrule not apply correctly 2025-11-14 11:53:41 +08:00
DreamMaoMao
94e47bc3b0 opt: optmize restore_minimized size and not restore namedscratchpad 2025-11-13 10:59:04 +08:00
DreamMaoMao
43424152f3 opt: spawn_on_empty and toggle_named_scratchapd use spawn_shell 2025-11-13 10:49:44 +08:00
DreamMaoMao
0ff4d94365 opt: remove useless normalize keysym convert 2025-11-13 10:42:35 +08:00
DreamMaoMao
ade00f88f0 fix: crash in some crossmon dispatch 2025-11-12 23:10:09 +08:00
DreamMaoMao
7ed12cf921 feat: support keyboard shortcut inhibitor 2025-11-12 18:11:44 +08:00
DreamMaoMao
64d8764f58 update readme 2025-11-10 14:30:20 +08:00
DreamMaoMao
d0a51f4785 opt: remove useless code 2025-11-09 23:19:49 +08:00
DreamMaoMao
7552e77781 Merge pull request #403 from Yappaholic/main
nix: bump scenefx flake and fix build
2025-11-09 18:13:28 +08:00
DreamMaoMao
c206693257 feat: support nofucs rule for some special window 2025-11-09 17:53:18 +08:00
DreamMaoMao
11dfab478a opt: disable switch proportion action in some case 2025-11-09 09:45:55 +08:00
DreamMaoMao
3cfcaa21c0 opt: not resizewin in overview 2025-11-08 22:48:53 +08:00
DreamMaoMao
276560840b opt: remove increase_proportion dispatch
should use resizewin to replace it
2025-11-08 22:47:18 +08:00
Yappaholic
ee789613ff nix: bump scenefx flake and fix build 2025-11-08 16:43:20 +03:00
DreamMaoMao
8ac331aa64 opt: disable resize scroller window when it force to default single size 2025-11-08 20:35:06 +08:00
DreamMaoMao
e59b9c10b5 opt: optimize shadow node and blur node enable 2025-11-08 20:27:29 +08:00
DreamMaoMao
9fecdb6c3a fix: blur node size and position are wrong 2025-11-08 19:59:05 +08:00
DreamMaoMao
c51cf7d6cc opt:optimize code struct 2025-11-08 12:39:41 +08:00
DreamMaoMao
a42939f0c2 feat: add global option scroller_ignore_proportion_single 2025-11-08 10:35:16 +08:00
DreamMaoMao
fbdf7fdb34 Merge pull request #399 from the-eater/fix-segfault-on-exit
check is drm_release_manager is set before cleaning up to avoid segfault
2025-11-07 22:49:35 +08:00
eater
16dc4fa9cd check is drm_release_manager is set before cleaning up to avoid segfault 2025-11-07 15:44:47 +01:00
DreamMaoMao
9b97d11c83 fix: crash when click waybar overview button 2025-11-07 21:56:25 +08:00
DreamMaoMao
58790c0e53 fix: adjust scenefx blur node feature 2025-11-07 14:29:56 +08:00
16 changed files with 399 additions and 34 deletions

View File

@@ -57,6 +57,7 @@ scroller_prefer_center=0
edge_scroller_pointer_focus=1
scroller_default_proportion_single=1.0
scroller_proportion_preset=0.5,0.8,1.0
dual_scroller_default_split_ratio=0.3
# Master-Stack Layout Setting
new_is_master=1
@@ -237,6 +238,10 @@ bind=CTRL+ALT,Down,resizewin,+0,+50
bind=CTRL+ALT,Left,resizewin,-50,+0
bind=CTRL+ALT,Right,resizewin,+50,+0
# dual-scroller split adjustment (increase/decrease top row height)
bind=SUPER+SHIFT,Equal,adjust_dual_scroller_split,0.05
bind=SUPER+SHIFT,Minus,adjust_dual_scroller_split,-0.05
# Mouse Button Bindings
# NONE mode key only work in ov mode
mousebind=SUPER,btn_left,moveresize,curmove

46
flake.lock generated
View File

@@ -18,6 +18,27 @@
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": [
"scenefx",
"systems"
]
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1750386251,
@@ -58,16 +79,18 @@
},
"scenefx": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
]
],
"systems": "systems"
},
"locked": {
"lastModified": 1750785057,
"narHash": "sha256-tGX6j4W91rcb+glXJo43sjPI9zQvPotonknG1BdihR4=",
"lastModified": 1762447505,
"narHash": "sha256-VEBQ8KXkSS4c+kdAhmvq06lEd9WNeCXdRK1U+qSilFw=",
"owner": "wlrfx",
"repo": "scenefx",
"rev": "3a6cfb12e4ba97b43326357d14f7b3e40897adfc",
"rev": "7f9e7409f6169fa637f1265895c121a8f8b70272",
"type": "github"
},
"original": {
@@ -75,6 +98,21 @@
"repo": "scenefx",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"type": "github"
}
}
},
"root": "root",

View File

@@ -25,12 +25,13 @@
perSystem = {
config,
system,
pkgs,
...
}: let
inherit (pkgs) callPackage ;
inherit (pkgs) callPackage;
mango = callPackage ./nix {
inherit (inputs.scenefx.packages.${pkgs.stdenv.hostPlatform.system}) scenefx;
scenefx = inputs.scenefx.packages.${system}.default;
};
shellOverride = old: {
nativeBuildInputs = old.nativeBuildInputs ++ [];

View File

@@ -245,6 +245,10 @@ void buffer_set_effect(Client *c, BufferData data) {
data.corner_location = CORNER_LOCATION_NONE;
}
if (blur && !c->noblur) {
wlr_scene_blur_set_corner_radius(c->blur, border_radius,
data.corner_location);
}
wlr_scene_node_for_each_buffer(&c->scene_surface->node,
scene_buffer_apply_effect, &data);
}
@@ -349,6 +353,19 @@ void client_draw_shadow(Client *c) {
wlr_scene_shadow_set_clipped_region(c->shadow, clipped_region);
}
void client_draw_blur(Client *c, struct wlr_box clip_box, struct ivec2 offset) {
if (blur && !c->noblur) {
if (c->scene_surface->node.enabled && !c->blur->node.enabled)
wlr_scene_node_set_enabled(&c->blur->node, true);
wlr_scene_node_set_position(&c->blur->node, offset.x, offset.y);
wlr_scene_blur_set_size(c->blur, clip_box.width - c->bw,
clip_box.height - c->bw);
} else {
if (c->blur->node.enabled)
wlr_scene_node_set_enabled(&c->blur->node, false);
}
}
void apply_border(Client *c) {
if (!c || c->iskilling || !client_surface(c)->mapped)
return;
@@ -533,12 +550,14 @@ void client_apply_clip(Client *c, float factor) {
apply_border(c);
client_draw_shadow(c);
client_draw_blur(c, clip_box, offset);
if (clip_box.width <= 0 || clip_box.height <= 0) {
return;
}
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip_box);
buffer_set_effect(c, (BufferData){1.0f, 1.0f, clip_box.width,
clip_box.height,
current_corner_location, true});
@@ -570,6 +589,7 @@ void client_apply_clip(Client *c, float factor) {
// 应用窗口装饰
apply_border(c);
client_draw_shadow(c);
client_draw_blur(c, clip_box, offset);
// 如果窗口剪切区域已经剪切到0则不渲染窗口表面
if (clip_box.width <= 0 || clip_box.height <= 0) {
@@ -991,6 +1011,10 @@ void resize(Client *c, struct wlr_box geo, int interact) {
apply_border(c);
client_get_clip(c, &clip);
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip);
if (blur && !c->noblur)
wlr_scene_blur_set_size(c->blur,
c->animation.current.width - 2 * c->bw,
c->animation.current.height - 2 * c->bw);
return;
}
// 如果不是工作区切换时划出去的窗口,就让动画的结束位置,就是上面的真实位置和大小

View File

@@ -158,12 +158,6 @@ static bool scene_node_snapshot(struct wlr_scene_node *node, int lx, int ly,
scene_buffer->corner_radius,
scene_buffer->corners);
// wlr_scene_buffer_set_backdrop_blur_optimized(
// snapshot_buffer, scene_buffer->backdrop_blur_optimized);
// wlr_scene_buffer_set_backdrop_blur_ignore_transparent(
// snapshot_buffer, scene_buffer->backdrop_blur_ignore_transparent);
wlr_scene_buffer_set_backdrop_blur(snapshot_buffer, false);
snapshot_buffer->node.data = scene_buffer->node.data;
struct wlr_scene_surface *scene_surface =
@@ -198,6 +192,8 @@ static bool scene_node_snapshot(struct wlr_scene_node *node, int lx, int ly,
break;
}
case WLR_SCENE_NODE_BLUR:
break;
case WLR_SCENE_NODE_OPTIMIZED_BLUR:
return true;
}

View File

@@ -356,6 +356,10 @@ void layer_animation_next_tick(LayerSurface *l) {
.height = height,
};
if (blur && blur_layer && !l->noblur && l->blur)
wlr_scene_blur_set_size(l->blur, l->animation.current.width,
l->animation.current.height);
if (animation_passed >= 1.0) {
l->animation.running = false;
l->need_output_flush = false;

View File

@@ -200,6 +200,7 @@ typedef struct {
int scroller_focus_center;
int scroller_prefer_center;
int edge_scroller_pointer_focus;
float dual_scroller_default_split_ratio;
int focus_cross_monitor;
int exchange_cross_monitor;
int scratchpad_cross_monitor;
@@ -814,12 +815,17 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
} else if (strcmp(func_name, "focusdir") == 0) {
func = focusdir;
(*arg).i = parse_direction(arg_value);
} else if (strcmp(func_name, "togglerow") == 0) {
func = togglerow;
} else if (strcmp(func_name, "incnmaster") == 0) {
func = incnmaster;
(*arg).i = atoi(arg_value);
} else if (strcmp(func_name, "setmfact") == 0) {
func = setmfact;
(*arg).f = atof(arg_value);
} else if (strcmp(func_name, "adjust_dual_scroller_split") == 0) {
func = adjust_dual_scroller_split;
(*arg).f = atof(arg_value);
} else if (strcmp(func_name, "zoom") == 0) {
func = zoom;
} else if (strcmp(func_name, "exchange_client") == 0) {
@@ -1165,6 +1171,8 @@ void parse_option(Config *config, char *key, char *value) {
config->scroller_prefer_center = atoi(value);
} else if (strcmp(key, "edge_scroller_pointer_focus") == 0) {
config->edge_scroller_pointer_focus = atoi(value);
} else if (strcmp(key, "dual_scroller_default_split_ratio") == 0) {
config->dual_scroller_default_split_ratio = atof(value);
} else if (strcmp(key, "focus_cross_monitor") == 0) {
config->focus_cross_monitor = atoi(value);
} else if (strcmp(key, "exchange_cross_monitor") == 0) {
@@ -2650,6 +2658,8 @@ void override_config(void) {
edge_scroller_pointer_focus =
CLAMP_INT(config.edge_scroller_pointer_focus, 0, 1);
scroller_structs = CLAMP_INT(config.scroller_structs, 0, 1000);
dual_scroller_default_split_ratio =
CLAMP_FLOAT(config.dual_scroller_default_split_ratio, 0.1f, 0.9f);
// 主从布局设置
default_mfact = CLAMP_FLOAT(config.default_mfact, 0.1f, 0.9f);
@@ -2838,6 +2848,7 @@ void set_value_default() {
config.scroller_focus_center = scroller_focus_center;
config.scroller_prefer_center = scroller_prefer_center;
config.edge_scroller_pointer_focus = edge_scroller_pointer_focus;
config.dual_scroller_default_split_ratio = dual_scroller_default_split_ratio;
config.focus_cross_monitor = focus_cross_monitor;
config.exchange_cross_monitor = exchange_cross_monitor;
config.scratchpad_cross_monitor = scratchpad_cross_monitor;

View File

@@ -63,6 +63,7 @@ float scroller_default_proportion_single = 1.0;
int scroller_ignore_proportion_single = 0;
int scroller_focus_center = 0;
int scroller_prefer_center = 0;
float dual_scroller_default_split_ratio = 0.3; /* Default top row height ratio (0.0-1.0) */
int focus_cross_monitor = 0;
int focus_cross_tag = 0;
int exchange_cross_monitor = 0;

View File

@@ -2,6 +2,7 @@ int minimized(const Arg *arg);
int restore_minimized(const Arg *arg);
int toggle_scratchpad(const Arg *arg);
int focusdir(const Arg *arg);
int togglerow(const Arg *arg);
int toggleoverview(const Arg *arg);
int set_proportion(const Arg *arg);
int switch_proportion_preset(const Arg *arg);
@@ -28,6 +29,7 @@ int switch_keyboard_layout(const Arg *arg);
int setlayout(const Arg *arg);
int switch_layout(const Arg *arg);
int setmfact(const Arg *arg);
int adjust_dual_scroller_split(const Arg *arg);
int quit(const Arg *arg);
int moveresize(const Arg *arg);
int exchange_client(const Arg *arg);

View File

@@ -125,6 +125,25 @@ int focusdir(const Arg *arg) {
return 0;
}
int togglerow(const Arg *arg) {
if (!selmon || !selmon->sel || !is_row_layout(selmon))
return 0;
Client *c = selmon->sel;
if (c->isfloating || !ISSCROLLTILED(c) || !VISIBLEON(c, selmon))
return 0;
if (c->dual_scroller_row == 0) {
c->dual_scroller_row = 1;
} else {
c->dual_scroller_row = 0;
}
arrange(selmon, false);
return 0;
}
int focuslast(const Arg *arg) {
Client *c = NULL;
@@ -307,6 +326,25 @@ int setmfact(const Arg *arg) {
return 0;
}
int adjust_dual_scroller_split(const Arg *arg) {
float new_ratio;
if (!arg || !selmon)
return 0;
if (!is_row_layout(selmon))
return 0;
new_ratio = arg->f < 1.0 ? dual_scroller_default_split_ratio + arg->f : arg->f - 1.0;
if (new_ratio < 0.1 || new_ratio > 0.9)
return 0;
dual_scroller_default_split_ratio = new_ratio;
arrange(selmon, false);
return 0;
}
int killclient(const Arg *arg) {
Client *c = NULL;
c = selmon->sel;
@@ -1554,4 +1592,4 @@ int toggle_monitor(const Arg *arg) {
}
}
return 0;
}
}

View File

@@ -146,6 +146,7 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
Client *c = NULL;
Client **tempClients = NULL; // 初始化为 NULL
int last = -1;
bool constrain_to_row = tc->mon && is_row_layout(tc->mon);
// 第一次遍历,计算客户端数量
wl_list_for_each(c, &clients, link) {
@@ -249,7 +250,7 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
}
break;
case LEFT:
if (!ignore_align) {
if (!ignore_align || constrain_to_row) {
for (int _i = 0; _i <= last; _i++) {
if (tempClients[_i]->geom.x < sel_x &&
tempClients[_i]->geom.y == sel_y &&
@@ -265,7 +266,7 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
}
}
}
if (!tempFocusClients) {
if (!tempFocusClients && !constrain_to_row) {
for (int _i = 0; _i <= last; _i++) {
if (tempClients[_i]->geom.x < sel_x) {
int dis_x = tempClients[_i]->geom.x - sel_x;
@@ -281,7 +282,7 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
}
break;
case RIGHT:
if (!ignore_align) {
if (!ignore_align || constrain_to_row) {
for (int _i = 0; _i <= last; _i++) {
if (tempClients[_i]->geom.x > sel_x &&
tempClients[_i]->geom.y == sel_y &&
@@ -297,7 +298,7 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
}
}
}
if (!tempFocusClients) {
if (!tempFocusClients && !constrain_to_row) {
for (int _i = 0; _i <= last; _i++) {
if (tempClients[_i]->geom.x > sel_x) {
int dis_x = tempClients[_i]->geom.x - sel_x;

View File

@@ -23,6 +23,19 @@ bool is_scroller_layout(Monitor *m) {
if (m->pertag->ltidxs[m->pertag->curtag]->id == VERTICAL_SCROLLER)
return true;
if (m->pertag->ltidxs[m->pertag->curtag]->id == DUAL_SCROLLER)
return true;
return false;
}
bool is_row_layout(Monitor *m) {
// Layout has independent horizontal rows where navigation should be constrained
// Moving left and right should keep clients in the same row
// Moving up and down should move clients between rows (this has a dedicaded function)
if (m->pertag->ltidxs[m->pertag->curtag]->id == DUAL_SCROLLER)
return true;
return false;
}

View File

@@ -498,6 +498,8 @@ void resize_tile_client(Client *grabc, bool isdrag, int offsetx, int offsety,
resize_tile_scroller(grabc, isdrag, offsetx, offsety, time, false);
} else if (current_layout->id == VERTICAL_SCROLLER) {
resize_tile_scroller(grabc, isdrag, offsetx, offsety, time, true);
} else if (current_layout->id == DUAL_SCROLLER) {
resize_tile_scroller(grabc, isdrag, offsetx, offsety, time, false);
}
}

View File

@@ -377,6 +377,209 @@ void scroller(Monitor *m) {
free(tempClients); // 最后释放内存
}
// Dual-row scroller layout with independent scrolling
void dual_scroller(Monitor *m) {
unsigned int i, n_top = 0, n_bottom = 0, n_total = 0;
Client *c = NULL;
Client **top_row_clients = NULL;
Client **bottom_row_clients = NULL;
struct wlr_box target_geom;
unsigned int cur_gappih = enablegaps ? m->gappih : 0;
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
unsigned int cur_gappiv = enablegaps ? m->gappiv : 0;
cur_gappih =
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappih;
cur_gappoh =
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappoh;
cur_gappov =
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappov;
cur_gappiv =
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappiv;
unsigned int max_client_width =
m->w.width - 2 * scroller_structs - cur_gappih;
n_total = m->visible_scroll_tiling_clients;
if (n_total == 0) {
return;
}
// Count clients per row and assign unassigned clients
wl_list_for_each(c, &clients, link) {
if (VISIBLEON(c, m) && ISSCROLLTILED(c)) {
// Assign to bottom row by default if not assigned
if (c->dual_scroller_row == -1) {
c->dual_scroller_row = 1;
}
if (c->dual_scroller_row == 0) {
n_top++;
} else {
n_bottom++;
}
}
}
// Allocate arrays for each row
if (n_top > 0) {
top_row_clients = malloc(n_top * sizeof(Client *));
if (!top_row_clients) {
return;
}
}
if (n_bottom > 0) {
bottom_row_clients = malloc(n_bottom * sizeof(Client *));
if (!bottom_row_clients) {
free(top_row_clients);
return;
}
}
// Fill row arrays
unsigned int top_idx = 0, bottom_idx = 0;
wl_list_for_each(c, &clients, link) {
if (VISIBLEON(c, m) && ISSCROLLTILED(c)) {
if (c->dual_scroller_row == 0) {
top_row_clients[top_idx++] = c;
} else {
bottom_row_clients[bottom_idx++] = c;
}
}
}
unsigned int top_row_height = (unsigned int)((m->w.height - 2 * cur_gappov - cur_gappiv) * dual_scroller_default_split_ratio);
unsigned int bottom_row_height = m->w.height - 2 * cur_gappov - cur_gappiv - top_row_height;
unsigned int top_row_y = m->w.y + cur_gappov;
unsigned int bottom_row_y = top_row_y + top_row_height + cur_gappiv;
// Individual row function
void layout_row(Client **row_clients, unsigned int n_row, unsigned int row_y,
unsigned int row_height, bool is_top_row) {
if (n_row == 0) return;
Client *root_client = NULL;
int focus_index = -1;
bool need_scroller = false;
// Find focused client in this row
for (i = 0; i < n_row; i++) {
if (row_clients[i] == m->sel) {
root_client = row_clients[i];
focus_index = i;
break;
}
}
// If no focused client in this row, keep current scroll position
if (!root_client && n_row > 0) {
return;
}
// Check if scrolling is needed
if (root_client && !root_client->is_pending_open_animation &&
root_client->geom.x >= m->w.x + scroller_structs &&
root_client->geom.x + root_client->geom.width <=
m->w.x + m->w.width - scroller_structs) {
need_scroller = false;
} else {
need_scroller = true;
}
if (start_drag_window)
need_scroller = false;
// Layout focused client
if (focus_index >= 0 && root_client) {
target_geom.height = row_height;
target_geom.width = max_client_width * root_client->scroller_proportion;
target_geom.y = row_y;
// Handle fullscreen and maximize
if (root_client->isfullscreen) {
target_geom.height = m->m.height;
target_geom.width = m->m.width;
target_geom.y = m->m.y;
target_geom.x = m->m.x;
resize(root_client, target_geom, 0);
} else if (root_client->ismaximizescreen) {
target_geom.height = m->w.height - 2 * cur_gappov;
target_geom.width = m->w.width - 2 * cur_gappoh;
target_geom.y = m->w.y + cur_gappov;
target_geom.x = m->w.x + cur_gappoh;
resize(root_client, target_geom, 0);
} else if (need_scroller) {
// Determine if we should center
bool should_center = (scroller_focus_center ||
((!m->prevsel ||
(ISSCROLLTILED(m->prevsel) &&
(m->prevsel->scroller_proportion * max_client_width) +
(root_client->scroller_proportion * max_client_width) >
m->w.width - 2 * scroller_structs - cur_gappih)) &&
scroller_prefer_center));
// Current configuration never centers top row
if (is_top_row) {
should_center = false;
}
if (should_center) {
target_geom.x = m->w.x + (m->w.width - target_geom.width) / 2;
} else {
target_geom.x = root_client->geom.x > m->w.x + (m->w.width) / 2
? m->w.x + (m->w.width -
root_client->scroller_proportion *
max_client_width -
scroller_structs)
: m->w.x + scroller_structs;
}
resize(root_client, target_geom, 0);
} else {
target_geom.x = root_client->geom.x;
resize(root_client, target_geom, 0);
}
}
// Layout clients to the left of focused
for (i = focus_index - 1; i >= 0 && i < n_row; i--) {
c = row_clients[i];
target_geom.width = max_client_width * c->scroller_proportion;
target_geom.height = row_height;
target_geom.y = row_y;
if (!c->isfullscreen && !c->ismaximizescreen) {
target_geom.x = row_clients[i + 1]->geom.x - cur_gappih - target_geom.width;
resize(c, target_geom, 0);
}
}
// Layout clients to the right of focused
for (i = focus_index + 1; i < n_row; i++) {
c = row_clients[i];
target_geom.width = max_client_width * c->scroller_proportion;
target_geom.height = row_height;
target_geom.y = row_y;
if (!c->isfullscreen && !c->ismaximizescreen) {
target_geom.x = row_clients[i - 1]->geom.x + cur_gappih + row_clients[i - 1]->geom.width;
resize(c, target_geom, 0);
}
}
}
// Layout both rows independently
layout_row(top_row_clients, n_top, top_row_y, top_row_height, true);
layout_row(bottom_row_clients, n_bottom, bottom_row_y, bottom_row_height, false);
free(top_row_clients);
free(bottom_row_clients);
}
void center_tile(Monitor *m) {
unsigned int i, n = 0, h, r, ie = enablegaps, mw, mx, my, oty, ety, tw;
Client *c = NULL;
@@ -803,4 +1006,4 @@ monocle(Monitor *m) {
}
if ((c = focustop(m)))
wlr_scene_node_raise_to_top(&c->scene->node);
}
}

View File

@@ -11,6 +11,7 @@ static void vertical_overview(Monitor *m);
static void vertical_grid(Monitor *m);
static void vertical_scroller(Monitor *m);
static void vertical_deck(Monitor *mon);
static void dual_scroller(Monitor *mon);
/* layout(s) */
Layout overviewlayout = {"󰃇", overview, "overview"};
@@ -27,6 +28,7 @@ enum {
VERTICAL_GRID,
VERTICAL_DECK,
RIGHT_TILE,
DUAL_SCROLLER,
};
Layout layouts[] = {
@@ -44,4 +46,5 @@ Layout layouts[] = {
{"VT", vertical_tile, "vertical_tile", VERTICAL_TILE}, // 垂直平铺布局
{"VG", vertical_grid, "vertical_grid", VERTICAL_GRID}, // 垂直格子布局
{"VK", vertical_deck, "vertical_deck", VERTICAL_DECK}, // 垂直卡片布局
{"DS", dual_scroller, "dual_scroller", DUAL_SCROLLER}, // 双行滚动布局
};

View File

@@ -285,6 +285,7 @@ struct Client {
struct wlr_scene_tree *scene;
struct wlr_scene_rect *border; /* top, bottom, left, right */
struct wlr_scene_shadow *shadow;
struct wlr_scene_blur *blur;
struct wlr_scene_tree *scene_surface;
struct wl_list link;
struct wl_list flink;
@@ -374,6 +375,7 @@ struct Client {
double old_master_mfact_per, old_master_inner_per, old_stack_innder_per;
double old_scroller_pproportion;
bool ismaster;
int dual_scroller_row; // 0 = top row, 1 = bottom row, -1 = not set
bool cursor_in_upper_half, cursor_in_left_half;
bool isleftstack;
int tearing_hint;
@@ -423,6 +425,7 @@ typedef struct {
struct wlr_scene_tree *scene;
struct wlr_scene_tree *popups;
struct wlr_scene_shadow *shadow;
struct wlr_scene_blur *blur;
struct wlr_scene_layer_surface_v1 *scene_layer;
struct wl_list link;
struct wl_list fadeout_link;
@@ -719,6 +722,7 @@ static struct wlr_scene_tree *
wlr_scene_tree_snapshot(struct wlr_scene_node *node,
struct wlr_scene_tree *parent);
static bool is_scroller_layout(Monitor *m);
static bool is_row_layout(Monitor *m);
static void create_output(struct wlr_backend *backend, void *data);
static void get_layout_abbr(char *abbr, const char *full_name);
static void apply_named_scratchpad(Client *target_client);
@@ -2143,12 +2147,16 @@ static void iter_layer_scene_buffers(struct wlr_scene_buffer *buffer, int sx,
return;
}
wlr_scene_buffer_set_backdrop_blur(buffer, true);
wlr_scene_buffer_set_backdrop_blur_ignore_transparent(buffer, true);
LayerSurface *l = (LayerSurface *)user_data;
wlr_scene_node_set_enabled(&l->blur->node, true);
wlr_scene_blur_set_transparency_mask_source(l->blur, buffer);
wlr_scene_blur_set_size(l->blur, l->geom.width, l->geom.height);
if (blur_optimized) {
wlr_scene_buffer_set_backdrop_blur_optimized(buffer, true);
wlr_scene_blur_set_should_only_blur_bottom_layer(l->blur, true);
} else {
wlr_scene_buffer_set_backdrop_blur_optimized(buffer, false);
wlr_scene_blur_set_should_only_blur_bottom_layer(l->blur, false);
}
}
@@ -2193,13 +2201,17 @@ void maplayersurfacenotify(struct wl_listener *listener, void *data) {
}
// 初始化阴影
if (layer_surface->current.exclusive_zone == 0 &&
layer_surface->current.layer != ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM &&
if (layer_surface->current.layer != ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM &&
layer_surface->current.layer != ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND) {
l->shadow = wlr_scene_shadow_create(l->scene, 0, 0, border_radius,
shadows_blur, shadowscolor);
wlr_scene_node_lower_to_bottom(&l->shadow->node);
wlr_scene_node_set_enabled(&l->shadow->node, true);
if (layer_surface->current.exclusive_zone == 0) {
l->shadow = wlr_scene_shadow_create(l->scene, 0, 0, border_radius,
shadows_blur, shadowscolor);
wlr_scene_node_lower_to_bottom(&l->shadow->node);
wlr_scene_node_set_enabled(&l->shadow->node, true);
}
l->blur = wlr_scene_blur_create(l->scene, 0, 0);
wlr_scene_node_lower_to_bottom(&l->blur->node);
}
// 初始化动画
@@ -2265,7 +2277,8 @@ void commitlayersurfacenotify(struct wl_listener *listener, void *data) {
if (!l->noblur &&
layer_surface->current.layer != ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM &&
layer_surface->current.layer !=
ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND) {
ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND &&
l->blur) {
wlr_scene_node_for_each_buffer(&l->scene->node,
iter_layer_scene_buffers, l);
@@ -2784,6 +2797,7 @@ createnotify(struct wl_listener *listener, void *data) {
c = toplevel->base->data = ecalloc(1, sizeof(*c));
c->surface.xdg = toplevel->base;
c->bw = borderpx;
c->dual_scroller_row = -1; // Not assigned to a row yet
LISTEN(&toplevel->base->surface->events.commit, &c->commit, commitnotify);
LISTEN(&toplevel->base->surface->events.map, &c->map, mapnotify);
@@ -3603,15 +3617,15 @@ static void iter_xdg_scene_buffers(struct wlr_scene_buffer *buffer, int sx,
return;
if (blur && c && !c->noblur) {
wlr_scene_buffer_set_backdrop_blur(buffer, true);
wlr_scene_buffer_set_backdrop_blur_ignore_transparent(buffer, false);
wlr_scene_node_set_enabled(&c->blur->node, true);
// wlr_scene_blur_set_transparency_mask_source(c->blur, buffer);
if (blur_optimized) {
wlr_scene_buffer_set_backdrop_blur_optimized(buffer, true);
wlr_scene_blur_set_should_only_blur_bottom_layer(c->blur, true);
} else {
wlr_scene_buffer_set_backdrop_blur_optimized(buffer, false);
wlr_scene_blur_set_should_only_blur_bottom_layer(c->blur, false);
}
} else {
wlr_scene_buffer_set_backdrop_blur(buffer, false);
wlr_scene_node_set_enabled(&c->blur->node, false);
}
}
@@ -3726,6 +3740,9 @@ mapnotify(struct wl_listener *listener, void *data) {
c->shadow = wlr_scene_shadow_create(c->scene, 0, 0, border_radius,
shadows_blur, shadowscolor);
c->blur = wlr_scene_blur_create(c->scene_surface, 0, 0);
wlr_scene_node_lower_to_bottom(&c->blur->node);
wlr_scene_node_lower_to_bottom(&c->shadow->node);
wlr_scene_node_set_enabled(&c->shadow->node, true);
@@ -3743,6 +3760,11 @@ mapnotify(struct wl_listener *listener, void *data) {
}
if (at_client) {
// For row-based layouts, assign new client to same row as focused client
if (is_row_layout(selmon) && at_client->dual_scroller_row >= 0) {
c->dual_scroller_row = at_client->dual_scroller_row;
}
at_client->link.next->prev = &c->link;
c->link.prev = &at_client->link;
c->link.next = at_client->link.next;
@@ -5802,6 +5824,7 @@ void createnotifyx11(struct wl_listener *listener, void *data) {
c = xsurface->data = ecalloc(1, sizeof(*c));
c->surface.xwayland = xsurface;
c->type = X11;
c->dual_scroller_row = -1; // Not assigned to a row yet
/* Listen to the various events it can emit */
LISTEN(&xsurface->events.associate, &c->associate, associatex11);
LISTEN(&xsurface->events.destroy, &c->destroy, destroynotify);