Skip to content

Commit 197ee78

Browse files
authored
Merge pull request #4525 from lairez/makepkg
Fixes #4521 and #4522
2 parents 18a9835 + d8e2392 commit 197ee78

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/ALabel.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,17 @@ ALabel::ALabel(const Json::Value& config, const std::string& name, const std::st
1717
config["format-alt"].isString() || config["menu"].isString() || enable_click,
1818
enable_scroll),
1919
format_(config_["format"].isString() ? config_["format"].asString() : format),
20+
21+
// Leave the default option outside of the std::max(1L, ...), because the zero value
22+
// (default) is used in modules/custom.cpp to make the difference between
23+
// two types of custom scripts. Fixes #4521.
2024
interval_(config_["interval"] == "once"
2125
? std::chrono::milliseconds::max()
2226
: std::chrono::milliseconds(
23-
std::max(1L, // Minimum 1ms due to millisecond precision
24-
static_cast<long>(
25-
(config_["interval"].isNumeric() ? config_["interval"].asDouble() : interval) * 1000)))),
27+
(config_["interval"].isNumeric()
28+
? std::max(1L, // Minimum 1ms due to millisecond precision
29+
static_cast<long>(config_["interval"].asDouble()) * 1000)
30+
: 1000 * (long)interval))),
2631
default_format_(format_) {
2732
label_.set_name(name);
2833
if (!id.empty()) {

0 commit comments

Comments
 (0)