mirror of
				https://github.com/DreamMaoMao/maomaowm.git
				synced 2025-11-03 09:01:47 -05:00 
			
		
		
		
	feat: support widht and height set in toggle_named_scratch
This commit is contained in:
		
							parent
							
								
									90edcafd4e
								
							
						
					
					
						commit
						fc2eaf144d
					
				
					 2 changed files with 9 additions and 4 deletions
				
			
		| 
						 | 
					@ -557,6 +557,8 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value, char *arg_v
 | 
				
			||||||
    func = toggle_named_scratch;
 | 
					    func = toggle_named_scratch;
 | 
				
			||||||
    (*arg).v = strdup(arg_value);
 | 
					    (*arg).v = strdup(arg_value);
 | 
				
			||||||
    (*arg).v2 = strdup(arg_value2);
 | 
					    (*arg).v2 = strdup(arg_value2);
 | 
				
			||||||
 | 
					    (*arg).ui = arg_value3 ? atoi(arg_value3) : 0;
 | 
				
			||||||
 | 
					    (*arg).ui2 = arg_value4 ? atoi(arg_value4) : 0;
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    return NULL;
 | 
					    return NULL;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										11
									
								
								src/maomao.c
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								src/maomao.c
									
										
									
									
									
								
							| 
						 | 
					@ -203,7 +203,7 @@ typedef struct Client Client;
 | 
				
			||||||
struct Client {
 | 
					struct Client {
 | 
				
			||||||
  /* Must keep these three elements in this order */
 | 
					  /* Must keep these three elements in this order */
 | 
				
			||||||
  unsigned int type; /* XDGShell or X11* */
 | 
					  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 */
 | 
					      current; /* layout-relative, includes border */
 | 
				
			||||||
  Monitor *mon;
 | 
					  Monitor *mon;
 | 
				
			||||||
  struct wlr_scene_tree *scene;
 | 
					  struct wlr_scene_tree *scene;
 | 
				
			||||||
| 
						 | 
					@ -1308,10 +1308,10 @@ void show_scratchpad(Client *c) {
 | 
				
			||||||
  /* return if fullscreen */
 | 
					  /* return if fullscreen */
 | 
				
			||||||
  if (!c->isfloating) {
 | 
					  if (!c->isfloating) {
 | 
				
			||||||
    setfloating(c, 1);
 | 
					    setfloating(c, 1);
 | 
				
			||||||
    c->geom.width = c->mon->w.width * 0.7;
 | 
					    c->geom.width = c->scratch_geom.width ? c->scratch_geom.width: c->mon->w.width * 0.7;
 | 
				
			||||||
    c->geom.height = c->mon->w.height * 0.8;
 | 
					    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);
 | 
					    resize(c, c->geom, 0);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  c->oldtags = selmon->tagset[selmon->seltags];
 | 
					  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)
 | 
					  if(!target_client->is_in_scratchpad)
 | 
				
			||||||
    set_minized(target_client);
 | 
					    set_minized(target_client);
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue