fix: remove no-op timeout on poll-vars
This commit is contained in:
parent
df1168d6d0
commit
5a581a5974
3 changed files with 3 additions and 11 deletions
|
@ -116,6 +116,7 @@ pub fn parse_scss_from_file(path: &Path) -> Result<String> {
|
||||||
grass::from_string(file_content, &grass_config).map_err(|err| anyhow!("Encountered SCSS parsing error: {:?}", err))
|
grass::from_string(file_content, &grass_config).map_err(|err| anyhow!("Encountered SCSS parsing error: {:?}", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[ext(pub, name = StringExt)]
|
#[ext(pub, name = StringExt)]
|
||||||
impl<T: AsRef<str>> T {
|
impl<T: AsRef<str>> T {
|
||||||
/// check if the string is empty after removing all linebreaks and trimming
|
/// check if the string is empty after removing all linebreaks and trimming
|
||||||
|
|
|
@ -36,7 +36,7 @@ impl ScriptVarDefinition {
|
||||||
pub fn command_span(&self) -> Option<Span> {
|
pub fn command_span(&self) -> Option<Span> {
|
||||||
match self {
|
match self {
|
||||||
ScriptVarDefinition::Poll(x) => match x.command {
|
ScriptVarDefinition::Poll(x) => match x.command {
|
||||||
VarSource::Shell(span, _) => Some(span),
|
VarSource::Shell(span, ..) => Some(span),
|
||||||
VarSource::Function(_) => None,
|
VarSource::Function(_) => None,
|
||||||
},
|
},
|
||||||
ScriptVarDefinition::Listen(x) => Some(x.command_span),
|
ScriptVarDefinition::Listen(x) => Some(x.command_span),
|
||||||
|
@ -70,11 +70,6 @@ impl FromAstElementContent for PollScriptVar {
|
||||||
let mut attrs = iter.expect_key_values()?;
|
let mut attrs = iter.expect_key_values()?;
|
||||||
let initial_value = Some(attrs.primitive_optional("initial")?.unwrap_or_else(|| DynVal::from_string(String::new())));
|
let initial_value = Some(attrs.primitive_optional("initial")?.unwrap_or_else(|| DynVal::from_string(String::new())));
|
||||||
let interval = attrs.primitive_required::<DynVal, _>("interval")?.as_duration()?;
|
let interval = attrs.primitive_required::<DynVal, _>("interval")?.as_duration()?;
|
||||||
let timeout = attrs
|
|
||||||
.primitive_optional::<DynVal, _>("timeout")?
|
|
||||||
.map(|x| x.as_duration())
|
|
||||||
.transpose()?
|
|
||||||
.unwrap_or_else(|| std::time::Duration::from_millis(200));
|
|
||||||
let (script_span, script) = iter.expect_literal()?;
|
let (script_span, script) = iter.expect_literal()?;
|
||||||
iter.expect_done()?;
|
iter.expect_done()?;
|
||||||
Self {
|
Self {
|
||||||
|
|
|
@ -155,8 +155,7 @@ They may also be useful to have buttons within eww change what is shown within y
|
||||||
|
|
||||||
```lisp
|
```lisp
|
||||||
(defpoll time :interval "1s"
|
(defpoll time :interval "1s"
|
||||||
:timeout "0.1s" ; setting timeout is optional
|
:initial "initial-value" ; setting initial is optional
|
||||||
:initial "initial-value" ; setting timeout is optional
|
|
||||||
`date +%H:%M:%S`)
|
`date +%H:%M:%S`)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -166,9 +165,6 @@ This may be the most commonly used type of variable.
|
||||||
They are useful to access any quickly retrieved value repeatedly,
|
They are useful to access any quickly retrieved value repeatedly,
|
||||||
and thus are the perfect choice for showing your time, date, as well as other bits of information such as your volume.
|
and thus are the perfect choice for showing your time, date, as well as other bits of information such as your volume.
|
||||||
|
|
||||||
Optionally, you can specify a timeout, after which the provided script will be aborted.
|
|
||||||
This helps to avoid accidentally launching thousands of never-ending processes on your system.
|
|
||||||
|
|
||||||
You can also specify an initial-value, this should prevent eww from waiting for the result of a give command during startup, thus,
|
You can also specify an initial-value, this should prevent eww from waiting for the result of a give command during startup, thus,
|
||||||
making the startup time faster.
|
making the startup time faster.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue