Merge pull request #3364 from khaneliman/persistent-rename
This commit is contained in:
commit
1c1089bade
|
@ -15,7 +15,7 @@ class AModule : public IModule {
|
||||||
|
|
||||||
virtual ~AModule();
|
virtual ~AModule();
|
||||||
auto update() -> void override;
|
auto update() -> void override;
|
||||||
virtual auto refresh(int) -> void {};
|
virtual auto refresh(int) -> void{};
|
||||||
operator Gtk::Widget &() override;
|
operator Gtk::Widget &() override;
|
||||||
auto doAction(const std::string &name) -> void override;
|
auto doAction(const std::string &name) -> void override;
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,8 @@ class Clock final : public ALabel {
|
||||||
day cldBaseDay_{0}; // calendar Cached day. Is used when today is changing(midnight)
|
day cldBaseDay_{0}; // calendar Cached day. Is used when today is changing(midnight)
|
||||||
std::string cldText_{""}; // calendar text to print
|
std::string cldText_{""}; // calendar text to print
|
||||||
CldMode cldMode_{CldMode::MONTH};
|
CldMode cldMode_{CldMode::MONTH};
|
||||||
auto get_calendar(const year_month_day& today, const year_month_day& ymd,
|
auto get_calendar(const year_month_day& today, const year_month_day& ymd, const time_zone* tz)
|
||||||
const time_zone* tz) -> const std::string;
|
-> const std::string;
|
||||||
|
|
||||||
// get local time zone
|
// get local time zone
|
||||||
auto local_zone() -> const time_zone*;
|
auto local_zone() -> const time_zone*;
|
||||||
|
|
|
@ -66,7 +66,6 @@ class Workspaces : public AModule, public EventHandler {
|
||||||
auto populateBoolConfig(const Json::Value& config, const std::string& key, bool& member) -> void;
|
auto populateBoolConfig(const Json::Value& config, const std::string& key, bool& member) -> void;
|
||||||
auto populateSortByConfig(const Json::Value& config) -> void;
|
auto populateSortByConfig(const Json::Value& config) -> void;
|
||||||
auto populateIgnoreWorkspacesConfig(const Json::Value& config) -> void;
|
auto populateIgnoreWorkspacesConfig(const Json::Value& config) -> void;
|
||||||
auto populatePersistentWorkspacesConfig(const Json::Value& config) -> void;
|
|
||||||
auto populateFormatWindowSeparatorConfig(const Json::Value& config) -> void;
|
auto populateFormatWindowSeparatorConfig(const Json::Value& config) -> void;
|
||||||
auto populateWindowRewriteConfig(const Json::Value& config) -> void;
|
auto populateWindowRewriteConfig(const Json::Value& config) -> void;
|
||||||
|
|
||||||
|
|
|
@ -622,8 +622,8 @@ inline auto convertInto(std::string const &source, bool &target) -> ParserResult
|
||||||
}
|
}
|
||||||
#ifdef CLARA_CONFIG_OPTIONAL_TYPE
|
#ifdef CLARA_CONFIG_OPTIONAL_TYPE
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline auto convertInto(std::string const &source,
|
inline auto convertInto(std::string const &source, CLARA_CONFIG_OPTIONAL_TYPE<T> &target)
|
||||||
CLARA_CONFIG_OPTIONAL_TYPE<T> &target) -> ParserResult {
|
-> ParserResult {
|
||||||
T temp;
|
T temp;
|
||||||
auto result = convertInto(source, temp);
|
auto result = convertInto(source, temp);
|
||||||
if (result) target = std::move(temp);
|
if (result) target = std::move(temp);
|
||||||
|
@ -751,8 +751,8 @@ class ParserBase {
|
||||||
public:
|
public:
|
||||||
virtual ~ParserBase() = default;
|
virtual ~ParserBase() = default;
|
||||||
virtual auto validate() const -> Result { return Result::ok(); }
|
virtual auto validate() const -> Result { return Result::ok(); }
|
||||||
virtual auto parse(std::string const &exeName,
|
virtual auto parse(std::string const &exeName, TokenStream const &tokens) const
|
||||||
TokenStream const &tokens) const -> InternalParseResult = 0;
|
-> InternalParseResult = 0;
|
||||||
virtual auto cardinality() const -> size_t { return 1; }
|
virtual auto cardinality() const -> size_t { return 1; }
|
||||||
|
|
||||||
auto parse(Args const &args) const -> InternalParseResult {
|
auto parse(Args const &args) const -> InternalParseResult {
|
||||||
|
@ -1098,8 +1098,8 @@ struct Parser : ParserBase {
|
||||||
|
|
||||||
using ParserBase::parse;
|
using ParserBase::parse;
|
||||||
|
|
||||||
auto parse(std::string const &exeName,
|
auto parse(std::string const &exeName, TokenStream const &tokens) const
|
||||||
TokenStream const &tokens) const -> InternalParseResult override {
|
-> InternalParseResult override {
|
||||||
struct ParserInfo {
|
struct ParserInfo {
|
||||||
ParserBase const *parser = nullptr;
|
ParserBase const *parser = nullptr;
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
class pow_format {
|
class pow_format {
|
||||||
public:
|
public:
|
||||||
pow_format(long long val, std::string&& unit, bool binary = false)
|
pow_format(long long val, std::string&& unit, bool binary = false)
|
||||||
: val_(val), unit_(unit), binary_(binary) {};
|
: val_(val), unit_(unit), binary_(binary){};
|
||||||
|
|
||||||
long long val_;
|
long long val_;
|
||||||
std::string unit_;
|
std::string unit_;
|
||||||
|
|
|
@ -49,8 +49,8 @@ auto getBoolProperty(GDBusProxy* proxy, const char* property_name) -> bool {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto getOptionalStringProperty(GDBusProxy* proxy,
|
auto getOptionalStringProperty(GDBusProxy* proxy, const char* property_name)
|
||||||
const char* property_name) -> std::optional<std::string> {
|
-> std::optional<std::string> {
|
||||||
auto gvar = g_dbus_proxy_get_cached_property(proxy, property_name);
|
auto gvar = g_dbus_proxy_get_cached_property(proxy, property_name);
|
||||||
if (gvar) {
|
if (gvar) {
|
||||||
std::string property_value = g_variant_get_string(gvar, NULL);
|
std::string property_value = g_variant_get_string(gvar, NULL);
|
||||||
|
@ -115,8 +115,7 @@ waybar::modules::Bluetooth::Bluetooth(const std::string& id, const Json::Value&
|
||||||
g_signal_connect(manager_.get(), "object-removed", G_CALLBACK(onObjectRemoved), this);
|
g_signal_connect(manager_.get(), "object-removed", G_CALLBACK(onObjectRemoved), this);
|
||||||
g_signal_connect(manager_.get(), "interface-proxy-properties-changed",
|
g_signal_connect(manager_.get(), "interface-proxy-properties-changed",
|
||||||
G_CALLBACK(onInterfaceProxyPropertiesChanged), this);
|
G_CALLBACK(onInterfaceProxyPropertiesChanged), this);
|
||||||
g_signal_connect(manager_.get(), "interface-added", G_CALLBACK(onInterfaceAddedOrRemoved),
|
g_signal_connect(manager_.get(), "interface-added", G_CALLBACK(onInterfaceAddedOrRemoved), this);
|
||||||
this);
|
|
||||||
g_signal_connect(manager_.get(), "interface-removed", G_CALLBACK(onInterfaceAddedOrRemoved),
|
g_signal_connect(manager_.get(), "interface-removed", G_CALLBACK(onInterfaceAddedOrRemoved),
|
||||||
this);
|
this);
|
||||||
|
|
||||||
|
@ -283,14 +282,12 @@ auto waybar::modules::Bluetooth::update() -> void {
|
||||||
ALabel::update();
|
ALabel::update();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto waybar::modules::Bluetooth::onObjectAdded(GDBusObjectManager* manager,
|
auto waybar::modules::Bluetooth::onObjectAdded(GDBusObjectManager* manager, GDBusObject* object,
|
||||||
GDBusObject* object,
|
|
||||||
gpointer user_data) -> void {
|
gpointer user_data) -> void {
|
||||||
ControllerInfo info;
|
ControllerInfo info;
|
||||||
Bluetooth* bt = static_cast<Bluetooth*>(user_data);
|
Bluetooth* bt = static_cast<Bluetooth*>(user_data);
|
||||||
|
|
||||||
if (!bt->cur_controller_.has_value() &&
|
if (!bt->cur_controller_.has_value() && bt->getControllerProperties(object, info) &&
|
||||||
bt->getControllerProperties(object, info) &&
|
|
||||||
(!bt->config_["controller-alias"].isString() ||
|
(!bt->config_["controller-alias"].isString() ||
|
||||||
bt->config_["controller-alias"].asString() == info.alias)) {
|
bt->config_["controller-alias"].asString() == info.alias)) {
|
||||||
bt->cur_controller_ = std::move(info);
|
bt->cur_controller_ = std::move(info);
|
||||||
|
@ -298,8 +295,7 @@ auto waybar::modules::Bluetooth::onObjectAdded(GDBusObjectManager* manager,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto waybar::modules::Bluetooth::onObjectRemoved(GDBusObjectManager* manager,
|
auto waybar::modules::Bluetooth::onObjectRemoved(GDBusObjectManager* manager, GDBusObject* object,
|
||||||
GDBusObject* object,
|
|
||||||
gpointer user_data) -> void {
|
gpointer user_data) -> void {
|
||||||
Bluetooth* bt = static_cast<Bluetooth*>(user_data);
|
Bluetooth* bt = static_cast<Bluetooth*>(user_data);
|
||||||
GDBusProxy* proxy_controller;
|
GDBusProxy* proxy_controller;
|
||||||
|
@ -311,7 +307,6 @@ auto waybar::modules::Bluetooth::onObjectRemoved(GDBusObjectManager* manager,
|
||||||
proxy_controller = G_DBUS_PROXY(g_dbus_object_get_interface(object, "org.bluez.Adapter1"));
|
proxy_controller = G_DBUS_PROXY(g_dbus_object_get_interface(object, "org.bluez.Adapter1"));
|
||||||
|
|
||||||
if (proxy_controller != NULL) {
|
if (proxy_controller != NULL) {
|
||||||
|
|
||||||
std::string object_path = g_dbus_object_get_object_path(object);
|
std::string object_path = g_dbus_object_get_object_path(object);
|
||||||
|
|
||||||
if (object_path == bt->cur_controller_->path) {
|
if (object_path == bt->cur_controller_->path) {
|
||||||
|
@ -350,8 +345,8 @@ auto waybar::modules::Bluetooth::onInterfaceAddedOrRemoved(GDBusObjectManager* m
|
||||||
|
|
||||||
auto waybar::modules::Bluetooth::onInterfaceProxyPropertiesChanged(
|
auto waybar::modules::Bluetooth::onInterfaceProxyPropertiesChanged(
|
||||||
GDBusObjectManagerClient* manager, GDBusObjectProxy* object_proxy, GDBusProxy* interface_proxy,
|
GDBusObjectManagerClient* manager, GDBusObjectProxy* object_proxy, GDBusProxy* interface_proxy,
|
||||||
GVariant* changed_properties, const gchar* const* invalidated_properties,
|
GVariant* changed_properties, const gchar* const* invalidated_properties, gpointer user_data)
|
||||||
gpointer user_data) -> void {
|
-> void {
|
||||||
std::string interface_name = g_dbus_proxy_get_interface_name(interface_proxy);
|
std::string interface_name = g_dbus_proxy_get_interface_name(interface_proxy);
|
||||||
std::string object_path = g_dbus_object_get_object_path(G_DBUS_OBJECT(object_proxy));
|
std::string object_path = g_dbus_object_get_object_path(G_DBUS_OBJECT(object_proxy));
|
||||||
|
|
||||||
|
@ -400,8 +395,8 @@ auto waybar::modules::Bluetooth::getDeviceBatteryPercentage(GDBusObject* object)
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto waybar::modules::Bluetooth::getDeviceProperties(GDBusObject* object,
|
auto waybar::modules::Bluetooth::getDeviceProperties(GDBusObject* object, DeviceInfo& device_info)
|
||||||
DeviceInfo& device_info) -> bool {
|
-> bool {
|
||||||
GDBusProxy* proxy_device = G_DBUS_PROXY(g_dbus_object_get_interface(object, "org.bluez.Device1"));
|
GDBusProxy* proxy_device = G_DBUS_PROXY(g_dbus_object_get_interface(object, "org.bluez.Device1"));
|
||||||
|
|
||||||
if (proxy_device != NULL) {
|
if (proxy_device != NULL) {
|
||||||
|
@ -467,8 +462,9 @@ auto waybar::modules::Bluetooth::findCurController() -> std::optional<Controller
|
||||||
return controller_info;
|
return controller_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto waybar::modules::Bluetooth::findConnectedDevices(
|
auto waybar::modules::Bluetooth::findConnectedDevices(const std::string& cur_controller_path,
|
||||||
const std::string& cur_controller_path, std::vector<DeviceInfo>& connected_devices) -> void {
|
std::vector<DeviceInfo>& connected_devices)
|
||||||
|
-> void {
|
||||||
GList* objects = g_dbus_object_manager_get_objects(manager_.get());
|
GList* objects = g_dbus_object_manager_get_objects(manager_.get());
|
||||||
for (GList* l = objects; l != NULL; l = l->next) {
|
for (GList* l = objects; l != NULL; l = l->next) {
|
||||||
GDBusObject* object = G_DBUS_OBJECT(l->data);
|
GDBusObject* object = G_DBUS_OBJECT(l->data);
|
||||||
|
|
|
@ -197,8 +197,8 @@ const unsigned cldRowsInMonth(const year_month& ym, const weekday& firstdow) {
|
||||||
return 2u + ceil<weeks>((weekday{ym / 1} - firstdow) + ((ym / last).day() - day{0})).count();
|
return 2u + ceil<weeks>((weekday{ym / 1} - firstdow) + ((ym / last).day() - day{0})).count();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto cldGetWeekForLine(const year_month& ym, const weekday& firstdow,
|
auto cldGetWeekForLine(const year_month& ym, const weekday& firstdow, const unsigned line)
|
||||||
const unsigned line) -> const year_month_weekday {
|
-> const year_month_weekday {
|
||||||
unsigned index{line - 2};
|
unsigned index{line - 2};
|
||||||
if (weekday{ym / 1} == firstdow) ++index;
|
if (weekday{ym / 1} == firstdow) ++index;
|
||||||
return ym / firstdow[index];
|
return ym / firstdow[index];
|
||||||
|
|
|
@ -16,7 +16,8 @@ std::vector<std::tuple<size_t, size_t>> waybar::modules::CpuUsage::parseCpuinfo(
|
||||||
}
|
}
|
||||||
std::stringstream sline(line.substr(5));
|
std::stringstream sline(line.substr(5));
|
||||||
std::vector<size_t> times;
|
std::vector<size_t> times;
|
||||||
for (size_t time = 0; sline >> time; times.push_back(time));
|
for (size_t time = 0; sline >> time; times.push_back(time))
|
||||||
|
;
|
||||||
|
|
||||||
size_t idle_time = 0;
|
size_t idle_time = 0;
|
||||||
size_t total_time = 0;
|
size_t total_time = 0;
|
||||||
|
|
|
@ -53,7 +53,7 @@ static void set_layout(void *data, zdwl_ipc_output_v2 *zdwl_output_v2, uint32_t
|
||||||
// Intentionally empty
|
// Intentionally empty
|
||||||
}
|
}
|
||||||
|
|
||||||
static void appid(void *data, zdwl_ipc_output_v2 *zdwl_output_v2, const char *appid) {
|
static void appid(void *data, zdwl_ipc_output_v2 *zdwl_output_v2, const char *appid){
|
||||||
// Intentionally empty
|
// Intentionally empty
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ std::filesystem::path IPC::socketFolder_;
|
||||||
std::filesystem::path IPC::getSocketFolder(const char* instanceSig) {
|
std::filesystem::path IPC::getSocketFolder(const char* instanceSig) {
|
||||||
// socket path, specified by EventManager of Hyprland
|
// socket path, specified by EventManager of Hyprland
|
||||||
if (!socketFolder_.empty()) {
|
if (!socketFolder_.empty()) {
|
||||||
spdlog::warn("socketFolder already set, using {}", socketFolder_.c_str());
|
|
||||||
return socketFolder_;
|
return socketFolder_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -577,9 +577,9 @@ auto Workspaces::parseConfig(const Json::Value &config) -> void {
|
||||||
populateBoolConfig(config, "active-only", m_activeOnly);
|
populateBoolConfig(config, "active-only", m_activeOnly);
|
||||||
populateBoolConfig(config, "move-to-monitor", m_moveToMonitor);
|
populateBoolConfig(config, "move-to-monitor", m_moveToMonitor);
|
||||||
|
|
||||||
|
m_persistentWorkspaceConfig = config.get("persistent-workspaces", Json::Value());
|
||||||
populateSortByConfig(config);
|
populateSortByConfig(config);
|
||||||
populateIgnoreWorkspacesConfig(config);
|
populateIgnoreWorkspacesConfig(config);
|
||||||
populatePersistentWorkspacesConfig(config);
|
|
||||||
populateFormatWindowSeparatorConfig(config);
|
populateFormatWindowSeparatorConfig(config);
|
||||||
populateWindowRewriteConfig(config);
|
populateWindowRewriteConfig(config);
|
||||||
}
|
}
|
||||||
|
@ -591,8 +591,8 @@ auto Workspaces::populateIconsMap(const Json::Value &formatIcons) -> void {
|
||||||
m_iconsMap.emplace("", "");
|
m_iconsMap.emplace("", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
auto Workspaces::populateBoolConfig(const Json::Value &config, const std::string &key,
|
auto Workspaces::populateBoolConfig(const Json::Value &config, const std::string &key, bool &member)
|
||||||
bool &member) -> void {
|
-> void {
|
||||||
auto configValue = config[key];
|
auto configValue = config[key];
|
||||||
if (configValue.isBool()) {
|
if (configValue.isBool()) {
|
||||||
member = configValue.asBool();
|
member = configValue.asBool();
|
||||||
|
@ -632,15 +632,6 @@ auto Workspaces::populateIgnoreWorkspacesConfig(const Json::Value &config) -> vo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto Workspaces::populatePersistentWorkspacesConfig(const Json::Value &config) -> void {
|
|
||||||
if (config.isMember("persistent-workspaces") || config.isMember("persistent_workspaces")) {
|
|
||||||
spdlog::warn(
|
|
||||||
"persistent_workspaces is deprecated. Please change config to use persistent-workspaces.");
|
|
||||||
m_persistentWorkspaceConfig =
|
|
||||||
config.get("persistent-workspaces", config.get("persistent_workspaces", Json::Value()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
auto Workspaces::populateFormatWindowSeparatorConfig(const Json::Value &config) -> void {
|
auto Workspaces::populateFormatWindowSeparatorConfig(const Json::Value &config) -> void {
|
||||||
auto formatWindowSeparator = config["format-window-separator"];
|
auto formatWindowSeparator = config["format-window-separator"];
|
||||||
m_formatWindowSeparator =
|
m_formatWindowSeparator =
|
||||||
|
|
|
@ -118,8 +118,8 @@ auto WorkspaceManager::sort_workspaces() -> void {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto WorkspaceManager::register_manager(wl_registry *registry, uint32_t name,
|
auto WorkspaceManager::register_manager(wl_registry *registry, uint32_t name, uint32_t version)
|
||||||
uint32_t version) -> void {
|
-> void {
|
||||||
if (workspace_manager_) {
|
if (workspace_manager_) {
|
||||||
spdlog::warn("Register workspace manager again although already registered!");
|
spdlog::warn("Register workspace manager again although already registered!");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -71,7 +71,7 @@ struct TestObject {
|
||||||
unsigned copied = 0;
|
unsigned copied = 0;
|
||||||
unsigned moved = 0;
|
unsigned moved = 0;
|
||||||
|
|
||||||
TestObject(const T& v) : value(v) {};
|
TestObject(const T& v) : value(v){};
|
||||||
~TestObject() = default;
|
~TestObject() = default;
|
||||||
|
|
||||||
TestObject(const TestObject& other)
|
TestObject(const TestObject& other)
|
||||||
|
|
Loading…
Reference in New Issue