Merge pull request #1292 from FlexW/feature/sway-app-icon

Show application icon when using sway window module
This commit is contained in:
Alex
2022-03-06 14:50:41 +01:00
committed by GitHub
5 changed files with 117 additions and 4 deletions

25
include/AIconLabel.hpp Normal file
View 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

View File

@ -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_;