diff --git a/docs/src/configuration.md b/docs/src/configuration.md index 3759cf0..127b95b 100644 --- a/docs/src/configuration.md +++ b/docs/src/configuration.md @@ -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). +## 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. diff --git a/docs/src/eww.md b/docs/src/eww.md index 0974c33..44c3b9c 100644 --- a/docs/src/eww.md +++ b/docs/src/eww.md @@ -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. 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 @@ -21,7 +21,7 @@ as this makes it easy to use the nightly toolchain necessary to build eww. ### 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: ```bash @@ -55,4 +55,3 @@ and then to run it do ./eww daemon ./eww open ``` -`` is the name of the window, see [The windows block](configuration.md#windows-block). diff --git a/docs/src/expression_language.md b/docs/src/expression_language.md index bb72b90..d1f2219 100644 --- a/docs/src/expression_language.md +++ b/docs/src/expression_language.md @@ -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. -This can be used whereever you can use variable-references (`{{varname}}`). +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. + +These expressions can be placed anywhere within your configuration in between `{ ... }`, as well as withing strings, inside string-interpolation blocks (`"foo ${ ... } bar"`). ## Example -```xml - - -Some math: {{12 + 2 * 10}} +```lisp +(box + "Some math: ${12 + foo * 10}" + (button :class {button_active ? "active" : "inactive"} + :onclick "toggle_thing" + {button_active ? "disable" : "enable"})) ``` -## Syntax +## Features -The expression language supports: +Supported currently are the following features: - simple mathematical operations (`+`, `-`, `*`, `/`, `%`) - comparisons (`==`, `!=`, `>`, `<`) - boolean operations (`||`, `&&`, `!`) - elvis operator (`?:`) - 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`) - - strings can contain other expressions again: `'foo {{some_variable}} bar'` - 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. - some function calls: diff --git a/docs/src/troubleshooting.md b/docs/src/troubleshooting.md index fdd1d36..d765869 100644 --- a/docs/src/troubleshooting.md +++ b/docs/src/troubleshooting.md @@ -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. 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 -2. The scss file isn't called correctly. (it should be called `eww.scss` in the `$HOME/.config/eww` folder) -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. +1. Make sure the `eww.yuck` and `eww.scss` files are in the correct places +2. Sometimes, eww might fail to load your configuration as a result of a configuration error. Make sure your configuration is valid. ## Something isn't styled correctly! -1. You have mistyped the CSS class. -2. Check the [GTK-Debugger](working_with_gtk.md#gtk-debugger) +Check the [GTK-Debugger](working_with_gtk.md#gtk-debugger) to get more insight into what styles GTK is applying to which elements. ## General issues 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`. - 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 -- sometimes hot reloading doesn't work. restart the widget in that case - -If you're experiencing issues printing variables, try to print them in quotes, so e.g. - -``` -onchange="notify-send '{}'" -``` +- sometimes hot reloading doesn't work. In that case, you can make use of `eww reload` manually. Remember, if your issue isn't listed here, [open an issue on the GitHub repo](https://github.com/elkowar/eww/issues).