glzr-io / zebar

Zebar is a tool for creating customizable and cross-platform taskbars, desktop widgets, and popups.
GNU General Public License v3.0
163 stars 14 forks source link

feat: custom template engine #6

Closed lars-berger closed 8 months ago

lars-berger commented 8 months ago

New syntax:

@for (workspace in glazewm.workspaces) {
  @if (workspace.state == 'focused') {
    <button class="focused-workspace">
      {{ workspace.name }}
    </button>
  } @else if (workspace.state == 'active') {
    <button class="active-workspace" onclick="{{ focus_workspace }}">
      {{ workspace.name }}
    </button>
  } @else {
    <button class="normal-workspace" onclick="{{ focus_workspace }}">
      {{ workspace.name }}
    </button>
  }
}

Old syntax (liquidjs):

{% for workspace in glazewm.workspaces %}
  {% if workspace.state == 'focused' %}
    <button class="focused-workspace">
      {{ workspace.name }}
    </button>
  {% elsif workspace.state == 'active' %}
    <button class="active-workspace" onclick="{{ focus_workspace }}">
      {{ workspace.name }}
    </button>
  {% else %}
    <button class="normal-workspace" onclick="{{ focus_workspace }}">
      {{ workspace.name }}
    </button>
  {% endif %}
{% endfor %}