mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	floating mode_toggle
This commit is contained in:
		
							parent
							
								
									c29214f348
								
							
						
					
					
						commit
						48a983316c
					
				
					 2 changed files with 14 additions and 0 deletions
				
			
		| 
						 | 
					@ -231,6 +231,17 @@ static bool cmd_floating(struct sway_config *config, int argc, char **argv) {
 | 
				
			||||||
			return true;
 | 
								return true;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		set_focused_container(view);
 | 
							set_focused_container(view);
 | 
				
			||||||
 | 
						} else if (strcasecmp(argv[0], "mode_toggle") == 0) {
 | 
				
			||||||
 | 
							if (get_focused_view(active_workspace)->is_floating) {
 | 
				
			||||||
 | 
								if (active_workspace->children->length > 0) {
 | 
				
			||||||
 | 
									set_focused_container(get_focused_view(active_workspace->children->items[0]));
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								if (active_workspace->floating->length > 0) {
 | 
				
			||||||
 | 
									swayc_t *floating = active_workspace->floating->items[active_workspace->floating->length-1];
 | 
				
			||||||
 | 
									set_focused_container(get_focused_view(floating));
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -316,6 +316,9 @@ static bool handle_key(wlc_handle view, uint32_t time, const struct wlc_modifier
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	bool cmd_success = false;
 | 
						bool cmd_success = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						sway_log(L_DEBUG, "modifier %x: state %d: key %d, sym: %d",
 | 
				
			||||||
 | 
								modifiers->mods, state, key, sym);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((modifiers->mods & config->floating_mod) && (dragging || resizing)) {
 | 
						if ((modifiers->mods & config->floating_mod) && (dragging || resizing)) {
 | 
				
			||||||
		reset_floating(get_focused_view(&root_container));
 | 
							reset_floating(get_focused_view(&root_container));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue