libcava bump 0.10.1 + GTK4 migration

Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
pull/2956/head
Viktar Lukashonak 2024-02-26 22:18:29 +03:00
parent cc945ece3e
commit 0721fd593c
No known key found for this signature in database
GPG Key ID: 08A413AA87200A6F
5 changed files with 33 additions and 13 deletions

View File

@ -162,6 +162,22 @@ else
man_files += files('man/waybar-clock.5.scd') man_files += files('man/waybar-clock.5.scd')
endif endif
if get_option('experimental')
add_project_arguments('-DUSE_EXPERIMENTAL', language: 'cpp')
endif
cava = dependency('cava',
version : '>=0.10.1',
required: get_option('cava'),
fallback : ['cava', 'cava_dep'],
not_found_message: 'cava is not found. Building waybar without cava')
if cava.found()
add_project_arguments('-DHAVE_LIBCAVA', language: 'cpp')
src_files += files('src/modules/cava.cpp')
man_files += files('man/waybar-cava.5.scd')
endif
inc_dirs = ['include'] inc_dirs = ['include']
subdir('protocol') subdir('protocol')
@ -177,7 +193,8 @@ executable(
wayland_client, wayland_client,
wayland_cursor, wayland_cursor,
client_protos, client_protos,
spdlog spdlog,
cava
], ],
include_directories: inc_dirs, include_directories: inc_dirs,
install: true, install: true,

View File

@ -299,12 +299,12 @@ gtk4 todo
if (ref == "wireplumber") { if (ref == "wireplumber") {
return new waybar::modules::Wireplumber(id, config_[name]); return new waybar::modules::Wireplumber(id, config_[name]);
} }
#endif #endif*/
#ifdef HAVE_LIBCAVA #ifdef HAVE_LIBCAVA
if (ref == "cava") { if (ref == "cava") {
return new waybar::modules::Cava(id, config_[name]); return new waybar::modules::Cava(id, config_[name]);
} }
#endif #endif/*
#ifdef HAVE_SYSTEMD_MONITOR #ifdef HAVE_SYSTEMD_MONITOR
if (ref == "systemd-failed-units") { if (ref == "systemd-failed-units") {
return new waybar::modules::SystemdFailedUnits(id, config_[name]); return new waybar::modules::SystemdFailedUnits(id, config_[name]);

View File

@ -67,7 +67,10 @@ Group::Group(const std::string& name, const std::string& id, const Json::Value&
revealer.get_style_context()->add_class("drawer"); revealer.get_style_context()->add_class("drawer");
revealer.set_child(revealer_box); revealer.set_child(revealer_box);
box.prepend(revealer); if (left_to_right)
box.append(revealer);
else
box.prepend(revealer);
addHoverHandlerTo(revealer); addHoverHandlerTo(revealer);
} }

View File

@ -53,8 +53,8 @@ waybar::modules::Cava::Cava(const std::string& id, const Json::Value& config)
if (config_["method"].isString()) if (config_["method"].isString())
prm_.input = cava::input_method_by_name(config_["method"].asString().c_str()); prm_.input = cava::input_method_by_name(config_["method"].asString().c_str());
if (config_["source"].isString()) prm_.audio_source = config_["source"].asString().data(); if (config_["source"].isString()) prm_.audio_source = config_["source"].asString().data();
if (config_["sample_rate"].isNumeric()) prm_.fifoSample = config_["sample_rate"].asLargestInt(); if (config_["sample_rate"].isNumeric()) prm_.samplerate = config_["sample_rate"].asLargestInt();
if (config_["sample_bits"].isInt()) prm_.fifoSampleBits = config_["sample_bits"].asInt(); if (config_["sample_bits"].isInt()) prm_.samplebits = config_["sample_bits"].asInt();
if (config_["stereo"].isBool()) prm_.stereo = config_["stereo"].asBool(); if (config_["stereo"].isBool()) prm_.stereo = config_["stereo"].asBool();
if (config_["reverse"].isBool()) prm_.reverse = config_["reverse"].asBool(); if (config_["reverse"].isBool()) prm_.reverse = config_["reverse"].asBool();
if (config_["bar_delimiter"].isInt()) prm_.bar_delim = config_["bar_delimiter"].asInt(); if (config_["bar_delimiter"].isInt()) prm_.bar_delim = config_["bar_delimiter"].asInt();
@ -175,13 +175,13 @@ auto waybar::modules::Cava::update() -> void {
if (prm_.bar_delim != 0) text_.push_back(prm_.bar_delim); if (prm_.bar_delim != 0) text_.push_back(prm_.bar_delim);
} }
label_.set_markup(text_); Gtk::Label::set_markup(text_);
label_.show(); Gtk::Label::show();
ALabel::update(); ALabel::update();
} }
} else { } else {
upThreadDelay(frame_time_milsec_, suspend_silence_delay_); upThreadDelay(frame_time_milsec_, suspend_silence_delay_);
if (hide_on_silence_) label_.hide(); if (hide_on_silence_) Gtk::Label::hide();
} }
} }

View File

@ -1,7 +1,7 @@
[wrap-file] [wrap-file]
directory = cava-0.9.1 directory = cava-0.10.1
source_url = https://github.com/LukashonakV/cava/archive/0.9.1.tar.gz source_url = https://github.com/LukashonakV/cava/archive/0.10.1.tar.gz
source_filename = cava-0.9.1.tar.gz source_filename = cava-0.10.1.tar.gz
source_hash = 4df540b7f4892f72e48772929a15bc9ad61e2bce7a084be2df01c72ca5c02333 source_hash = ae8c7339908d6febeac5ab8df4576c03c9fdbca6c8e8975daf9ce68b57038bb5
[provide] [provide]
cava = cava_dep cava = cava_dep