mirror of
				https://github.com/DreamMaoMao/maomaowm.git
				synced 2025-11-03 09:01:47 -05:00 
			
		
		
		
	feat: focusmon dispatch support mon name
This commit is contained in:
		
							parent
							
								
									eabb18b369
								
							
						
					
					
						commit
						81b67cdec7
					
				
					 2 changed files with 17 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -700,6 +700,9 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
 | 
			
		|||
	} else if (strcmp(func_name, "focusmon") == 0) {
 | 
			
		||||
		func = focusmon;
 | 
			
		||||
		(*arg).i = parse_direction(arg_value);
 | 
			
		||||
		if((*arg).i == UNDIR) {
 | 
			
		||||
			(*arg).v = strdup(arg_value);
 | 
			
		||||
		}
 | 
			
		||||
	} else if (strcmp(func_name, "tagmon") == 0) {
 | 
			
		||||
		func = tagmon;
 | 
			
		||||
		(*arg).i = parse_direction(arg_value);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										15
									
								
								src/maomao.c
									
										
									
									
									
								
							
							
						
						
									
										15
									
								
								src/maomao.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -4211,11 +4211,24 @@ void focusclient(Client *c, int lift) {
 | 
			
		|||
 | 
			
		||||
void focusmon(const Arg *arg) {
 | 
			
		||||
	Client *c;
 | 
			
		||||
	Monitor *m = NULL;
 | 
			
		||||
	int i = 0, nmons = wl_list_length(&mons);
 | 
			
		||||
	if (nmons) {
 | 
			
		||||
	if (nmons && arg->i != UNDIR) {
 | 
			
		||||
		do /* don't switch to disabled mons */
 | 
			
		||||
			selmon = dirtomon(arg->i);
 | 
			
		||||
		while (!selmon->wlr_output->enabled && i++ < nmons);
 | 
			
		||||
	} else if(arg->v) {
 | 
			
		||||
		wl_list_for_each(m, &mons, link) {
 | 
			
		||||
			if (!m->wlr_output->enabled) {
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
			if(regex_match(arg->v, m->wlr_output->name)) {
 | 
			
		||||
				selmon = m;
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	warp_cursor_to_selmon(selmon);
 | 
			
		||||
	c = focustop(selmon);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue