fix: lint
This commit is contained in:
@ -30,7 +30,9 @@ waybar::modules::Clock::Clock(const std::string& id, const Json::Value& config)
|
|||||||
cldMonShift_{year(1900) / January},
|
cldMonShift_{year(1900) / January},
|
||||||
tzInTooltip_{m_tlpFmt_.find("{" + kTZPlaceholder + "}") != std::string::npos},
|
tzInTooltip_{m_tlpFmt_.find("{" + kTZPlaceholder + "}") != std::string::npos},
|
||||||
tzCurrIdx_{0},
|
tzCurrIdx_{0},
|
||||||
tzTooltipFormat_{config_["timezone-tooltip-format"].isString() ? config_["timezone-tooltip-format"].asString() : ""},
|
tzTooltipFormat_{config_["timezone-tooltip-format"].isString()
|
||||||
|
? config_["timezone-tooltip-format"].asString()
|
||||||
|
: ""},
|
||||||
ordInTooltip_{m_tlpFmt_.find("{" + kOrdPlaceholder + "}") != std::string::npos} {
|
ordInTooltip_{m_tlpFmt_.find("{" + kOrdPlaceholder + "}") != std::string::npos} {
|
||||||
m_tlpText_ = m_tlpFmt_;
|
m_tlpText_ = m_tlpFmt_;
|
||||||
|
|
||||||
@ -200,19 +202,19 @@ auto waybar::modules::Clock::getTZtext(sys_seconds now) -> std::string {
|
|||||||
for (size_t tz_idx{0}; tz_idx < tzList_.size(); ++tz_idx) {
|
for (size_t tz_idx{0}; tz_idx < tzList_.size(); ++tz_idx) {
|
||||||
// Skip local timezone (nullptr) - never show it in tooltip
|
// Skip local timezone (nullptr) - never show it in tooltip
|
||||||
if (tzList_[tz_idx] == nullptr) continue;
|
if (tzList_[tz_idx] == nullptr) continue;
|
||||||
|
|
||||||
// Skip current timezone unless timezone-tooltip-format is specified
|
// Skip current timezone unless timezone-tooltip-format is specified
|
||||||
if (static_cast<int>(tz_idx) == tzCurrIdx_ && tzTooltipFormat_.empty()) continue;
|
if (static_cast<int>(tz_idx) == tzCurrIdx_ && tzTooltipFormat_.empty()) continue;
|
||||||
|
|
||||||
const auto* tz = tzList_[tz_idx];
|
const auto* tz = tzList_[tz_idx];
|
||||||
auto zt{zoned_time{tz, now}};
|
auto zt{zoned_time{tz, now}};
|
||||||
|
|
||||||
// Add newline before each entry except the first
|
// Add newline before each entry except the first
|
||||||
if (!first) {
|
if (!first) {
|
||||||
os << '\n';
|
os << '\n';
|
||||||
}
|
}
|
||||||
first = false;
|
first = false;
|
||||||
|
|
||||||
// Use timezone-tooltip-format if specified, otherwise use format_
|
// Use timezone-tooltip-format if specified, otherwise use format_
|
||||||
const std::string& fmt = tzTooltipFormat_.empty() ? format_ : tzTooltipFormat_;
|
const std::string& fmt = tzTooltipFormat_.empty() ? format_ : tzTooltipFormat_;
|
||||||
os << fmt_lib::vformat(m_locale_, fmt, fmt_lib::make_format_args(zt));
|
os << fmt_lib::vformat(m_locale_, fmt, fmt_lib::make_format_args(zt));
|
||||||
|
@ -92,7 +92,7 @@ void waybar::modules::Custom::continuousWorker() {
|
|||||||
if (config_["restart-interval"].isNumeric()) {
|
if (config_["restart-interval"].isNumeric()) {
|
||||||
pid_ = -1;
|
pid_ = -1;
|
||||||
thread_.sleep_for(std::chrono::milliseconds(
|
thread_.sleep_for(std::chrono::milliseconds(
|
||||||
std::max(1L, // Minimum 1ms due to millisecond precision
|
std::max(1L, // Minimum 1ms due to millisecond precision
|
||||||
static_cast<long>(config_["restart-interval"].asDouble() * 1000))));
|
static_cast<long>(config_["restart-interval"].asDouble() * 1000))));
|
||||||
fp_ = util::command::open(cmd, pid_, output_name_);
|
fp_ = util::command::open(cmd, pid_, output_name_);
|
||||||
if (!fp_) {
|
if (!fp_) {
|
||||||
|
@ -15,11 +15,12 @@ waybar::modules::Image::Image(const std::string& id, const Json::Value& config)
|
|||||||
size_ = config["size"].asInt();
|
size_ = config["size"].asInt();
|
||||||
|
|
||||||
interval_ = config_["interval"] == "once"
|
interval_ = config_["interval"] == "once"
|
||||||
? std::chrono::milliseconds::max()
|
? std::chrono::milliseconds::max()
|
||||||
: std::chrono::milliseconds(
|
: std::chrono::milliseconds(std::max(
|
||||||
std::max(1L, // Minimum 1ms due to millisecond precision
|
1L, // Minimum 1ms due to millisecond precision
|
||||||
static_cast<long>(
|
static_cast<long>(
|
||||||
(config_["interval"].isNumeric() ? config_["interval"].asDouble() : 0) * 1000)));
|
(config_["interval"].isNumeric() ? config_["interval"].asDouble() : 0) *
|
||||||
|
1000)));
|
||||||
|
|
||||||
if (size_ == 0) {
|
if (size_ == 0) {
|
||||||
size_ = 16;
|
size_ = 16;
|
||||||
|
Reference in New Issue
Block a user