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) (battery)
(box :class "thingy" (systray :orientation "v")) (box :class "thingy" (systray :orientation "v"))
(color_scheme) (color_scheme)
(xwayland)
(kb_layout) (kb_layout)
(date) (date)
(clock) (clock)
@ -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 [] (defwidget kb_layout []
(button :onclick "niri msg action switch-layout next" (button :onclick "niri msg action switch-layout next"
:hexpand true :hexpand true
@ -240,4 +254,6 @@
(defpoll current_month :interval "60s" "date +%b") (defpoll current_month :interval "60s" "date +%b")
(defpoll current_temp :interval "5s" "cat /sys/class/thermal/thermal_zone*/temp") (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'}" ) (defvar vpn_status "{'icon': '-', 'class': 'disconnected'}" )