Updated docs to comply with new map syntax

This commit is contained in:
Leonardo Gibrowski Faé 2022-04-19 22:05:42 -03:00
parent 2b103b7acd
commit 4c4a20d835
9 changed files with 138 additions and 159 deletions

View file

@ -68,8 +68,8 @@ bar:
content:
map:
conditions:
(activated == false): {empty: {}}
(activated == true):
~activated: {empty: {}}
activated:
- string: {text: "{app-id}: {title}"}
```

View file

@ -104,7 +104,7 @@ bar:
map:
default: {string: {text: "{name}"}}
conditions:
(state == focused): {string: {text: "{name}*"}}
state == focused: {string: {text: "{name}*"}}
current: { string: {text: "{application}: {title}"}}
```

View file

@ -75,11 +75,11 @@ bar:
content:
map:
conditions:
(mounted == false):
~mounted:
string:
on-click: udisksctl mount -b {device}
text: "{label}"
(mounted == true):
mounted:
string:
on-click: udisksctl unmount -b {device}
text: "{label}"

View file

@ -80,8 +80,8 @@ bar:
content:
map:
conditions:
(occupied == false): {empty: {}}
(occupied == true):
~occupied: {empty: {}}
occupied:
string:
margin: 5
text: "{id}: {state}"

View file

@ -134,8 +134,8 @@ bar:
content:
map:
conditions:
(status == Paused): {empty: {}}
(status == Playing):
status == Paused: {empty: {}}
status == Playing:
content: {string: {text: "{artist} - {title}"}}
```

View file

@ -69,16 +69,16 @@ in red.
content:
map:
conditions:
(carrier == false): {empty: {}}
(carrier == true):
~carrier: {empty: {}}
carrier:
map:
default: {string: {text: , font: *awesome, foreground: ffffff66}}
conditions:
(state == up):
state == up:
map:
default: {string: {text: , font: *awesome}}
conditions:
(ipv4 == ""): {string: {text: , font: *awesome, foreground: ffffff66}}
ipv4 == "": {string: {text: , font: *awesome, foreground: ffffff66}}
```
## Use yaml anchors

View file

@ -208,10 +208,14 @@ content:
# MAP
This particle maps the values of a specific tag to different
particles based on conditions. A condition takes the form of:
particles based on conditions. A condition takes either the form of:
<tag> <operation> <value>
Or, for boolean tags:
<tag>
Where <tag> is the tag you would like to map, <operation> is one of:
[- ==
@ -221,22 +225,11 @@ Where <tag> is the tag you would like to map, <operation> is one of:
:- <=
:- <
and <value> is the value you would like to compare it to. Conditions
may be chained together using either '&&' or '||':
and <value> is the value you would like to compare it to.
<condition1> && <condition2>
For boolean tags, negation is done with a preceding '~':
You may surround the *whole expression* with parenthesis to make it
more readable:
(<condition1> && <condition2>)
Note that "nested" conditions are *NOT* supported. That is, something
like (<condition1> && (<condition2> || <condition3>)) will *NOT* work.
Furthermore, *conditions are evaluated with a strcmp*. This means
some odd behaviour may arise if prefixes (such as zeroes) are added
to numerical constants.
~<tag>
In addition to explicit tag values, you can also specify a
default/fallback particle.
@ -264,9 +257,8 @@ content:
default:
string:
text: this is the default particle; the tag's value is now {tag_name}
# Note, below, how the parenthesis are optional
conditions:
(tag == one_value):
tag == one_value:
string:
text: tag's value is now one_value
tag == another_value:
@ -275,6 +267,20 @@ content:
```
For a boolean tag:
```
content:
map:
conditions:
tag:
string:
text: tag is true
~tag:
string:
text: tag is false
```
# RAMP
This particle uses a range tag to index into an array of