feat: support widht and height set in toggle_named_scratch

This commit is contained in:
DreamMaoMao 2025-05-05 11:19:57 +08:00
parent 90edcafd4e
commit fc2eaf144d
2 changed files with 9 additions and 4 deletions

View file

@ -203,7 +203,7 @@ typedef struct Client Client;
struct Client {
/* Must keep these three elements in this order */
unsigned int type; /* XDGShell or X11* */
struct wlr_box geom, pending, oldgeom, animainit_geom, overview_backup_geom,
struct wlr_box geom, pending, oldgeom,scratch_geom, animainit_geom, overview_backup_geom,
current; /* layout-relative, includes border */
Monitor *mon;
struct wlr_scene_tree *scene;
@ -1308,10 +1308,10 @@ void show_scratchpad(Client *c) {
/* return if fullscreen */
if (!c->isfloating) {
setfloating(c, 1);
c->geom.width = c->mon->w.width * 0.7;
c->geom.height = c->mon->w.height * 0.8;
c->geom.width = c->scratch_geom.width ? c->scratch_geom.width: c->mon->w.width * 0.7;
c->geom.height = c->scratch_geom.height? c->scratch_geom.height : c->mon->w.height * 0.8;
// 重新计算居中的坐标
c->geom = setclient_coordinate_center(c->geom, 0, 0);
c->geom = c->animainit_geom = c->animation.current = setclient_coordinate_center(c->geom, 0, 0);
resize(c, c->geom, 0);
}
c->oldtags = selmon->tagset[selmon->seltags];
@ -1494,6 +1494,9 @@ void toggle_named_scratch(const Arg *arg) {
}
}
target_client->scratch_geom.width = arg->ui;
target_client->scratch_geom.height = arg->ui2;
if(!target_client->is_in_scratchpad)
set_minized(target_client);
else