mirror of
				https://github.com/rad4day/Waybar.git
				synced 2025-10-31 16:02:43 +01:00 
			
		
		
		
	feat(modules): generic label module to allow max-length on all labels
This commit is contained in:
		
							
								
								
									
										24
									
								
								src/ALabel.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								src/ALabel.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| #include "ALabel.hpp" | ||||
|  | ||||
| waybar::ALabel::ALabel(Json::Value config) | ||||
|   : config_(std::move(config)) | ||||
| { | ||||
| 	if (config_["max-length"]) { | ||||
|     label_.set_max_width_chars(config_["max-length"].asUInt()); | ||||
|     label_.set_ellipsize(Pango::EllipsizeMode::ELLIPSIZE_END); | ||||
|   } | ||||
| } | ||||
|  | ||||
| waybar::ALabel::~ALabel() | ||||
| { | ||||
|   // Nothing here | ||||
| } | ||||
|  | ||||
| auto waybar::ALabel::update() -> void | ||||
| { | ||||
|   // Nothing here | ||||
| } | ||||
|  | ||||
| waybar::ALabel::operator Gtk::Widget &() { | ||||
|   return label_; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Alexis
					Alexis