Implement '&&' and '||' operators on map

'-' is a valid character for tags.

Commit 03e1c7d (module/network: Add link stats, 2022-04-30) introduced
two new tags for the network module: `ul-speed` and `dl-speed`. These
use the `-` character, that was previously never used in any tag.

We had two options: either change those tags to use `_` instead, or just
accept `-`s as a valid character. Going forward, I can see many people
deciding to name their tags with `-` instead of `_`, so I believe it is
better to just accept it once and for all.

Note that `-` cannot be used as the first character of a tag (e.g.
`-tag1`) since the `-` has a special meaning in `.yml` files. I don't
believe this will happen often, however, and should be easy to both
detect and correct if it does.
This commit is contained in:
Leonardo Gibrowski Faé 2022-05-10 22:04:26 -03:00
parent 463b39b56d
commit 4a41d4296a
No known key found for this signature in database
GPG key ID: 9F85F3D45A51B992
10 changed files with 330 additions and 226 deletions

View file

@ -178,11 +178,7 @@ bar:
map:
default: {string: {text: , font: *awesome, foreground: ffffff66}}
conditions:
state == up:
map:
default: {string: {text: , font: *awesome}}
conditions:
ipv4 == "": {string: {text: , font: *awesome, foreground: ffffff66}}
state == up && ipv4 != "": {string: {text: , font: *awesome}}
- network:
name: wlp2s0
poll-interval: 1
@ -257,7 +253,7 @@ bar:
state == full:
- string: {text: , foreground: 00ff00ff, font: *awesome}
- string: {text: "{capacity}% full"}
state == not charging:
state == "not charging":
- ramp:
tag: capacity
items:

View file

@ -41,16 +41,18 @@ bar:
map:
<<: *river_base
deco: *bg_default
state == visible:
state == visible && ~occupied:
map:
conditions:
~occupied: {map: {<<: *river_base}}
occupied: {map: {<<: *river_base, deco: *bg_default}}
<<: *river_base
state == visible && occupied:
map:
<<: *river_base
deco: *bg_default
state == unfocused:
map:
<<: *river_base
state == invisible:
state == invisible && ~occupied: {empty: {}}
state == invisible && occupied:
map:
conditions:
~occupied: {empty: {}}
occupied: {map: {<<: *river_base, deco: {underline: {size: 3, color: ea6962ff}}}}
<<: *river_base
deco: {underline: {size: 3, color: ea6962ff}}