Merge branch 'Alexays:master' into master

pull/3017/head
Marc Meier 2024-03-20 14:50:40 +01:00 committed by GitHub
commit 01dce4609c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 24 additions and 15 deletions

View File

@ -242,7 +242,10 @@ void Workspaces::doUpdate() {
auto wName = wNameRaw.starts_with("special:") ? wNameRaw.substr(8) : wNameRaw;
return wName == workspace->name();
});
workspace->setOutput((*updated_workspace)["monitor"].asString());
if (updated_workspace != updated_workspaces.end()) {
workspace->setOutput((*updated_workspace)["monitor"].asString());
}
workspace->update(m_format, workspaceIcon, m_tooltipFormat);
}

View File

@ -39,6 +39,7 @@ PowerProfilesDaemon::PowerProfilesDaemon(const std::string& id, const Json::Valu
// adresses for compatibility sake.
//
// Revisit this in 2026, systems should be updated by then.
Gio::DBus::Proxy::create_for_bus(Gio::DBus::BusType::BUS_TYPE_SYSTEM, "net.hadess.PowerProfiles",
"/net/hadess/PowerProfiles", "net.hadess.PowerProfiles",
sigc::mem_fun(*this, &PowerProfilesDaemon::busConnectedCb));
@ -175,9 +176,16 @@ auto PowerProfilesDaemon::update() -> void {
bool PowerProfilesDaemon::handleToggle(GdkEventButton* const& e) {
if (e->type == GdkEventType::GDK_BUTTON_PRESS && connected_) {
activeProfile_++;
if (activeProfile_ == availableProfiles_.end()) {
activeProfile_ = availableProfiles_.begin();
if (e->button == 1) /* left click */ {
activeProfile_++;
if (activeProfile_ == availableProfiles_.end()) {
activeProfile_ = availableProfiles_.begin();
}
} else {
if (activeProfile_ == availableProfiles_.begin()) {
activeProfile_ = availableProfiles_.end();
}
activeProfile_--;
}
using VarStr = Glib::Variant<Glib::ustring>;

View File

@ -156,7 +156,7 @@ void Workspaces::onCmd(const struct Ipc::ipc_response &res) {
if (output.asString() == bar_.output->name) {
Json::Value v;
v["name"] = p_w_name;
v["output"] = bar_.output->name;
v["target_output"] = bar_.output->name;
v["num"] = convertWorkspaceNameToNum(p_w_name);
workspaces_.emplace_back(std::move(v));
break;
@ -166,7 +166,7 @@ void Workspaces::onCmd(const struct Ipc::ipc_response &res) {
// Adding to all outputs
Json::Value v;
v["name"] = p_w_name;
v["output"] = "";
v["target_output"] = "";
v["num"] = convertWorkspaceNameToNum(p_w_name);
workspaces_.emplace_back(std::move(v));
}
@ -261,6 +261,10 @@ bool Workspaces::hasFlag(const Json::Value &node, const std::string &flag) {
[&](auto const &e) { return hasFlag(e, flag); })) {
return true;
}
if (std::any_of(node["floating_nodes"].begin(), node["floating_nodes"].end(),
[&](auto const &e) { return hasFlag(e, flag); })) {
return true;
}
return false;
}
@ -313,7 +317,7 @@ auto Workspaces::update() -> void {
} else {
button.get_style_context()->remove_class("urgent");
}
if (hasFlag((*it), "target_output")) {
if ((*it)["target_output"].isString()) {
button.get_style_context()->add_class("persistent");
} else {
button.get_style_context()->remove_class("persistent");

View File

@ -334,9 +334,7 @@ Task::Task(const waybar::Bar &bar, const Json::Value &config, Taskbar *tbar,
}
button.add_events(Gdk::BUTTON_PRESS_MASK);
button.signal_button_press_event().connect(sigc::mem_fun(*this, &Task::handle_clicked), false);
button.signal_button_release_event().connect(sigc::mem_fun(*this, &Task::handle_button_release),
false);
button.signal_button_release_event().connect(sigc::mem_fun(*this, &Task::handle_clicked), false);
button.signal_motion_notify_event().connect(sigc::mem_fun(*this, &Task::handle_motion_notify),
false);
@ -573,12 +571,8 @@ bool Task::handle_clicked(GdkEventButton *bt) {
else
spdlog::warn("Unknown action {}", action);
return true;
}
bool Task::handle_button_release(GdkEventButton *bt) {
drag_start_button = -1;
return false;
return true;
}
bool Task::handle_motion_notify(GdkEventMotion *mn) {