Add migration to readme

This commit is contained in:
elkowar 2021-08-18 16:01:50 +02:00
parent 4942925859
commit b8877c5dc0
No known key found for this signature in database
GPG key ID: E321AD71B1D1F27F
3 changed files with 41 additions and 108 deletions

View file

@ -4,19 +4,27 @@
<img src="./.github/EwwLogo.svg" height="100" align="left"/> <img src="./.github/EwwLogo.svg" height="100" align="left"/>
Elkowar&rsquo;s Wacky Widgets is a standalone widget system made in Rust that allows you to implement Elkowars Wacky Widgets is a standalone widget system made in Rust that allows you to implement
your own, custom widgets in any window manager. your own, custom widgets in any window manager.
Documentation **and instructions on how to install** can be found [here](https://elkowar.github.io/eww). Documentation **and instructions on how to install** can be found [here](https://elkowar.github.io/eww).
## New configuration language needs a name - USER OPINIONS NEEDED ## New configuration language!
The rework of the configuration language has been decided on. Now, we just need a name! YUCK IS ALIVE! After months of waiting, the new configuration language has now been released!
Please give your opinions in the [discussion post](https://github.com/elkowar/eww/discussions/206). This also means that XML is no longer supported from this point onwards.
If you want to keep using the latest releases of eww, you'll need to migrate your config over to yuck.
The steps to migrate can be found in [the migration guide](YUCK_MIGRATION.md)
Additionally, a couple _amazing_ people have started to work on an
[automatic converter](https://github.com/undefinedDarkness/ewwxml) that can turn your old eww.xml into the new yuck format!
## Examples ## Examples
(note that some of these still make use of the old configuration syntax)
* A basic bar, see [examples](./examples/eww-bar) * A basic bar, see [examples](./examples/eww-bar)
![Example 1](./examples/eww-bar/eww-bar.png) ![Example 1](./examples/eww-bar/eww-bar.png)

29
YUCK_MIGRATION.md Normal file
View file

@ -0,0 +1,29 @@
# Migrating to yuck
Yuck is the new configuration syntax used by eww.
While the syntax has changed dramatically, the general structure of the configuration
has stayed mostly the same.
Most notably, the top-level blocks are now gone.
This means that `defvar`, `defwidget`, etc blocks no longer need to be in separate
sections of the file, but instead can be put wherever you need them.
Explaining the exact syntax of yuck would be significantly less effective than just
looking at an example, as the general syntax is very simple.
Thus, to get a feel for yuck, read through the [example configuration](./examples/eww-bar/eww.yuck).
Additionally, a couple smaller things have been changed.
The fields and structure of the `defwindow` block as been adjusted to better reflect
the options provided by the displayserver that is being used.
The major changes are:
- The `screen` field is now called `monitor`
- `reserve` and `geometry` are now structured slightly differently
To see how exactly the configuration now looks, check the [respective documentation](./docs/src/configuration.md#creating-your-first-window)
## Automatically converting your configuration
A couple _amazing_ people have started to work on an [automatic converter](https://github.com/undefinedDarkness/ewwxml) that can turn your
old eww.xml into the new yuck format!

View file

@ -1,104 +0,0 @@
<!-- The main eww configuration file. This is where your widgets and how they appear on the screen and what they
contain are defined. -->
<eww>
<definitions>
<!-- This is the place where you structure your widgets, align them and stuff. -->
<def name="bar"> <!-- Starts the definition of a widget named main -->
<box orientation="h" hexpand="true">
<workspaces/>
<music/>
<sidestuff/>
</box>
</def>
<def name="sidestuff">
<box class="sidestuff" orientation="h" space-evenly="false" halign="end">
<slider-vol/>
<slider-ram/>
<time/>
</box>
</def>
<def name="workspaces">
<box orientation="h" class="workspaces" space-evenly="true" halign="start"> <!-- Your workspaces.-->
<button onclick="wmctrl -s 0">1</button>
<button onclick="wmctrl -s 1">2</button>
<button onclick="wmctrl -s 2">3</button>
<button onclick="wmctrl -s 3">4</button>
<button onclick="wmctrl -s 4">5</button>
<button onclick="wmctrl -s 5">6</button>
<button onclick="wmctrl -s 6">7</button>
<button onclick="wmctrl -s 7">8</button>
<button onclick="wmctrl -s 8">9</button>
</box>
</def>
<def name="music">
<box orientation="h" class="music" halign="center" space-evenly="false">
<!-- An image. We won't be using it, but it might be handy if you ever need it. -->
<!-- <image path="/home/user/.config/eww/icons/music.svg"/> -->
 {{music}} <!--This is how you use variables.-->
</box>
</def>
<def name="slider-vol">
<!--A basic volume slider-->
<box orientation="h" class="slider-vol" space-evenly="false">
<box class="label-vol"></box>
<scale min="0" max="101" value="{{volume}}" onchange="amixer -D pulse sset Master {}%"/>
</box>
</def>
<def name="slider-ram">
<!--A basic RAM slider-->
<box orientation="h" class="slider-ram" space-evenly="false">
<box class="label-ram"></box>
<scale min="0" active="false" max="101" value="{{ram-used}}"/>
</box>
</def>
<def name="time">
<!--Time-->
<box class="time">{{hour}}:{{min}} {{month}} {{number_day}}, {{year_full}}</box>
</def>
</definitions>
<variables>
<!-- Music vars -->
<!-- These are your variables. Like they say, they run a script, and then output that to the variable. In
the following var, we get music info from playerctl. -->
<script-var name="music" interval="5s">playerctl metadata --format '{{ artist }} - {{ title }}'</script-var>
<!--Volume var-->
<!-- If your vars get too complex to write down here, you can use an external script and paste it's path here as well, as shown below.
-->
<script-var name="volume" interval="16ms">~/.config/eww/scripts/getvol</script-var>
<!--Date vars-->
<script-var name="number_day" interval="5h">date "+%d"</script-var>
<script-var name="month" interval="10h">date "+%b"</script-var>
<script-var name="min" interval="10s">date "+%M"</script-var>
<script-var name="hour" interval="1m">date "+%H"</script-var>
<script-var name="year_full" interval="15h">date "+%Y"</script-var>
<!--RAM var-->
<script-var name="ram-used" interval="1s">~/.config/eww/scripts/getram</script-var>
<!--Battery charge var-->
<script-var name="battery-remaining" interval="2m">cat /sys/class/power_supply/BAT0/capacity</script-var>
</variables>
<windows>
<!-- These are the windows -->
<window name="bar" screen="0" focusable="true" windowtype="dock">
<geometry x="0%" y="0%" width="100%" height="4%"/> <!--Specifies geometry-->
<reserve side="top" distance="4%" layer="top"/>
<widget>
<bar/> <!--This is the def we created earlier-->
</widget>
</window>
</windows>
</eww>