Merge branch 'Alexays:master' into hyprland/windowcount

This commit is contained in:
Khiet Tam Nguyen
2024-11-30 19:37:29 +11:00
committed by GitHub
52 changed files with 281 additions and 12 deletions

View File

@ -15,6 +15,7 @@ AModule::AModule(const Json::Value& config, const std::string& name, const std::
: name_(name),
config_(config),
isTooltip{config_["tooltip"].isBool() ? config_["tooltip"].asBool() : true},
isExpand{config_["expand"].isBool() ? config_["expand"].asBool() : false},
distance_scrolled_y_(0.0),
distance_scrolled_x_(0.0) {
// Configure module action Map
@ -273,6 +274,7 @@ bool AModule::handleScroll(GdkEventScroll* e) {
}
bool AModule::tooltipEnabled() const { return isTooltip; }
bool AModule::expandEnabled() const { return isExpand; }
AModule::operator Gtk::Widget&() { return event_box_; }

View File

@ -534,13 +534,22 @@ void waybar::Bar::getModules(const Factory& factory, const std::string& pos,
auto waybar::Bar::setupWidgets() -> void {
window.add(box_);
box_.pack_start(left_, false, false);
if (config["fixed-center"].isBool() ? config["fixed-center"].asBool() : true) {
box_.set_center_widget(center_);
} else {
box_.pack_start(center_, true, false);
bool expand_left = config["expand-left"].isBool() ? config["expand-left"].asBool() : false;
bool expand_center = config["expand-center"].isBool() ? config["expand-center"].asBool() : false;
bool expand_right = config["expand-right"].isBool() ? config["expand-right"].asBool() : false;
bool no_center = config["no-center"].isBool() ? config["no-center"].asBool() : false;
box_.pack_start(left_, expand_left, expand_left);
if (!no_center) {
if (config["fixed-center"].isBool() ? config["fixed-center"].asBool() : true) {
box_.set_center_widget(center_);
} else {
spdlog::error("No fixed center_");
box_.pack_start(center_, true, expand_center);
}
}
box_.pack_end(right_, false, false);
box_.pack_end(right_, expand_right, expand_right);
// Convert to button code for every module that is used.
setupAltFormatKeyForModuleList("modules-left");
@ -549,14 +558,21 @@ auto waybar::Bar::setupWidgets() -> void {
Factory factory(*this, config);
getModules(factory, "modules-left");
getModules(factory, "modules-center");
if (!no_center) {
getModules(factory, "modules-center");
}
getModules(factory, "modules-right");
for (auto const& module : modules_left_) {
left_.pack_start(*module, false, false);
left_.pack_start(*module, module->expandEnabled(), module->expandEnabled());
}
for (auto const& module : modules_center_) {
center_.pack_start(*module, false, false);
if (!no_center) {
for (auto const& module : modules_center_) {
center_.pack_start(*module, false, false);
}
}
std::reverse(modules_right_.begin(), modules_right_.end());
for (auto const& module : modules_right_) {
right_.pack_end(*module, false, false);

View File

@ -109,7 +109,7 @@ int main(int argc, char* argv[]) {
std::signal(SIGUSR1, SIG_IGN);
std::signal(SIGUSR2, SIG_IGN);
std::signal(SIGINT, SIG_IGN);
std::signal(SIGINT, SIG_IGN);
delete client;
return ret;

View File

@ -77,7 +77,7 @@ auto waybar::modules::Temperature::update() -> void {
} else if (warning) {
format = config_["format-warning"].isString() ? config_["format-warning"].asString() : format;
label_.get_style_context()->add_class("warning");
} else {
} else {
label_.get_style_context()->remove_class("critical");
label_.get_style_context()->remove_class("warning");
}

View File

@ -126,6 +126,7 @@ void PipewireBackend::handleRegistryEventGlobal(uint32_t id, uint32_t permission
if (proxy == nullptr) return;
auto *pNodeInfo = (PrivacyNodeInfo *)pw_proxy_get_user_data(proxy);
new(pNodeInfo) PrivacyNodeInfo{};
pNodeInfo->id = id;
pNodeInfo->data = this;
pNodeInfo->type = mediaType;
@ -142,6 +143,7 @@ void PipewireBackend::handleRegistryEventGlobalRemove(uint32_t id) {
mutex_.lock();
auto iter = privacy_nodes.find(id);
if (iter != privacy_nodes.end()) {
privacy_nodes[id]->~PrivacyNodeInfo();
privacy_nodes.erase(id);
}
mutex_.unlock();