sway/window: Allow the user to change the size of the app icon

Fixes #1461
This commit is contained in:
Felix Weilbach
2022-04-17 23:54:27 +02:00
parent 264e2c3983
commit fc6f5741b1
3 changed files with 13 additions and 1 deletions

View File

@ -15,6 +15,12 @@ namespace waybar::modules::sway {
Window::Window(const std::string& id, const Bar& bar, const Json::Value& config)
: AIconLabel(config, "window", id, "{}", 0, true), bar_(bar), windowId_(-1) {
// Icon size
if (config_["icon-size"].isUInt()) {
app_icon_size_ = config["icon-size"].asUInt();
}
image_.set_pixel_size(app_icon_size_);
ipc_.subscribe(R"(["window","workspace"])");
ipc_.signal_event.connect(sigc::mem_fun(*this, &Window::onEvent));
ipc_.signal_cmd.connect(sigc::mem_fun(*this, &Window::onCmd));
@ -99,7 +105,7 @@ void Window::updateAppIcon() {
if (app_icon_name_.empty()) {
image_.set_visible(false);
} else {
image_.set_from_icon_name(app_icon_name_, Gtk::ICON_SIZE_LARGE_TOOLBAR);
image_.set_from_icon_name(app_icon_name_, Gtk::ICON_SIZE_INVALID);
image_.set_visible(true);
}
}