eww: Show current keyboard layout

This commit is contained in:
2024-11-20 22:26:47 +01:00
parent 06affa9723
commit a411350480
2 changed files with 15 additions and 6 deletions

View File

@ -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;
}

View File

@ -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'}" )