From a4113504809038c4e23c62d838074bd701efab4a Mon Sep 17 00:00:00 2001 From: Joakim Hulthe Date: Wed, 20 Nov 2024 22:26:47 +0100 Subject: [PATCH] eww: Show current keyboard layout --- tree/.config/eww/eww.scss | 9 +++++++++ tree/.config/eww/eww.yuck | 12 ++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/tree/.config/eww/eww.scss b/tree/.config/eww/eww.scss index c7de8c2..483c294 100644 --- a/tree/.config/eww/eww.scss +++ b/tree/.config/eww/eww.scss @@ -163,6 +163,15 @@ scale trough { background: $lowlight2; } +.toggleable { + transition: border 0.5s; +} + +.toggleable.on { + border-left: solid 2px green; + border-right: solid 2px green; +} + .clickable { transition: background-color 0.2s; } diff --git a/tree/.config/eww/eww.yuck b/tree/.config/eww/eww.yuck index ba44d76..641619a 100644 --- a/tree/.config/eww/eww.yuck +++ b/tree/.config/eww/eww.yuck @@ -175,17 +175,15 @@ : "wmutils xwayland start && ${EWW_CMD} update xwayland_on=true" } :hexpand true - :class "thingy clickable" - (label :text { - xwayland_on ? "Xwa" : "Way" - }) + :class {"thingy clickable toggleable" + (xwayland_on ? " on" : "")} + (label :text "XWL") )) (defwidget kb_layout [] - (button :onclick "niri msg action switch-layout next" + (button :onclick "wmutils next-keyboard-layout" :hexpand true :class "thingy clickable" - (label :text "KBL") + (label :text keyboard_layout) )) (defwidget date [] @@ -254,6 +252,8 @@ (defpoll current_month :interval "60s" "date +%b") (defpoll current_temp :interval "5s" "cat /sys/class/thermal/thermal_zone*/temp") +(defpoll keyboard_layout :interval "5s" "wmutils keyboard-layout --short") + (defpoll xwayland_on :interval "5s" "wmutils xwayland is-running") (defvar vpn_status "{'icon': '-', 'class': 'disconnected'}" )