mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Merge pull request #380 from mikkeloscar/bar-font-support
swaybar: Add font support
This commit is contained in:
		
						commit
						adf5b8fed7
					
				
					 1 changed files with 13 additions and 0 deletions
				
			
		| 
						 | 
					@ -186,6 +186,15 @@ uint32_t parse_position(const char *position) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					char *parse_font(const char *font) {
 | 
				
			||||||
 | 
						char *new_font = NULL;
 | 
				
			||||||
 | 
						if (strncmp("pango:", font, 6) == 0) {
 | 
				
			||||||
 | 
							new_font = strdup(font + 6);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return new_font;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int margin = 3;
 | 
					static int margin = 3;
 | 
				
			||||||
static const int ws_hor_padding = 5;
 | 
					static const int ws_hor_padding = 5;
 | 
				
			||||||
static double ws_ver_padding = 1.5;
 | 
					static double ws_ver_padding = 1.5;
 | 
				
			||||||
| 
						 | 
					@ -232,6 +241,10 @@ void bar_ipc_init(int outputi, const char *bar_id) {
 | 
				
			||||||
		desktop_shell_set_panel_position(registry->desktop_shell, parse_position(json_object_get_string(position)));
 | 
							desktop_shell_set_panel_position(registry->desktop_shell, parse_position(json_object_get_string(position)));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (font) {
 | 
				
			||||||
 | 
							window->font = parse_font(json_object_get_string(font));
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (bar_height) {
 | 
						if (bar_height) {
 | 
				
			||||||
		int width, height;
 | 
							int width, height;
 | 
				
			||||||
		get_text_size(window, &width, &height, "Test string for measuring purposes");
 | 
							get_text_size(window, &width, &height, "Test string for measuring purposes");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue