eww: Add color-scheme switch button
This commit is contained in:
@ -41,10 +41,11 @@
|
||||
(temperature)
|
||||
(battery)
|
||||
(box :class "thingy" (systray :orientation "v"))
|
||||
(color_scheme)
|
||||
(kb_layout)
|
||||
(date)
|
||||
(clock)
|
||||
(pwr)
|
||||
(lock)
|
||||
))
|
||||
|
||||
(defwidget workspaces [monitor]
|
||||
@ -152,6 +153,19 @@
|
||||
;(label :text "${bat_charge}%")
|
||||
))
|
||||
|
||||
(defwidget color_scheme []
|
||||
(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"
|
||||
}
|
||||
:hexpand true
|
||||
:class "bigthingy clickable"
|
||||
(label :text {
|
||||
color_scheme == "light" ? "" : ""
|
||||
})
|
||||
))
|
||||
|
||||
(defwidget kb_layout []
|
||||
(button :onclick "niri msg action switch-layout next"
|
||||
:hexpand true
|
||||
@ -178,10 +192,18 @@
|
||||
(label :text current_minute)
|
||||
))
|
||||
|
||||
(defwidget lock []
|
||||
(button :orientation "v"
|
||||
:valign "end"
|
||||
:class "bigthingy clickable"
|
||||
:onclick "loginctl lock-session"
|
||||
(label :text "")
|
||||
))
|
||||
|
||||
(defwidget pwr []
|
||||
(button :orientation "v"
|
||||
:valign "end"
|
||||
:class "thingy pwrbtn clickable"
|
||||
:class "bigthingy clickable"
|
||||
:onclick "${EWW_CMD} open --toggle pwrctl"
|
||||
(label :text "⏻")
|
||||
))
|
||||
@ -216,3 +238,4 @@
|
||||
(defpoll bat_charge :interval "15s" "cat /sys/class/power_supply/BAT0/capacity")
|
||||
(defpoll bat_status :interval "15s" "cat /sys/class/power_supply/BAT0/status")
|
||||
(defpoll current_temp :interval "5s" "cat /sys/class/thermal/thermal_zone*/temp")
|
||||
(defpoll color_scheme :interval "5s" "get-color-scheme")
|
||||
|
||||
Reference in New Issue
Block a user