Fix eww expression and start page, add includes to configuration page
This commit is contained in:
parent
20f3d3c10d
commit
e750abf38c
4 changed files with 39 additions and 40 deletions
|
@ -144,3 +144,20 @@ These are particularly useful if you have a script that can monitor some value o
|
||||||
|
|
||||||
In addition to definition your own variables, eww provides some values for you to use out of the box. These include values such as your CPU and RAM usage. These mostly contain their data as JSON, which you can then use using the [json access syntax](expression_language.md). All available magic variables are listed [here](magic-vars.md).
|
In addition to definition your own variables, eww provides some values for you to use out of the box. These include values such as your CPU and RAM usage. These mostly contain their data as JSON, which you can then use using the [json access syntax](expression_language.md). All available magic variables are listed [here](magic-vars.md).
|
||||||
|
|
||||||
|
## Splitting up your configuration
|
||||||
|
|
||||||
|
As time passes, your configuration might grow larger and larger. Luckily, you can easily split up your configuration into multiple files!
|
||||||
|
|
||||||
|
There are two options to achieve this:
|
||||||
|
|
||||||
|
### Using `include`
|
||||||
|
|
||||||
|
```lisp
|
||||||
|
(include "./path/to/your/file.yuck")
|
||||||
|
```
|
||||||
|
|
||||||
|
A single yuck-file may import the contents of any other yuck file. For this, make use of the `include` directive.
|
||||||
|
|
||||||
|
### Using a separate eww configuration directory
|
||||||
|
|
||||||
|
If you want to separate different widgets even further, you can create a new eww config folder anywhere else. Then, you can tell eww to use that configuration directory by passing _every_ command the `--config /path/to/your/config/dir` flag. Make sure to actually include this in all your `eww` calls, including `eww kill`, `eww logs`, etc. This launches a separate instance of the eww daemon, that has separate logs and state from your main eww configuration.
|
||||||
|
|
|
@ -5,7 +5,7 @@ is a widget system made in [rust](https://www.rust-lang.org/),
|
||||||
which let's you create your own widgets similarly to how you can in AwesomeWM.
|
which let's you create your own widgets similarly to how you can in AwesomeWM.
|
||||||
The key difference: It is independent of your window manager!
|
The key difference: It is independent of your window manager!
|
||||||
|
|
||||||
Configured in XML and themed using CSS, it is easy to customize and provides all the flexibility you need!
|
Configured in yuck and themed using CSS, it is easy to customize and provides all the flexibility you need!
|
||||||
|
|
||||||
|
|
||||||
## How to install Eww
|
## How to install Eww
|
||||||
|
@ -21,7 +21,7 @@ as this makes it easy to use the nightly toolchain necessary to build eww.
|
||||||
|
|
||||||
### Building
|
### Building
|
||||||
|
|
||||||
Once you have the Prerequisites ready, you're ready to install and build eww.
|
Once you have the prerequisites ready, you're ready to install and build eww.
|
||||||
|
|
||||||
First clone the repo:
|
First clone the repo:
|
||||||
```bash
|
```bash
|
||||||
|
@ -55,4 +55,3 @@ and then to run it do
|
||||||
./eww daemon
|
./eww daemon
|
||||||
./eww open <window_name>
|
./eww open <window_name>
|
||||||
```
|
```
|
||||||
`<window_name>` is the name of the window, see [The windows block](configuration.md#windows-block).
|
|
||||||
|
|
|
@ -1,31 +1,29 @@
|
||||||
# The embedded Eww expression-language
|
# Simple expression language
|
||||||
|
|
||||||
Within variable references, you can make use of a small, built-in expression language.
|
Yuck includes a small expression language that can be used to run several operations on your data. This can be used to show different values depending on certain conditions, do mathematic operations, and even to access values withing JSON-structures.
|
||||||
This can be used whereever you can use variable-references (`{{varname}}`).
|
|
||||||
|
These expressions can be placed anywhere within your configuration in between `{ ... }`, as well as withing strings, inside string-interpolation blocks (`"foo ${ ... } bar"`).
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
```xml
|
```lisp
|
||||||
<button
|
(box
|
||||||
class="{{if button_active then 'active' else 'inactive'}}"
|
"Some math: ${12 + foo * 10}"
|
||||||
onclick="toggle_thing">
|
(button :class {button_active ? "active" : "inactive"}
|
||||||
{{if button_active then 'disable' else 'enable'}}
|
:onclick "toggle_thing"
|
||||||
</button>
|
{button_active ? "disable" : "enable"}))
|
||||||
|
|
||||||
Some math: {{12 + 2 * 10}}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Syntax
|
## Features
|
||||||
|
|
||||||
The expression language supports:
|
Supported currently are the following features:
|
||||||
- simple mathematical operations (`+`, `-`, `*`, `/`, `%`)
|
- simple mathematical operations (`+`, `-`, `*`, `/`, `%`)
|
||||||
- comparisons (`==`, `!=`, `>`, `<`)
|
- comparisons (`==`, `!=`, `>`, `<`)
|
||||||
- boolean operations (`||`, `&&`, `!`)
|
- boolean operations (`||`, `&&`, `!`)
|
||||||
- elvis operator (`?:`)
|
- elvis operator (`?:`)
|
||||||
- if the left side is `""`, then returns the right side, otherwise evaluates to the left side.
|
- if the left side is `""`, then returns the right side, otherwise evaluates to the left side.
|
||||||
- conditionals (`if condition then 'value' else 'other value'`)
|
- conditionals (`condition ? 'value' : 'other value'`)
|
||||||
- numbers, strings, booleans and variable references (`12`, `'hi'`, `true`, `some_variable`)
|
- numbers, strings, booleans and variable references (`12`, `'hi'`, `true`, `some_variable`)
|
||||||
- strings can contain other expressions again: `'foo {{some_variable}} bar'`
|
|
||||||
- json access (`object.field`, `array[12]`, `object["field"]`)
|
- json access (`object.field`, `array[12]`, `object["field"]`)
|
||||||
- for this, the object/array value needs to refer to a variable that contains a valid json string.
|
- for this, the object/array value needs to refer to a variable that contains a valid json string.
|
||||||
- some function calls:
|
- some function calls:
|
||||||
|
|
|
@ -12,39 +12,24 @@ Here you will find help if something doesn't work, if the issue isn't listed her
|
||||||
1. Make sure you compiled eww with the `--no-default-features --features=wayland` flags.
|
1. Make sure you compiled eww with the `--no-default-features --features=wayland` flags.
|
||||||
2. Make sure that you're not trying to use X11-specific features (these are (hopefully) explicitly specified as such in the documentation).
|
2. Make sure that you're not trying to use X11-specific features (these are (hopefully) explicitly specified as such in the documentation).
|
||||||
|
|
||||||
## My scss isn't being loaded!
|
## My configuration is not loaded correctly
|
||||||
|
|
||||||
1. You have not created a scss file
|
1. Make sure the `eww.yuck` and `eww.scss` files are in the correct places
|
||||||
2. The scss file isn't called correctly. (it should be called `eww.scss` in the `$HOME/.config/eww` folder)
|
2. Sometimes, eww might fail to load your configuration as a result of a configuration error. Make sure your configuration is valid.
|
||||||
3. The scss file isn't placed in the correct location (check above)
|
|
||||||
|
|
||||||
If none of these fixed your problem [open an issue on the GitHub repo](https://github.com/elkowar/eww/issues), or check the [GTK-Debugger](working_with_gtk.md#gtk-debugger).
|
|
||||||
|
|
||||||
## Eww can't find my configuration file!
|
|
||||||
|
|
||||||
1. It's incorrectly named or it's in the wrong place (it should be called `eww.xml` in the `$HOME/.config/eww` folder)
|
|
||||||
2. You haven't started eww correctly or you started it wrong.
|
|
||||||
|
|
||||||
## Something isn't styled correctly!
|
## Something isn't styled correctly!
|
||||||
|
|
||||||
1. You have mistyped the CSS class.
|
Check the [GTK-Debugger](working_with_gtk.md#gtk-debugger) to get more insight into what styles GTK is applying to which elements.
|
||||||
2. Check the [GTK-Debugger](working_with_gtk.md#gtk-debugger)
|
|
||||||
|
|
||||||
## General issues
|
## General issues
|
||||||
|
|
||||||
You should try the following things, before opening a issue or doing more specialized troubleshooting:
|
You should try the following things, before opening a issue or doing more specialized troubleshooting:
|
||||||
|
|
||||||
- Kill the eww daemon by running `eww kill` and restart it with `eww --debug daemon` to get additional log output.
|
- Kill the eww daemon by running `eww kill` and re-open your window with the `--debug`-flag to get additional log output.
|
||||||
- Now you can take a look at the logs by running `eww logs`.
|
- Now you can take a look at the logs by running `eww logs`.
|
||||||
- use `eww state`, to see the state of all variables
|
- use `eww state`, to see the state of all variables
|
||||||
- use `eww debug`, to see the xml of your widget and other information
|
- use `eww debug`, to see the structure of your widget and other information
|
||||||
- update to the latest eww version
|
- update to the latest eww version
|
||||||
- sometimes hot reloading doesn't work. restart the widget in that case
|
- sometimes hot reloading doesn't work. In that case, you can make use of `eww reload` manually.
|
||||||
|
|
||||||
If you're experiencing issues printing variables, try to print them in quotes, so e.g.
|
|
||||||
|
|
||||||
```
|
|
||||||
onchange="notify-send '{}'"
|
|
||||||
```
|
|
||||||
|
|
||||||
Remember, if your issue isn't listed here, [open an issue on the GitHub repo](https://github.com/elkowar/eww/issues).
|
Remember, if your issue isn't listed here, [open an issue on the GitHub repo](https://github.com/elkowar/eww/issues).
|
||||||
|
|
Loading…
Add table
Reference in a new issue