more changes
This commit is contained in:
@ -13,7 +13,8 @@ The *cpu* module displays the current CPU utilization.
|
|||||||
*interval*: ++
|
*interval*: ++
|
||||||
typeof: integer or float ++
|
typeof: integer or float ++
|
||||||
default: 10 ++
|
default: 10 ++
|
||||||
The interval in which the information gets polled.
|
The interval in which the information gets polled. ++
|
||||||
|
Minimum value is 0.001 (1ms). Values smaller than 1ms will be set to 1ms.
|
||||||
|
|
||||||
*format*: ++
|
*format*: ++
|
||||||
typeof: string ++
|
typeof: string ++
|
||||||
|
@ -37,6 +37,7 @@ Addressed by *custom/<name>*
|
|||||||
*interval*: ++
|
*interval*: ++
|
||||||
typeof: integer or float ++
|
typeof: integer or float ++
|
||||||
The interval (in seconds) in which the information gets polled. ++
|
The interval (in seconds) in which the information gets polled. ++
|
||||||
|
Minimum value is 0.001 (1ms). Values smaller than 1ms will be set to 1ms. ++
|
||||||
Use *once* if you want to execute the module only on startup. ++
|
Use *once* if you want to execute the module only on startup. ++
|
||||||
You can update it manually with a signal. If no *interval* or *signal* is defined, it is assumed that the out script loops itself. ++
|
You can update it manually with a signal. If no *interval* or *signal* is defined, it is assumed that the out script loops itself. ++
|
||||||
If a *signal* is defined then the script will run once on startup and will only update with a signal.
|
If a *signal* is defined then the script will run once on startup and will only update with a signal.
|
||||||
@ -44,6 +45,7 @@ Addressed by *custom/<name>*
|
|||||||
*restart-interval*: ++
|
*restart-interval*: ++
|
||||||
typeof: integer or float ++
|
typeof: integer or float ++
|
||||||
The restart interval (in seconds). ++
|
The restart interval (in seconds). ++
|
||||||
|
Minimum value is 0.001 (1ms). Values smaller than 1ms will be set to 1ms. ++
|
||||||
Can't be used with the *interval* option, so only with continuous scripts. ++
|
Can't be used with the *interval* option, so only with continuous scripts. ++
|
||||||
Once the script exits, it'll be re-executed after the *restart-interval*.
|
Once the script exits, it'll be re-executed after the *restart-interval*.
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ The *image* module displays an image from a path.
|
|||||||
*interval*: ++
|
*interval*: ++
|
||||||
typeof: integer or float ++
|
typeof: integer or float ++
|
||||||
The interval (in seconds) to re-render the image. ++
|
The interval (in seconds) to re-render the image. ++
|
||||||
|
Minimum value is 0.001 (1ms). Values smaller than 1ms will be set to 1ms. ++
|
||||||
This is useful if the contents of *path* changes. ++
|
This is useful if the contents of *path* changes. ++
|
||||||
If no *interval* is defined, the image will only be rendered once.
|
If no *interval* is defined, the image will only be rendered once.
|
||||||
|
|
||||||
|
@ -20,9 +20,9 @@ ALabel::ALabel(const Json::Value& config, const std::string& name, const std::st
|
|||||||
interval_(config_["interval"] == "once"
|
interval_(config_["interval"] == "once"
|
||||||
? std::chrono::milliseconds::max()
|
? std::chrono::milliseconds::max()
|
||||||
: std::chrono::milliseconds(
|
: std::chrono::milliseconds(
|
||||||
|
std::max(1L, // Minimum 1ms due to millisecond precision
|
||||||
static_cast<long>(
|
static_cast<long>(
|
||||||
std::max(0.001, // Minimum 1ms to prevent performance issues
|
(config_["interval"].isNumeric() ? config_["interval"].asDouble() : interval) * 1000)))),
|
||||||
config_["interval"].isNumeric() ? config_["interval"].asDouble() : interval) * 1000))),
|
|
||||||
default_format_(format_) {
|
default_format_(format_) {
|
||||||
label_.set_name(name);
|
label_.set_name(name);
|
||||||
if (!id.empty()) {
|
if (!id.empty()) {
|
||||||
|
@ -92,9 +92,8 @@ 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(
|
||||||
static_cast<long>(
|
std::max(1L, // Minimum 1ms due to millisecond precision
|
||||||
std::max(0.001, // Minimum 1ms to prevent performance issues
|
static_cast<long>(config_["restart-interval"].asDouble() * 1000))));
|
||||||
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_) {
|
||||||
throw std::runtime_error("Unable to open " + cmd);
|
throw std::runtime_error("Unable to open " + cmd);
|
||||||
|
@ -17,9 +17,9 @@ waybar::modules::Image::Image(const std::string& id, const Json::Value& config)
|
|||||||
interval_ = config_["interval"] == "once"
|
interval_ = config_["interval"] == "once"
|
||||||
? std::chrono::milliseconds::max()
|
? std::chrono::milliseconds::max()
|
||||||
: std::chrono::milliseconds(
|
: std::chrono::milliseconds(
|
||||||
|
std::max(1L, // Minimum 1ms due to millisecond precision
|
||||||
static_cast<long>(
|
static_cast<long>(
|
||||||
std::max(0.001, // Minimum 1ms to prevent performance issues
|
(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