mirror of
				https://github.com/rad4day/Waybar.git
				synced 2025-10-24 22:52:32 +02:00 
			
		
		
		
	Merge pull request #1292 from FlexW/feature/sway-app-icon
Show application icon when using sway window module
This commit is contained in:
		
							
								
								
									
										25
									
								
								include/AIconLabel.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								include/AIconLabel.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| #pragma once | ||||
|  | ||||
| #include <gtkmm/box.h> | ||||
| #include <gtkmm/image.h> | ||||
|  | ||||
| #include "ALabel.hpp" | ||||
|  | ||||
| namespace waybar { | ||||
|  | ||||
| class AIconLabel : public ALabel { | ||||
|  public: | ||||
|   AIconLabel(const Json::Value &config, const std::string &name, const std::string &id, | ||||
|              const std::string &format, uint16_t interval = 0, bool ellipsize = false, | ||||
|              bool enable_click = false, bool enable_scroll = false); | ||||
|   virtual ~AIconLabel() = default; | ||||
|   virtual auto        update() -> void; | ||||
|  | ||||
|  protected: | ||||
|   Gtk::Image image_; | ||||
|   Gtk::Box   box_; | ||||
|  | ||||
|   bool iconEnabled() const; | ||||
| }; | ||||
|  | ||||
| }  // namespace waybar | ||||
| @@ -2,7 +2,8 @@ | ||||
|  | ||||
| #include <fmt/format.h> | ||||
| #include <tuple> | ||||
| #include "ALabel.hpp" | ||||
|  | ||||
| #include "AIconLabel.hpp" | ||||
| #include "bar.hpp" | ||||
| #include "client.hpp" | ||||
| #include "modules/sway/ipc/client.hpp" | ||||
| @@ -10,7 +11,7 @@ | ||||
|  | ||||
| namespace waybar::modules::sway { | ||||
|  | ||||
| class Window : public ALabel, public sigc::trackable { | ||||
| class Window : public AIconLabel, public sigc::trackable { | ||||
|  public: | ||||
|   Window(const std::string&, const waybar::Bar&, const Json::Value&); | ||||
|   ~Window() = default; | ||||
| @@ -23,6 +24,7 @@ class Window : public ALabel, public sigc::trackable { | ||||
|                                                                         std::string&       output); | ||||
|   void                                                   getTree(); | ||||
|   std::string                                            rewriteTitle(const std::string& title); | ||||
|   void                                                   updateAppIcon(); | ||||
|  | ||||
|   const Bar&       bar_; | ||||
|   std::string      window_; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Alex
					Alex