eww: Add button to toggle xwayland

This commit is contained in:
2024-11-17 15:43:35 +01:00
parent e26b76514e
commit 67b7083617

View File

@ -42,6 +42,7 @@
(battery)
(box :class "thingy" (systray :orientation "v"))
(color_scheme)
(xwayland)
(kb_layout)
(date)
(clock)
@ -155,7 +156,7 @@
))
(defwidget color_scheme []
(button
(button
:onclick {
color_scheme == "light" ? "set-color-scheme dark && ${EWW_CMD} update color_scheme=dark"
: "set-color-scheme light && ${EWW_CMD} update color_scheme=light"
@ -167,6 +168,19 @@
})
))
(defwidget xwayland []
(button
:onclick {
xwayland_on ? "wmutils xwayland stop && ${EWW_CMD} update xwayland_on=false"
: "wmutils xwayland start && ${EWW_CMD} update xwayland_on=true"
}
:hexpand true
:class "thingy clickable"
(label :text {
xwayland_on ? "Xwa" : "Way"
})
))
(defwidget kb_layout []
(button :onclick "niri msg action switch-layout next"
:hexpand true
@ -240,4 +254,6 @@
(defpoll current_month :interval "60s" "date +%b")
(defpoll current_temp :interval "5s" "cat /sys/class/thermal/thermal_zone*/temp")
(defpoll xwayland_on :interval "5s" "wmutils xwayland is-running")
(defvar vpn_status "{'icon': '-', 'class': 'disconnected'}" )