mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-06-19 14:33:16 -04:00
Merge branch 'mangowm:wl-only' into wl-only
This commit is contained in:
commit
cb51aba2e3
12 changed files with 223 additions and 104 deletions
|
|
@ -163,6 +163,8 @@ Some GPUs have compatibility issues with `syncobj_enable=1` — it may crash app
|
||||||
## Power Management
|
## Power Management
|
||||||
|
|
||||||
You can control monitor power using the `mmsg` IPC tool.
|
You can control monitor power using the `mmsg` IPC tool.
|
||||||
|
> Notice: This command does not remove the monitor, it only turns it off.
|
||||||
|
> if you want completely remove monitor, just use `wlr-randr`
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Turn off
|
# Turn off
|
||||||
|
|
@ -178,13 +180,13 @@ mmsg dispatch toggle_monitor,eDP-1
|
||||||
You can also use `wlr-randr` for monitor management:
|
You can also use `wlr-randr` for monitor management:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Turn off monitor
|
# remove a monitor
|
||||||
wlr-randr --output eDP-1 --off
|
wlr-randr --output eDP-1 --off
|
||||||
|
|
||||||
# Turn on monitor
|
# add a monitor
|
||||||
wlr-randr --output eDP-1 --on
|
wlr-randr --output eDP-1 --on
|
||||||
|
|
||||||
# Show all monitors
|
# Show all monitors spec
|
||||||
wlr-randr
|
wlr-randr
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -183,6 +183,9 @@ tagrule=id:Values,monitor_make:xxx,monitor_model:xxx,Parameter:Values
|
||||||
| `no_hide` | integer | `0` / `1` | Not hide even if the tag is empty |
|
| `no_hide` | integer | `0` / `1` | Not hide even if the tag is empty |
|
||||||
| `nmaster` | integer | 0, 99 | Number of master windows |
|
| `nmaster` | integer | 0, 99 | Number of master windows |
|
||||||
| `mfact` | float | 0.1–0.9 | Master area factor |
|
| `mfact` | float | 0.1–0.9 | Master area factor |
|
||||||
|
| `scroller_default_proportion` | float | 0.1-1.0 | Set scroller default proportion. |
|
||||||
|
| `scroller_default_proportion_single` | float | 0.1-1.0 | Set scroller auto adjust proportion when it is single window(only apply when set `scroller_ignore_proportion_single` to `0`) |
|
||||||
|
| `scroller_ignore_proportion_single` | integer | `0` / `1` | Ignore scroller single proportion setting. |
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
|
|
@ -204,6 +207,10 @@ tagrule=id:4,monitor_name:eDP-1,no_hide:1,layout_name:scroller
|
||||||
# Advanced tag configuration with master layout settings
|
# Advanced tag configuration with master layout settings
|
||||||
tagrule=id:5,layout_name:tile,nmaster:2,mfact:0.6
|
tagrule=id:5,layout_name:tile,nmaster:2,mfact:0.6
|
||||||
tagrule=id:6,monitor_name:HDMI-A-1,layout_name:monocle,no_render_border:1
|
tagrule=id:6,monitor_name:HDMI-A-1,layout_name:monocle,no_render_border:1
|
||||||
|
|
||||||
|
# set scroller proportion for specific tag
|
||||||
|
tagrule=id:1,layout_name:scroller,scroller_default_proportion_single:0.5,scroller_ignore_proportion_single:0,scroller_default_proportion:0.9,monitor_name:HDMI-A-1
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
> **Tip:** For Waybar configuration with persistent tags, see [Status Bar](/docs/visuals/status-bar) documentation.
|
> **Tip:** For Waybar configuration with persistent tags, see [Status Bar](/docs/visuals/status-bar) documentation.
|
||||||
|
|
|
||||||
|
|
@ -587,17 +587,6 @@ void client_set_drop_area(Client *c) {
|
||||||
bool dwindle_familiar =
|
bool dwindle_familiar =
|
||||||
cur_layout->id == DWINDLE && config.dwindle_drop_simple_split;
|
cur_layout->id == DWINDLE && config.dwindle_drop_simple_split;
|
||||||
|
|
||||||
uint32_t nmaster = c->mon->pertag->nmasters[c->mon->pertag->curtag];
|
|
||||||
|
|
||||||
bool should_swap =
|
|
||||||
(cur_layout->id == DECK || cur_layout->id == VERTICAL_DECK ||
|
|
||||||
cur_layout->id == MONOCLE || cur_layout->id == GRID ||
|
|
||||||
cur_layout->id == FAIR || cur_layout->id == VERTICAL_FAIR ||
|
|
||||||
cur_layout->id == VERTICAL_GRID) ||
|
|
||||||
((cur_layout->id == TILE || cur_layout->id == VERTICAL_TILE ||
|
|
||||||
cur_layout->id == CENTER_TILE || cur_layout->id == RIGHT_TILE) &&
|
|
||||||
nmaster == 1 && c->ismaster);
|
|
||||||
|
|
||||||
if (dwindle_familiar) {
|
if (dwindle_familiar) {
|
||||||
bool split_h = c->geom.width >= c->geom.height;
|
bool split_h = c->geom.width >= c->geom.height;
|
||||||
float ratio = config.dwindle_split_ratio;
|
float ratio = config.dwindle_split_ratio;
|
||||||
|
|
@ -631,42 +620,87 @@ void client_set_drop_area(Client *c) {
|
||||||
client_height - (int32_t)(client_height * ratio);
|
client_height - (int32_t)(client_height * ratio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (should_swap) {
|
|
||||||
drop_box.x = bw;
|
|
||||||
drop_box.y = bw;
|
|
||||||
drop_box.width = client_width;
|
|
||||||
drop_box.height = client_height;
|
|
||||||
drop_direction = UNDIR;
|
|
||||||
} else if (cur_layout->id == TILE || cur_layout->id == DECK ||
|
} else if (cur_layout->id == TILE || cur_layout->id == DECK ||
|
||||||
cur_layout->id == CENTER_TILE || cur_layout->id == RIGHT_TILE) {
|
cur_layout->id == CENTER_TILE || cur_layout->id == RIGHT_TILE) {
|
||||||
if (rel_y < client_height * 0.5) {
|
|
||||||
drop_direction = UP;
|
if (c->ismaster) {
|
||||||
drop_box.x = bw;
|
if (c->mon->visible_tiling_clients == 1) {
|
||||||
drop_box.y = bw;
|
if (rel_x < client_width * 0.5) {
|
||||||
drop_box.width = client_width;
|
drop_direction = LEFT;
|
||||||
drop_box.height = client_height / 2;
|
drop_box.x = bw;
|
||||||
|
drop_box.y = bw;
|
||||||
|
drop_box.width = client_width / 2;
|
||||||
|
drop_box.height = client_height;
|
||||||
|
} else {
|
||||||
|
drop_direction = RIGHT;
|
||||||
|
drop_box.x = bw + client_width / 2;
|
||||||
|
drop_box.y = bw;
|
||||||
|
drop_box.width = client_width / 2;
|
||||||
|
drop_box.height = client_height;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
drop_box.x = bw;
|
||||||
|
drop_box.y = bw;
|
||||||
|
drop_box.width = client_width;
|
||||||
|
drop_box.height = client_height;
|
||||||
|
drop_direction = UNDIR;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
drop_direction = DOWN;
|
if (rel_y < client_height * 0.5) {
|
||||||
drop_box.x = bw;
|
drop_direction = UP;
|
||||||
drop_box.y = bw + client_height / 2;
|
drop_box.x = bw;
|
||||||
drop_box.width = client_width;
|
drop_box.y = bw;
|
||||||
drop_box.height = client_height / 2;
|
drop_box.width = client_width;
|
||||||
|
drop_box.height = client_height / 2;
|
||||||
|
} else {
|
||||||
|
drop_direction = DOWN;
|
||||||
|
drop_box.x = bw;
|
||||||
|
drop_box.y = bw + client_height / 2;
|
||||||
|
drop_box.width = client_width;
|
||||||
|
drop_box.height = client_height / 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (cur_layout->id == VERTICAL_TILE ||
|
} else if (cur_layout->id == VERTICAL_TILE ||
|
||||||
cur_layout->id == VERTICAL_DECK) {
|
cur_layout->id == VERTICAL_DECK) {
|
||||||
if (rel_x < client_width * 0.5) {
|
if (c->ismaster) {
|
||||||
drop_direction = LEFT;
|
if (c->mon->visible_tiling_clients == 1) {
|
||||||
drop_box.x = bw;
|
if (rel_y < client_height * 0.5) {
|
||||||
drop_box.y = bw;
|
drop_direction = UP;
|
||||||
drop_box.width = client_width / 2;
|
drop_box.x = bw;
|
||||||
drop_box.height = client_height;
|
drop_box.y = bw;
|
||||||
|
drop_box.width = client_width;
|
||||||
|
drop_box.height = client_height / 2;
|
||||||
|
} else {
|
||||||
|
drop_direction = DOWN;
|
||||||
|
drop_box.x = bw;
|
||||||
|
drop_box.y = bw + client_height / 2;
|
||||||
|
drop_box.width = client_width;
|
||||||
|
drop_box.height = client_height / 2;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
drop_box.x = bw;
|
||||||
|
drop_box.y = bw;
|
||||||
|
drop_box.width = client_width;
|
||||||
|
drop_box.height = client_height;
|
||||||
|
drop_direction = UNDIR;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
drop_direction = RIGHT;
|
if (rel_x < client_width * 0.5) {
|
||||||
drop_box.x = bw + client_width / 2;
|
drop_direction = LEFT;
|
||||||
drop_box.y = bw;
|
drop_box.x = bw;
|
||||||
drop_box.width = client_width / 2;
|
drop_box.y = bw;
|
||||||
drop_box.height = client_height;
|
drop_box.width = client_width / 2;
|
||||||
|
drop_box.height = client_height;
|
||||||
|
} else {
|
||||||
|
drop_direction = RIGHT;
|
||||||
|
drop_box.x = bw + client_width / 2;
|
||||||
|
drop_box.y = bw;
|
||||||
|
drop_box.width = client_width / 2;
|
||||||
|
drop_box.height = client_height;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
double dist_left = rel_x;
|
double dist_left = rel_x;
|
||||||
double dist_right = client_width - rel_x;
|
double dist_right = client_width - rel_x;
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,9 @@ void set_arrange_hidden(Monitor *m, Client *c, bool want_animation) {
|
||||||
c->animation.tagining = false;
|
c->animation.tagining = false;
|
||||||
set_tagout_animation(m, c);
|
set_tagout_animation(m, c);
|
||||||
} else {
|
} else {
|
||||||
|
c->animation.running = false;
|
||||||
wlr_scene_node_set_enabled(&c->scene->node, false);
|
wlr_scene_node_set_enabled(&c->scene->node, false);
|
||||||
|
c->animainit_geom = c->current = c->pending = c->animation.current =
|
||||||
|
c->geom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -165,6 +165,9 @@ typedef struct {
|
||||||
char *monitor_serial;
|
char *monitor_serial;
|
||||||
float mfact;
|
float mfact;
|
||||||
int32_t nmaster;
|
int32_t nmaster;
|
||||||
|
float scroller_default_proportion;
|
||||||
|
float scroller_default_proportion_single;
|
||||||
|
int32_t scroller_ignore_proportion_single;
|
||||||
int32_t no_render_border;
|
int32_t no_render_border;
|
||||||
int32_t open_as_floating;
|
int32_t open_as_floating;
|
||||||
int32_t no_hide;
|
int32_t no_hide;
|
||||||
|
|
@ -1973,6 +1976,9 @@ bool parse_option(Config *config, char *key, char *value) {
|
||||||
rule->no_render_border = 0;
|
rule->no_render_border = 0;
|
||||||
rule->open_as_floating = 0;
|
rule->open_as_floating = 0;
|
||||||
rule->no_hide = 0;
|
rule->no_hide = 0;
|
||||||
|
rule->scroller_default_proportion = 0.0f;
|
||||||
|
rule->scroller_default_proportion_single = 0.0f;
|
||||||
|
rule->scroller_ignore_proportion_single = -1;
|
||||||
|
|
||||||
bool parse_error = false;
|
bool parse_error = false;
|
||||||
char *token = strtok(value, ",");
|
char *token = strtok(value, ",");
|
||||||
|
|
@ -2008,6 +2014,17 @@ bool parse_option(Config *config, char *key, char *value) {
|
||||||
rule->nmaster = CLAMP_INT(atoi(val), 1, 99);
|
rule->nmaster = CLAMP_INT(atoi(val), 1, 99);
|
||||||
} else if (strcmp(key, "mfact") == 0) {
|
} else if (strcmp(key, "mfact") == 0) {
|
||||||
rule->mfact = CLAMP_FLOAT(atof(val), 0.1f, 0.9f);
|
rule->mfact = CLAMP_FLOAT(atof(val), 0.1f, 0.9f);
|
||||||
|
} else if (strcmp(key, "scroller_default_proportion") == 0) {
|
||||||
|
rule->scroller_default_proportion =
|
||||||
|
CLAMP_FLOAT(atof(val), 0.0f, 1.0f);
|
||||||
|
} else if (strcmp(key, "scroller_default_proportion_single") ==
|
||||||
|
0) {
|
||||||
|
rule->scroller_default_proportion_single =
|
||||||
|
CLAMP_FLOAT(atof(val), 0.0f, 1.0f);
|
||||||
|
} else if (strcmp(key, "scroller_ignore_proportion_single") ==
|
||||||
|
0) {
|
||||||
|
rule->scroller_ignore_proportion_single =
|
||||||
|
CLAMP_INT(atoi(val), 0, 1);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"\033[1m\033[31m[ERROR]:\033[33m Unknown "
|
"\033[1m\033[31m[ERROR]:\033[33m Unknown "
|
||||||
|
|
@ -3771,6 +3788,12 @@ void parse_tagrule(Monitor *m) {
|
||||||
for (i = 0; i <= LENGTH(tags); i++) {
|
for (i = 0; i <= LENGTH(tags); i++) {
|
||||||
m->pertag->nmasters[i] = config.default_nmaster;
|
m->pertag->nmasters[i] = config.default_nmaster;
|
||||||
m->pertag->mfacts[i] = config.default_mfact;
|
m->pertag->mfacts[i] = config.default_mfact;
|
||||||
|
m->pertag->scroller_default_proportion[i] =
|
||||||
|
config.scroller_default_proportion;
|
||||||
|
m->pertag->scroller_default_proportion_single[i] =
|
||||||
|
config.scroller_default_proportion_single;
|
||||||
|
m->pertag->scroller_ignore_proportion_single[i] =
|
||||||
|
config.scroller_ignore_proportion_single;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < config.tag_rules_count; i++) {
|
for (i = 0; i < config.tag_rules_count; i++) {
|
||||||
|
|
@ -3825,6 +3848,15 @@ void parse_tagrule(Monitor *m) {
|
||||||
m->pertag->no_render_border[tr.id] = tr.no_render_border;
|
m->pertag->no_render_border[tr.id] = tr.no_render_border;
|
||||||
if (tr.open_as_floating >= 0)
|
if (tr.open_as_floating >= 0)
|
||||||
m->pertag->open_as_floating[tr.id] = tr.open_as_floating;
|
m->pertag->open_as_floating[tr.id] = tr.open_as_floating;
|
||||||
|
if (tr.scroller_default_proportion > 0.0f)
|
||||||
|
m->pertag->scroller_default_proportion[tr.id] =
|
||||||
|
tr.scroller_default_proportion;
|
||||||
|
if (tr.scroller_default_proportion_single > 0.0f)
|
||||||
|
m->pertag->scroller_default_proportion_single[tr.id] =
|
||||||
|
tr.scroller_default_proportion_single;
|
||||||
|
if (tr.scroller_ignore_proportion_single >= 0)
|
||||||
|
m->pertag->scroller_ignore_proportion_single[tr.id] =
|
||||||
|
tr.scroller_ignore_proportion_single;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1356,9 +1356,9 @@ int32_t togglefullscreen(const Arg *arg) {
|
||||||
sel->isnamedscratchpad = 0;
|
sel->isnamedscratchpad = 0;
|
||||||
|
|
||||||
if (sel->isfullscreen)
|
if (sel->isfullscreen)
|
||||||
setfullscreen(sel, 0);
|
setfullscreen(sel, 0, true);
|
||||||
else
|
else
|
||||||
setfullscreen(sel, 1);
|
setfullscreen(sel, 1, true);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1402,9 +1402,9 @@ int32_t togglemaximizescreen(const Arg *arg) {
|
||||||
sel->isnamedscratchpad = 0;
|
sel->isnamedscratchpad = 0;
|
||||||
|
|
||||||
if (sel->ismaximizescreen)
|
if (sel->ismaximizescreen)
|
||||||
setmaximizescreen(sel, 0);
|
setmaximizescreen(sel, 0, true);
|
||||||
else
|
else
|
||||||
setmaximizescreen(sel, 1);
|
setmaximizescreen(sel, 1, true);
|
||||||
|
|
||||||
setborder_color(sel);
|
setborder_color(sel);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -1761,7 +1761,12 @@ int32_t toggleoverview(const Arg *arg) {
|
||||||
|
|
||||||
if (selmon->isoverview) {
|
if (selmon->isoverview) {
|
||||||
wlr_seat_pointer_clear_focus(seat);
|
wlr_seat_pointer_clear_focus(seat);
|
||||||
wlr_cursor_set_xcursor(cursor, cursor_mgr, "default");
|
|
||||||
|
if (cursor_hidden) {
|
||||||
|
handlecursoractivity();
|
||||||
|
} else {
|
||||||
|
wlr_cursor_set_xcursor(cursor, cursor_mgr, "default");
|
||||||
|
}
|
||||||
|
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (c && c->mon == selmon && !client_is_unmanaged(c) &&
|
if (c && c->mon == selmon && !client_is_unmanaged(c) &&
|
||||||
|
|
|
||||||
|
|
@ -188,10 +188,10 @@ void refresh_monitors_workspaces_status(Monitor *m) {
|
||||||
int32_t i;
|
int32_t i;
|
||||||
|
|
||||||
if (m->isoverview) {
|
if (m->isoverview) {
|
||||||
|
add_workspace_by_tag(0, m);
|
||||||
for (i = 1; i <= LENGTH(tags); i++) {
|
for (i = 1; i <= LENGTH(tags); i++) {
|
||||||
remove_workspace_by_tag(i, m);
|
remove_workspace_by_tag(i, m);
|
||||||
}
|
}
|
||||||
add_workspace_by_tag(0, m);
|
|
||||||
} else {
|
} else {
|
||||||
remove_workspace_by_tag(0, m);
|
remove_workspace_by_tag(0, m);
|
||||||
for (i = 1; i <= LENGTH(tags); i++) {
|
for (i = 1; i <= LENGTH(tags); i++) {
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,12 @@ void handle_foreign_maximize_request(struct wl_listener *listener, void *data) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (c->ismaximizescreen && !event->maximized) {
|
if (c->ismaximizescreen && !event->maximized) {
|
||||||
setmaximizescreen(c, 0);
|
setmaximizescreen(c, 0, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!c->ismaximizescreen && event->maximized) {
|
if (!c->ismaximizescreen && event->maximized) {
|
||||||
setmaximizescreen(c, 1);
|
setmaximizescreen(c, 1, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -59,12 +59,12 @@ void handle_foreign_fullscreen_request(struct wl_listener *listener,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (c->isfullscreen && !event->fullscreen) {
|
if (c->isfullscreen && !event->fullscreen) {
|
||||||
setfullscreen(c, 0);
|
setfullscreen(c, 0, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!c->isfullscreen && event->fullscreen) {
|
if (!c->isfullscreen && event->fullscreen) {
|
||||||
setfullscreen(c, 1);
|
setfullscreen(c, 1, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -160,11 +160,26 @@ void xytonode(double x, double y, struct wlr_surface **psurface, Client **pc,
|
||||||
if (pl)
|
if (pl)
|
||||||
*pl = l;
|
*pl = l;
|
||||||
|
|
||||||
if (selmon && selmon->isoverview && (!l || layer_ignores_focus(l))) {
|
if (selmon && selmon->isoverview && config.ov_no_resize) {
|
||||||
ovc = xytoclient(x, y);
|
ovc = xytoclient(x, y);
|
||||||
if (pc)
|
|
||||||
*pc = ovc;
|
bool is_below = false;
|
||||||
if (psurface && ovc)
|
if (l && l->layer_surface) {
|
||||||
*psurface = client_surface(ovc);
|
is_below = (l->layer_surface->current.layer ==
|
||||||
|
ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND ||
|
||||||
|
l->layer_surface->current.layer ==
|
||||||
|
ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ovc && (!l || layer_ignores_focus(l) || is_below)) {
|
||||||
|
if (pc)
|
||||||
|
*pc = ovc;
|
||||||
|
|
||||||
|
if (psurface)
|
||||||
|
*psurface = ovc ? client_surface(ovc) : NULL;
|
||||||
|
|
||||||
|
if (pl && ovc)
|
||||||
|
*pl = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -25,6 +25,9 @@ void set_size_per(Monitor *m, Client *c) {
|
||||||
c->master_inner_per = 1.0f;
|
c->master_inner_per = 1.0f;
|
||||||
c->stack_inner_per = 1.0f;
|
c->stack_inner_per = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c->scroller_proportion =
|
||||||
|
m->pertag->scroller_default_proportion[m->pertag->curtag];
|
||||||
}
|
}
|
||||||
|
|
||||||
void resize_tile_master_horizontal(Client *grabc, bool isdrag, int32_t offsetx,
|
void resize_tile_master_horizontal(Client *grabc, bool isdrag, int32_t offsetx,
|
||||||
|
|
|
||||||
|
|
@ -284,6 +284,10 @@ void scroller(Monitor *m) {
|
||||||
uint32_t tag = m->pertag->curtag;
|
uint32_t tag = m->pertag->curtag;
|
||||||
struct TagScrollerState *st = ensure_scroller_state(m, tag);
|
struct TagScrollerState *st = ensure_scroller_state(m, tag);
|
||||||
Client *c = NULL;
|
Client *c = NULL;
|
||||||
|
float scroller_default_proportion_single =
|
||||||
|
m->pertag->scroller_default_proportion_single[tag];
|
||||||
|
int32_t scroller_ignore_proportion_single =
|
||||||
|
m->pertag->scroller_ignore_proportion_single[tag];
|
||||||
|
|
||||||
/* 按全局客户端链表顺序收集所有堆叠头,确保视觉顺序正确 */
|
/* 按全局客户端链表顺序收集所有堆叠头,确保视觉顺序正确 */
|
||||||
struct ScrollerStackNode *heads[64];
|
struct ScrollerStackNode *heads[64];
|
||||||
|
|
@ -323,14 +327,13 @@ void scroller(Monitor *m) {
|
||||||
m->w.width - 2 * config.scroller_structs - cur_gappih;
|
m->w.width - 2 * config.scroller_structs - cur_gappih;
|
||||||
|
|
||||||
/* 单客户端特例 */
|
/* 单客户端特例 */
|
||||||
if (n_heads == 1 && !config.scroller_ignore_proportion_single &&
|
if (n_heads == 1 && !scroller_ignore_proportion_single &&
|
||||||
!heads[0]->client->isfullscreen &&
|
!heads[0]->client->isfullscreen &&
|
||||||
!heads[0]->client->ismaximizescreen) {
|
!heads[0]->client->ismaximizescreen) {
|
||||||
struct ScrollerStackNode *head = heads[0];
|
struct ScrollerStackNode *head = heads[0];
|
||||||
float single_proportion =
|
float single_proportion = head->scroller_proportion_single > 0.0f
|
||||||
head->scroller_proportion_single > 0.0f
|
? head->scroller_proportion_single
|
||||||
? head->scroller_proportion_single
|
: scroller_default_proportion_single;
|
||||||
: config.scroller_default_proportion_single;
|
|
||||||
struct wlr_box target_geom;
|
struct wlr_box target_geom;
|
||||||
target_geom.height = m->w.height - 2 * cur_gappov;
|
target_geom.height = m->w.height - 2 * cur_gappov;
|
||||||
target_geom.width = (m->w.width - 2 * cur_gappoh) * single_proportion;
|
target_geom.width = (m->w.width - 2 * cur_gappoh) * single_proportion;
|
||||||
|
|
@ -420,7 +423,7 @@ void scroller(Monitor *m) {
|
||||||
max_client_width) >
|
max_client_width) >
|
||||||
m->w.width - 2 * config.scroller_structs - cur_gappih)));
|
m->w.width - 2 * config.scroller_structs - cur_gappih)));
|
||||||
|
|
||||||
if (n_heads == 1 && config.scroller_ignore_proportion_single) {
|
if (n_heads == 1 && scroller_ignore_proportion_single) {
|
||||||
need_scroller = true;
|
need_scroller = true;
|
||||||
}
|
}
|
||||||
if (start_drag_window)
|
if (start_drag_window)
|
||||||
|
|
@ -507,6 +510,10 @@ void vertical_scroller(Monitor *m) {
|
||||||
uint32_t tag = m->pertag->curtag;
|
uint32_t tag = m->pertag->curtag;
|
||||||
struct TagScrollerState *st = ensure_scroller_state(m, tag);
|
struct TagScrollerState *st = ensure_scroller_state(m, tag);
|
||||||
Client *c = NULL;
|
Client *c = NULL;
|
||||||
|
float scroller_default_proportion_single =
|
||||||
|
m->pertag->scroller_default_proportion_single[tag];
|
||||||
|
int32_t scroller_ignore_proportion_single =
|
||||||
|
m->pertag->scroller_ignore_proportion_single[tag];
|
||||||
|
|
||||||
/* 按全局顺序收集堆叠头 */
|
/* 按全局顺序收集堆叠头 */
|
||||||
struct ScrollerStackNode *heads[64];
|
struct ScrollerStackNode *heads[64];
|
||||||
|
|
@ -542,14 +549,13 @@ void vertical_scroller(Monitor *m) {
|
||||||
int32_t max_client_height =
|
int32_t max_client_height =
|
||||||
m->w.height - 2 * config.scroller_structs - cur_gappiv;
|
m->w.height - 2 * config.scroller_structs - cur_gappiv;
|
||||||
|
|
||||||
if (n_heads == 1 && !config.scroller_ignore_proportion_single &&
|
if (n_heads == 1 && !scroller_ignore_proportion_single &&
|
||||||
!heads[0]->client->isfullscreen &&
|
!heads[0]->client->isfullscreen &&
|
||||||
!heads[0]->client->ismaximizescreen) {
|
!heads[0]->client->ismaximizescreen) {
|
||||||
struct ScrollerStackNode *head = heads[0];
|
struct ScrollerStackNode *head = heads[0];
|
||||||
float single_proportion =
|
float single_proportion = head->scroller_proportion_single > 0.0f
|
||||||
head->scroller_proportion_single > 0.0f
|
? head->scroller_proportion_single
|
||||||
? head->scroller_proportion_single
|
: scroller_default_proportion_single;
|
||||||
: config.scroller_default_proportion_single;
|
|
||||||
struct wlr_box target_geom;
|
struct wlr_box target_geom;
|
||||||
target_geom.width = m->w.width - 2 * cur_gappoh;
|
target_geom.width = m->w.width - 2 * cur_gappoh;
|
||||||
target_geom.height = (m->w.height - 2 * cur_gappov) * single_proportion;
|
target_geom.height = (m->w.height - 2 * cur_gappov) * single_proportion;
|
||||||
|
|
@ -638,7 +644,7 @@ void vertical_scroller(Monitor *m) {
|
||||||
max_client_height) >
|
max_client_height) >
|
||||||
m->w.height - 2 * config.scroller_structs - cur_gappiv)));
|
m->w.height - 2 * config.scroller_structs - cur_gappiv)));
|
||||||
|
|
||||||
if (n_heads == 1 && config.scroller_ignore_proportion_single) {
|
if (n_heads == 1 && scroller_ignore_proportion_single) {
|
||||||
need_scroller = true;
|
need_scroller = true;
|
||||||
}
|
}
|
||||||
if (start_drag_window)
|
if (start_drag_window)
|
||||||
|
|
@ -743,9 +749,9 @@ void scroller_insert_stack(Client *c, Client *target_client,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (c->isfullscreen)
|
if (c->isfullscreen)
|
||||||
setfullscreen(c, 0);
|
setfullscreen(c, 0, true);
|
||||||
if (c->ismaximizescreen)
|
if (c->ismaximizescreen)
|
||||||
setmaximizescreen(c, 0);
|
setmaximizescreen(c, 0, true);
|
||||||
|
|
||||||
Monitor *m = c->mon;
|
Monitor *m = c->mon;
|
||||||
uint32_t tag = m->pertag->curtag;
|
uint32_t tag = m->pertag->curtag;
|
||||||
|
|
@ -785,9 +791,9 @@ void scroller_insert_stack(Client *c, Client *target_client,
|
||||||
head = head->prev_in_stack;
|
head = head->prev_in_stack;
|
||||||
Client *stack_head = head->client;
|
Client *stack_head = head->client;
|
||||||
if (stack_head->ismaximizescreen)
|
if (stack_head->ismaximizescreen)
|
||||||
setmaximizescreen(stack_head, 0);
|
setmaximizescreen(stack_head, 0, true);
|
||||||
if (stack_head->isfullscreen)
|
if (stack_head->isfullscreen)
|
||||||
setfullscreen(stack_head, 0);
|
setfullscreen(stack_head, 0, true);
|
||||||
|
|
||||||
/* 同步到 Client 字段 */
|
/* 同步到 Client 字段 */
|
||||||
sync_scroller_state_to_clients(m, tag);
|
sync_scroller_state_to_clients(m, tag);
|
||||||
|
|
|
||||||
74
src/mango.c
74
src/mango.c
|
|
@ -746,8 +746,9 @@ static void run(char *startup_cmd);
|
||||||
static void setcursor(struct wl_listener *listener, void *data);
|
static void setcursor(struct wl_listener *listener, void *data);
|
||||||
static void setfloating(Client *c, int32_t floating);
|
static void setfloating(Client *c, int32_t floating);
|
||||||
static void setfakefullscreen(Client *c, int32_t fakefullscreen);
|
static void setfakefullscreen(Client *c, int32_t fakefullscreen);
|
||||||
static void setfullscreen(Client *c, int32_t fullscreen);
|
static void setfullscreen(Client *c, int32_t fullscreen, bool rearrange);
|
||||||
static void setmaximizescreen(Client *c, int32_t maximizescreen);
|
static void setmaximizescreen(Client *c, int32_t maximizescreen,
|
||||||
|
bool rearrange);
|
||||||
static void reset_maximizescreen_size(Client *c);
|
static void reset_maximizescreen_size(Client *c);
|
||||||
static void setgaps(int32_t oh, int32_t ov, int32_t ih, int32_t iv);
|
static void setgaps(int32_t oh, int32_t ov, int32_t ih, int32_t iv);
|
||||||
|
|
||||||
|
|
@ -1045,6 +1046,9 @@ struct Pertag {
|
||||||
int32_t no_hide[LENGTH(tags) + 1];
|
int32_t no_hide[LENGTH(tags) + 1];
|
||||||
int32_t no_render_border[LENGTH(tags) + 1];
|
int32_t no_render_border[LENGTH(tags) + 1];
|
||||||
int32_t open_as_floating[LENGTH(tags) + 1];
|
int32_t open_as_floating[LENGTH(tags) + 1];
|
||||||
|
float scroller_default_proportion[LENGTH(tags) + 1];
|
||||||
|
float scroller_default_proportion_single[LENGTH(tags) + 1];
|
||||||
|
int32_t scroller_ignore_proportion_single[LENGTH(tags) + 1];
|
||||||
struct DwindleNode *dwindle_root[LENGTH(tags) + 1];
|
struct DwindleNode *dwindle_root[LENGTH(tags) + 1];
|
||||||
const Layout *ltidxs[LENGTH(tags) + 1];
|
const Layout *ltidxs[LENGTH(tags) + 1];
|
||||||
struct TagScrollerState *scroller_state[LENGTH(tags) + 1];
|
struct TagScrollerState *scroller_state[LENGTH(tags) + 1];
|
||||||
|
|
@ -1171,11 +1175,11 @@ void clear_fullscreen_flag(Client *c) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->isfullscreen) {
|
if (c->isfullscreen) {
|
||||||
setfullscreen(c, false);
|
setfullscreen(c, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->ismaximizescreen) {
|
if (c->ismaximizescreen) {
|
||||||
setmaximizescreen(c, 0);
|
setmaximizescreen(c, 0, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1767,7 +1771,7 @@ void applyrules(Client *c) {
|
||||||
view_in_mon(&(Arg){.ui = c->tags}, true, c->mon, true);
|
view_in_mon(&(Arg){.ui = c->tags}, true, c->mon, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
setfullscreen(c, fullscreen_state_backup);
|
setfullscreen(c, fullscreen_state_backup, true);
|
||||||
|
|
||||||
if (c->isfakefullscreen) {
|
if (c->isfakefullscreen) {
|
||||||
setfakefullscreen(c, 1);
|
setfakefullscreen(c, 1);
|
||||||
|
|
@ -2221,9 +2225,10 @@ void hold_end(struct wl_listener *listener, void *data) {
|
||||||
Client *find_closest_tiled_client(Client *c) {
|
Client *find_closest_tiled_client(Client *c) {
|
||||||
Client *tc, *closest = NULL;
|
Client *tc, *closest = NULL;
|
||||||
long min_dist = LONG_MAX;
|
long min_dist = LONG_MAX;
|
||||||
|
Monitor *cursor_mon = xytomon(cursor->x, cursor->y);
|
||||||
|
|
||||||
wl_list_for_each(tc, &clients, link) {
|
wl_list_for_each(tc, &clients, link) {
|
||||||
if (tc == c || !ISTILED(tc) || !VISIBLEON(tc, c->mon))
|
if (tc == c || !ISTILED(tc) || !VISIBLEON(tc, cursor_mon))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (cursor->x >= tc->geom.x &&
|
if (cursor->x >= tc->geom.x &&
|
||||||
|
|
@ -2255,7 +2260,9 @@ void place_drag_tile_client(Client *c) {
|
||||||
|
|
||||||
if (closest->drop_direction == UNDIR) {
|
if (closest->drop_direction == UNDIR) {
|
||||||
setfloating(c, 0);
|
setfloating(c, 0);
|
||||||
exchange_two_client(c, closest);
|
wl_list_remove(&c->link);
|
||||||
|
wl_list_insert(closest->link.prev, &c->link);
|
||||||
|
arrange(closest->mon, false, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2354,6 +2361,17 @@ bool handle_buttonpress(struct wlr_pointer_button_event *event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// overview模式下鼠标左键跳转,右键关闭窗口
|
||||||
|
if (selmon && selmon->isoverview && event->button == BTN_LEFT && c) {
|
||||||
|
toggleoverview(&(Arg){.i = 1});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selmon && selmon->isoverview && event->button == BTN_RIGHT && c) {
|
||||||
|
pending_kill_client(c);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// 当鼠标焦点在layer上的时候,不检测虚拟键盘的mod状态,
|
// 当鼠标焦点在layer上的时候,不检测虚拟键盘的mod状态,
|
||||||
// 避免layer虚拟键盘锁死mod按键状态
|
// 避免layer虚拟键盘锁死mod按键状态
|
||||||
hard_keyboard = &kb_group->wlr_group->keyboard;
|
hard_keyboard = &kb_group->wlr_group->keyboard;
|
||||||
|
|
@ -2370,16 +2388,6 @@ bool handle_buttonpress(struct wlr_pointer_button_event *event) {
|
||||||
break;
|
break;
|
||||||
m = &config.mouse_bindings[ji];
|
m = &config.mouse_bindings[ji];
|
||||||
|
|
||||||
if (selmon->isoverview && event->button == BTN_LEFT && c) {
|
|
||||||
toggleoverview(&(Arg){.i = 1});
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selmon->isoverview && event->button == BTN_RIGHT && c) {
|
|
||||||
pending_kill_client(c);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CLEANMASK(mods) == CLEANMASK(m->mod) &&
|
if (CLEANMASK(mods) == CLEANMASK(m->mod) &&
|
||||||
event->button == m->button && m->func &&
|
event->button == m->button && m->func &&
|
||||||
(CLEANMASK(m->mod) != 0 ||
|
(CLEANMASK(m->mod) != 0 ||
|
||||||
|
|
@ -3892,7 +3900,7 @@ fullscreennotify(struct wl_listener *listener, void *data) {
|
||||||
if (!c || c->iskilling)
|
if (!c || c->iskilling)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
setfullscreen(c, client_wants_fullscreen(c));
|
setfullscreen(c, client_wants_fullscreen(c), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void requestmonstate(struct wl_listener *listener, void *data) {
|
void requestmonstate(struct wl_listener *listener, void *data) {
|
||||||
|
|
@ -4517,9 +4525,9 @@ void maximizenotify(struct wl_listener *listener, void *data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client_request_maximize(c, data)) {
|
if (client_request_maximize(c, data)) {
|
||||||
setmaximizescreen(c, 1);
|
setmaximizescreen(c, 1, true);
|
||||||
} else {
|
} else {
|
||||||
setmaximizescreen(c, 0);
|
setmaximizescreen(c, 0, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5451,7 +5459,7 @@ void exit_scroller_stack(Client *c) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setmaximizescreen(Client *c, int32_t maximizescreen) {
|
void setmaximizescreen(Client *c, int32_t maximizescreen, bool rearrange) {
|
||||||
struct wlr_box maximizescreen_box;
|
struct wlr_box maximizescreen_box;
|
||||||
if (!c || !c->mon || !client_surface(c)->mapped || c->iskilling)
|
if (!c || !c->mon || !client_surface(c)->mapped || c->iskilling)
|
||||||
return;
|
return;
|
||||||
|
|
@ -5492,7 +5500,8 @@ void setmaximizescreen(Client *c, int32_t maximizescreen) {
|
||||||
client_set_maximized(c, true);
|
client_set_maximized(c, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
arrange(c->mon, false, false);
|
if (rearrange)
|
||||||
|
arrange(c->mon, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setfakefullscreen(Client *c, int32_t fakefullscreen) {
|
void setfakefullscreen(Client *c, int32_t fakefullscreen) {
|
||||||
|
|
@ -5501,12 +5510,13 @@ void setfakefullscreen(Client *c, int32_t fakefullscreen) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (c->isfullscreen)
|
if (c->isfullscreen)
|
||||||
setfullscreen(c, 0);
|
setfullscreen(c, 0, true);
|
||||||
|
|
||||||
client_set_fullscreen(c, fakefullscreen);
|
client_set_fullscreen(c, fakefullscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setfullscreen(Client *c, int32_t fullscreen) // 用自定义全屏代理自带全屏
|
void setfullscreen(Client *c, int32_t fullscreen,
|
||||||
|
bool rearrange) // 用自定义全屏代理自带全屏
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!c || !c->mon || !client_surface(c)->mapped || c->iskilling)
|
if (!c || !c->mon || !client_surface(c)->mapped || c->iskilling)
|
||||||
|
|
@ -5552,7 +5562,8 @@ void setfullscreen(Client *c, int32_t fullscreen) // 用自定义全屏代理自
|
||||||
layers[fullscreen || c->isfloating ? LyrTop : LyrTile]);
|
layers[fullscreen || c->isfloating ? LyrTop : LyrTile]);
|
||||||
}
|
}
|
||||||
|
|
||||||
arrange(c->mon, false, false);
|
if (rearrange)
|
||||||
|
arrange(c->mon, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setgaps(int32_t oh, int32_t ov, int32_t ih, int32_t iv) {
|
void setgaps(int32_t oh, int32_t ov, int32_t ih, int32_t iv) {
|
||||||
|
|
@ -5681,7 +5692,8 @@ void setmon(Client *c, Monitor *m, uint32_t newtags, bool focus) {
|
||||||
client_reset_mon_tags(c, m, newtags);
|
client_reset_mon_tags(c, m, newtags);
|
||||||
check_match_tag_floating_rule(c, m);
|
check_match_tag_floating_rule(c, m);
|
||||||
setfloating(c, c->isfloating);
|
setfloating(c, c->isfloating);
|
||||||
setfullscreen(c, c->isfullscreen); /* This will call arrange(c->mon) */
|
setfullscreen(c, c->isfullscreen,
|
||||||
|
true); /* This will call arrange(c->mon) */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (focus && !client_is_x11_popup(c)) {
|
if (focus && !client_is_x11_popup(c)) {
|
||||||
|
|
@ -6282,13 +6294,13 @@ void overview_restore(Client *c, const Arg *arg) {
|
||||||
resize(c, c->overview_backup_geom, 0);
|
resize(c, c->overview_backup_geom, 0);
|
||||||
} else if (c->isfullscreen || c->ismaximizescreen) {
|
} else if (c->isfullscreen || c->ismaximizescreen) {
|
||||||
if (want_restore_fullscreen(c) && c->ismaximizescreen) {
|
if (want_restore_fullscreen(c) && c->ismaximizescreen) {
|
||||||
setmaximizescreen(c, 1);
|
setmaximizescreen(c, 1, false);
|
||||||
} else if (want_restore_fullscreen(c) && c->isfullscreen) {
|
} else if (want_restore_fullscreen(c) && c->isfullscreen) {
|
||||||
setfullscreen(c, 1);
|
setfullscreen(c, 1, false);
|
||||||
} else {
|
} else {
|
||||||
client_pending_fullscreen_state(c, 0);
|
client_pending_fullscreen_state(c, 0);
|
||||||
client_pending_maximized_state(c, 0);
|
client_pending_maximized_state(c, 0);
|
||||||
setfullscreen(c, false);
|
setfullscreen(c, false, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (c->is_restoring_from_ov) {
|
if (c->is_restoring_from_ov) {
|
||||||
|
|
@ -6487,8 +6499,8 @@ void unmapnotify(struct wl_listener *listener, void *data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->swallowedby) {
|
if (c->swallowedby) {
|
||||||
setmaximizescreen(c->swallowedby, c->ismaximizescreen);
|
setmaximizescreen(c->swallowedby, c->ismaximizescreen, true);
|
||||||
setfullscreen(c->swallowedby, c->isfullscreen);
|
setfullscreen(c->swallowedby, c->isfullscreen, true);
|
||||||
c->swallowedby->swallowing = NULL;
|
c->swallowedby->swallowing = NULL;
|
||||||
c->swallowedby = NULL;
|
c->swallowedby = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue