fix: lint
This commit is contained in:
@ -14,16 +14,16 @@
|
|||||||
|
|
||||||
namespace waybar::modules {
|
namespace waybar::modules {
|
||||||
|
|
||||||
class Gps : public ALabel {
|
class Gps : public ALabel {
|
||||||
public:
|
public:
|
||||||
Gps(const std::string&, const Json::Value&);
|
Gps(const std::string&, const Json::Value&);
|
||||||
virtual ~Gps();
|
virtual ~Gps();
|
||||||
auto update() -> void override;
|
auto update() -> void override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef WANT_RFKILL
|
#ifdef WANT_RFKILL
|
||||||
util::Rfkill rfkill_;
|
util::Rfkill rfkill_;
|
||||||
#endif
|
#endif
|
||||||
const std::string getFixModeName() const;
|
const std::string getFixModeName() const;
|
||||||
const std::string getFixModeString() const;
|
const std::string getFixModeString() const;
|
||||||
|
|
||||||
@ -35,6 +35,6 @@ namespace waybar::modules {
|
|||||||
|
|
||||||
bool hideDisconnected = true;
|
bool hideDisconnected = true;
|
||||||
bool hideNoFix = false;
|
bool hideNoFix = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace waybar::modules
|
} // namespace waybar::modules
|
||||||
|
@ -35,7 +35,7 @@ waybar::modules::Custom::~Custom() {
|
|||||||
|
|
||||||
void waybar::modules::Custom::delayWorker() {
|
void waybar::modules::Custom::delayWorker() {
|
||||||
thread_ = [this] {
|
thread_ = [this] {
|
||||||
for (int i: this->pid_children_) {
|
for (int i : this->pid_children_) {
|
||||||
int status;
|
int status;
|
||||||
waitpid(i, &status, 0);
|
waitpid(i, &status, 0);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "modules/gps.hpp"
|
#include "modules/gps.hpp"
|
||||||
|
|
||||||
#include <gps.h>
|
#include <gps.h>
|
||||||
#include <spdlog/spdlog.h>
|
#include <spdlog/spdlog.h>
|
||||||
|
|
||||||
@ -15,15 +16,15 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
using namespace waybar::util;
|
using namespace waybar::util;
|
||||||
constexpr const char *DEFAULT_FORMAT = "{mode}";
|
constexpr const char* DEFAULT_FORMAT = "{mode}";
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
waybar::modules::Gps::Gps(const std::string& id, const Json::Value& config)
|
waybar::modules::Gps::Gps(const std::string& id, const Json::Value& config)
|
||||||
: ALabel(config, "gps", id, "{}", 5)
|
: ALabel(config, "gps", id, "{}", 5)
|
||||||
#ifdef WANT_RFKILL
|
#ifdef WANT_RFKILL
|
||||||
,rfkill_{RFKILL_TYPE_GPS}
|
,
|
||||||
|
rfkill_{RFKILL_TYPE_GPS}
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
thread_ = [this] {
|
thread_ = [this] {
|
||||||
@ -66,9 +67,9 @@ waybar::modules::Gps::Gps(const std::string& id, const Json::Value& config)
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef WANT_RFKILL
|
#ifdef WANT_RFKILL
|
||||||
rfkill_.on_update.connect(sigc::hide(sigc::mem_fun(*this, &Gps::update)));
|
rfkill_.on_update.connect(sigc::hide(sigc::mem_fun(*this, &Gps::update)));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string waybar::modules::Gps::getFixModeName() const {
|
const std::string waybar::modules::Gps::getFixModeName() const {
|
||||||
@ -80,9 +81,9 @@ const std::string waybar::modules::Gps::getFixModeName() const {
|
|||||||
case MODE_3D:
|
case MODE_3D:
|
||||||
return "fix-3d";
|
return "fix-3d";
|
||||||
default:
|
default:
|
||||||
#ifdef WANT_RFKILL
|
#ifdef WANT_RFKILL
|
||||||
if (rfkill_.getState()) return "disabled";
|
if (rfkill_.getState()) return "disabled";
|
||||||
#endif
|
#endif
|
||||||
return "disconnected";
|
return "disconnected";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,9 +121,9 @@ const std::string waybar::modules::Gps::getFixStatusString() const {
|
|||||||
return "PPS Fix";
|
return "PPS Fix";
|
||||||
default:
|
default:
|
||||||
|
|
||||||
#ifdef WANT_RFKILL
|
#ifdef WANT_RFKILL
|
||||||
if (rfkill_.getState()) return "Disabled";
|
if (rfkill_.getState()) return "Disabled";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
@ -131,7 +132,8 @@ const std::string waybar::modules::Gps::getFixStatusString() const {
|
|||||||
auto waybar::modules::Gps::update() -> void {
|
auto waybar::modules::Gps::update() -> void {
|
||||||
sleep(0); // Wait for gps status change
|
sleep(0); // Wait for gps status change
|
||||||
|
|
||||||
if ((gps_data_.fix.mode == MODE_NOT_SEEN && hideDisconnected) || (gps_data_.fix.mode == MODE_NO_FIX && hideNoFix)) {
|
if ((gps_data_.fix.mode == MODE_NOT_SEEN && hideDisconnected) ||
|
||||||
|
(gps_data_.fix.mode == MODE_NO_FIX && hideNoFix)) {
|
||||||
event_box_.set_visible(false);
|
event_box_.set_visible(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -163,7 +165,6 @@ auto waybar::modules::Gps::update() -> void {
|
|||||||
state_ = state;
|
state_ = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
auto format = format_;
|
auto format = format_;
|
||||||
|
|
||||||
fmt::dynamic_format_arg_store<fmt::format_context> store;
|
fmt::dynamic_format_arg_store<fmt::format_context> store;
|
||||||
@ -205,13 +206,11 @@ auto waybar::modules::Gps::update() -> void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
label_.set_markup(text);
|
label_.set_markup(text);
|
||||||
// Call parent update
|
// Call parent update
|
||||||
ALabel::update();
|
ALabel::update();
|
||||||
}
|
}
|
||||||
|
|
||||||
waybar::modules::Gps::~Gps() {
|
waybar::modules::Gps::~Gps() {
|
||||||
gps_stream(&gps_data_, WATCH_DISABLE, NULL);
|
gps_stream(&gps_data_, WATCH_DISABLE, NULL);
|
||||||
gps_close(&gps_data_);
|
gps_close(&gps_data_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,7 +68,8 @@ void Language::onEvent(const std::string& ev) {
|
|||||||
std::string kbName(begin(ev) + ev.find_last_of('>') + 1, begin(ev) + ev.find_first_of(','));
|
std::string kbName(begin(ev) + ev.find_last_of('>') + 1, begin(ev) + ev.find_first_of(','));
|
||||||
|
|
||||||
// Last comma before variants parenthesis, eg:
|
// Last comma before variants parenthesis, eg:
|
||||||
// activelayout>>micro-star-int'l-co.,-ltd.-msi-gk50-elite-gaming-keyboard,English (US, intl., with dead keys)
|
// activelayout>>micro-star-int'l-co.,-ltd.-msi-gk50-elite-gaming-keyboard,English (US, intl.,
|
||||||
|
// with dead keys)
|
||||||
std::string beforParenthesis(begin(ev), begin(ev) + ev.find_last_of('('));
|
std::string beforParenthesis(begin(ev), begin(ev) + ev.find_last_of('('));
|
||||||
auto layoutName = ev.substr(beforParenthesis.find_last_of(',') + 1);
|
auto layoutName = ev.substr(beforParenthesis.find_last_of(',') + 1);
|
||||||
|
|
||||||
|
@ -791,25 +791,21 @@ void Workspaces::sortSpecialCentered() {
|
|||||||
|
|
||||||
size_t center = normalWorkspaces.size() / 2;
|
size_t center = normalWorkspaces.size() / 2;
|
||||||
|
|
||||||
m_workspaces.insert(m_workspaces.end(),
|
m_workspaces.insert(m_workspaces.end(), std::make_move_iterator(normalWorkspaces.begin()),
|
||||||
std::make_move_iterator(normalWorkspaces.begin()),
|
|
||||||
std::make_move_iterator(normalWorkspaces.begin() + center));
|
std::make_move_iterator(normalWorkspaces.begin() + center));
|
||||||
|
|
||||||
m_workspaces.insert(m_workspaces.end(),
|
m_workspaces.insert(m_workspaces.end(), std::make_move_iterator(specialWorkspaces.begin()),
|
||||||
std::make_move_iterator(specialWorkspaces.begin()),
|
|
||||||
std::make_move_iterator(specialWorkspaces.end()));
|
std::make_move_iterator(specialWorkspaces.end()));
|
||||||
|
|
||||||
m_workspaces.insert(m_workspaces.end(),
|
m_workspaces.insert(m_workspaces.end(),
|
||||||
std::make_move_iterator(normalWorkspaces.begin() + center),
|
std::make_move_iterator(normalWorkspaces.begin() + center),
|
||||||
std::make_move_iterator(normalWorkspaces.end()));
|
std::make_move_iterator(normalWorkspaces.end()));
|
||||||
|
|
||||||
m_workspaces.insert(m_workspaces.end(),
|
m_workspaces.insert(m_workspaces.end(), std::make_move_iterator(hiddenWorkspaces.begin()),
|
||||||
std::make_move_iterator(hiddenWorkspaces.begin()),
|
|
||||||
std::make_move_iterator(hiddenWorkspaces.end()));
|
std::make_move_iterator(hiddenWorkspaces.end()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Workspaces::sortWorkspaces() {
|
void Workspaces::sortWorkspaces() {
|
||||||
|
|
||||||
std::ranges::sort( //
|
std::ranges::sort( //
|
||||||
m_workspaces, [&](std::unique_ptr<Workspace> &a, std::unique_ptr<Workspace> &b) {
|
m_workspaces, [&](std::unique_ptr<Workspace> &a, std::unique_ptr<Workspace> &b) {
|
||||||
// Helper comparisons
|
// Helper comparisons
|
||||||
|
@ -172,7 +172,6 @@ std::string Workspaces::getIcon(const std::string &value, const Json::Value &ws)
|
|||||||
const auto &icons = config_["format-icons"];
|
const auto &icons = config_["format-icons"];
|
||||||
if (!icons) return value;
|
if (!icons) return value;
|
||||||
|
|
||||||
|
|
||||||
if (ws["is_urgent"].asBool() && icons["urgent"]) return icons["urgent"].asString();
|
if (ws["is_urgent"].asBool() && icons["urgent"]) return icons["urgent"].asString();
|
||||||
|
|
||||||
if (ws["active_window_id"].isNull() && icons["empty"]) return icons["empty"].asString();
|
if (ws["active_window_id"].isNull() && icons["empty"]) return icons["empty"].asString();
|
||||||
|
Reference in New Issue
Block a user