eww (ElKowar's Wacky Widgets)
a rust based widget system with a lisp (s-expression) based widget configuration and SCSS styling
Setup
- install
eww-git
. - to start create an
eww
director in~/.config
. the default one can be found in/etc/xdg/eww
- create an
eww.yuck
in this new directory for you wiget declarations - create an
eww.scss
in this new directory for you wiget styles (this is basically SCSS but for GTK css)
Running
- run
eww daemon
to start the daemon service - open a window by running
eww open <window-name>
- close a window by running
eww close <window-name>
or close all windows witheww close-all
Building
- while debugging a window or widget you can follow logs using
eww logs
- using
wmctrl -s <number>
you can switch windows for EWMH compliant window managers. this can be tied to button onclick events. more on EWMH - using
playerctl --follow metadata --format '{{ artist }} - {{ title }}'
you can follow changes to media being played usingdeflisten
a variable - by default windows use GTK theme style. setting
all: unset
removes styles for specific window elements
Yuck
include
import configuration relative to eww
root directory
(include "./src/yuck/_variables.yuck")
defwindow
define a window with content "test window". windows can be normal
, dock
etc. based on X11 or Wayland window types. reserve
provides space for non-overlapping windows like dock
s. monitor
and geometry
are used for positioning and sizing
(defwindow bar :monitor 1 :windowtype "dock" :geometry (geometry :x "0%" :y "0%" :width "90%" :height "10px" :anchor "top center") :reserve (struts :side "bottom" :distance "4%") "test window")
defvar
define normal variable
(defvar workspacelist "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]")
deflisten
define a variable that listens for changes at the end of a command's live output/log
(deflisten music :intial "" "playerctl --follow metadata --format '{{ artist }} - {{ title }}' || true")
defpoll
define a variable that polls a command for given interval
(defpoll time :interval "10s" "date '+%H:%M %b %d, %Y'")
defwidget
- define a container widget. `centerbox` requires 3 elements
(defwidget bar [] (centerbox :orientation "h" (workspaces) (music) (sidestuff)))
- define a widget for workspaces selection. elements in center box require positioning e.g. :halign "center" or "start" or "side"
(defwidget workspaces [] (box :class "workspace" :orientation "h" :space-evenly true :halign "start" :spacing 10 (for entry in workspacelist (button :onclick "wmctrl -s ${entry - 1}" entry))))