mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
resolves #205
This commit is contained in:
parent
f47492c371
commit
737da3615f
@ -20,6 +20,7 @@ class Workspaces : public IModule {
|
|||||||
private:
|
private:
|
||||||
void worker();
|
void worker();
|
||||||
void addWorkspace(const Json::Value&);
|
void addWorkspace(const Json::Value&);
|
||||||
|
void onButtonReady(const Json::Value&, Gtk::Button&);
|
||||||
std::string getIcon(const std::string&, const Json::Value&);
|
std::string getIcon(const std::string&, const Json::Value&);
|
||||||
bool handleScroll(GdkEventScroll*);
|
bool handleScroll(GdkEventScroll*);
|
||||||
std::string getPrevWorkspace();
|
std::string getPrevWorkspace();
|
||||||
|
@ -87,7 +87,8 @@ auto waybar::modules::sway::Workspaces::update() -> void
|
|||||||
} else {
|
} else {
|
||||||
button.set_label(icon);
|
button.set_label(icon);
|
||||||
}
|
}
|
||||||
button.show();
|
|
||||||
|
onButtonReady(node, button);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (scrolling_) {
|
if (scrolling_) {
|
||||||
@ -131,7 +132,8 @@ void waybar::modules::sway::Workspaces::addWorkspace(const Json::Value &node)
|
|||||||
if (node["urgent"].asBool()) {
|
if (node["urgent"].asBool()) {
|
||||||
button.get_style_context()->add_class("urgent");
|
button.get_style_context()->add_class("urgent");
|
||||||
}
|
}
|
||||||
button.show();
|
|
||||||
|
onButtonReady(node, button);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string waybar::modules::sway::Workspaces::getIcon(const std::string &name,
|
std::string waybar::modules::sway::Workspaces::getIcon(const std::string &name,
|
||||||
@ -251,6 +253,19 @@ std::string waybar::modules::sway::Workspaces::trimWorkspaceName(std::string nam
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void waybar::modules::sway::Workspaces::onButtonReady(const Json::Value& node, Gtk::Button& button)
|
||||||
|
{
|
||||||
|
if (config_["current-only"].asBool()) {
|
||||||
|
if (node["focused"].asBool()) {
|
||||||
|
button.show();
|
||||||
|
} else {
|
||||||
|
button.hide();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
button.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
waybar::modules::sway::Workspaces::operator Gtk::Widget &() {
|
waybar::modules::sway::Workspaces::operator Gtk::Widget &() {
|
||||||
return box_;
|
return box_;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user