mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Implement hide_edge_borders smart (like in i3 4.13)
This commit is contained in:
		
							parent
							
								
									527c259d06
								
							
						
					
					
						commit
						c04819e8c0
					
				
					 3 changed files with 11 additions and 1 deletions
				
			
		| 
						 | 
					@ -178,7 +178,8 @@ enum edge_border_types {
 | 
				
			||||||
	E_NONE,         /**< Don't hide edge borders */
 | 
						E_NONE,         /**< Don't hide edge borders */
 | 
				
			||||||
	E_VERTICAL,     /**< hide vertical edge borders */
 | 
						E_VERTICAL,     /**< hide vertical edge borders */
 | 
				
			||||||
	E_HORIZONTAL,   /**< hide horizontal edge borders */
 | 
						E_HORIZONTAL,   /**< hide horizontal edge borders */
 | 
				
			||||||
	E_BOTH		/**< hide vertical and horizontal edge borders */
 | 
						E_BOTH,		/**< hide vertical and horizontal edge borders */
 | 
				
			||||||
 | 
						E_SMART		/**< hide both if precisely one window is present in workspace */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum command_context {
 | 
					enum command_context {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,6 +15,8 @@ struct cmd_results *cmd_hide_edge_borders(int argc, char **argv) {
 | 
				
			||||||
		config->hide_edge_borders = E_HORIZONTAL;
 | 
							config->hide_edge_borders = E_HORIZONTAL;
 | 
				
			||||||
	} else if (strcasecmp(argv[0], "both") == 0) {
 | 
						} else if (strcasecmp(argv[0], "both") == 0) {
 | 
				
			||||||
		config->hide_edge_borders = E_BOTH;
 | 
							config->hide_edge_borders = E_BOTH;
 | 
				
			||||||
 | 
						} else if (strcasecmp(argv[0], "smart") == 0) {
 | 
				
			||||||
 | 
							config->hide_edge_borders = E_SMART;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		return cmd_results_new(CMD_INVALID, "hide_edge_borders",
 | 
							return cmd_results_new(CMD_INVALID, "hide_edge_borders",
 | 
				
			||||||
				"Expected 'hide_edge_borders <none|vertical|horizontal|both>'");
 | 
									"Expected 'hide_edge_borders <none|vertical|horizontal|both>'");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -665,6 +665,13 @@ void update_geometry(swayc_t *container) {
 | 
				
			||||||
					border_bottom = 0;
 | 
										border_bottom = 0;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (config->hide_edge_borders == E_SMART && workspace->children->length == 1) {
 | 
				
			||||||
 | 
									border_top = 0;
 | 
				
			||||||
 | 
									border_bottom = 0;
 | 
				
			||||||
 | 
									border_left = 0;
 | 
				
			||||||
 | 
									border_right = 0;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		int title_bar_height = config->font_height + 4; //borders + padding
 | 
							int title_bar_height = config->font_height + 4; //borders + padding
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue