eww: Add color-scheme switch button

This commit is contained in:
2024-07-17 10:55:18 +02:00
parent b5babe522d
commit 972bcf003d
4 changed files with 66 additions and 11 deletions

View File

@ -57,19 +57,20 @@ window {
}
.thingy {
//border: solid $highlight1 2px;
//border-top: solid $highlight1 1px;
//border-bottom: solid $highlight2 3px;
//border-bottom: dotted $highlight1 6px;
//color: $highlight1;
//background: $lowlight1;
//border-radius: 30px;
padding-top: 0.5em;
padding-bottom: 0.5em;
padding-top: 8px;
padding-bottom: 8px;
min-height: 20px;
border-top: solid $highlight1 2px;
}
.bigthingy {
padding-top: 8px;
padding-bottom: 8px;
min-height: 20px;
border-top: solid $highlight1 2px;
font-size: 35px;
}
scale trough {
all: unset;
background-color: #22242b;
@ -176,6 +177,9 @@ scale trough {
margin-top: -8px;
}
.color_scheme {
}
.pwrbtn {
font-size: 35px;
font-weight: 400;

View File

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