eww: Add color-scheme switch button
This commit is contained in:
@ -57,19 +57,20 @@ window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.thingy {
|
.thingy {
|
||||||
//border: solid $highlight1 2px;
|
padding-top: 8px;
|
||||||
//border-top: solid $highlight1 1px;
|
padding-bottom: 8px;
|
||||||
//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;
|
|
||||||
min-height: 20px;
|
min-height: 20px;
|
||||||
border-top: solid $highlight1 2px;
|
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 {
|
scale trough {
|
||||||
all: unset;
|
all: unset;
|
||||||
background-color: #22242b;
|
background-color: #22242b;
|
||||||
@ -176,6 +177,9 @@ scale trough {
|
|||||||
margin-top: -8px;
|
margin-top: -8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.color_scheme {
|
||||||
|
}
|
||||||
|
|
||||||
.pwrbtn {
|
.pwrbtn {
|
||||||
font-size: 35px;
|
font-size: 35px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
|
|||||||
@ -41,10 +41,11 @@
|
|||||||
(temperature)
|
(temperature)
|
||||||
(battery)
|
(battery)
|
||||||
(box :class "thingy" (systray :orientation "v"))
|
(box :class "thingy" (systray :orientation "v"))
|
||||||
|
(color_scheme)
|
||||||
(kb_layout)
|
(kb_layout)
|
||||||
(date)
|
(date)
|
||||||
(clock)
|
(clock)
|
||||||
(pwr)
|
(lock)
|
||||||
))
|
))
|
||||||
|
|
||||||
(defwidget workspaces [monitor]
|
(defwidget workspaces [monitor]
|
||||||
@ -152,6 +153,19 @@
|
|||||||
;(label :text "${bat_charge}%")
|
;(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 []
|
(defwidget kb_layout []
|
||||||
(button :onclick "niri msg action switch-layout next"
|
(button :onclick "niri msg action switch-layout next"
|
||||||
:hexpand true
|
:hexpand true
|
||||||
@ -178,10 +192,18 @@
|
|||||||
(label :text current_minute)
|
(label :text current_minute)
|
||||||
))
|
))
|
||||||
|
|
||||||
|
(defwidget lock []
|
||||||
|
(button :orientation "v"
|
||||||
|
:valign "end"
|
||||||
|
:class "bigthingy clickable"
|
||||||
|
:onclick "loginctl lock-session"
|
||||||
|
(label :text "")
|
||||||
|
))
|
||||||
|
|
||||||
(defwidget pwr []
|
(defwidget pwr []
|
||||||
(button :orientation "v"
|
(button :orientation "v"
|
||||||
:valign "end"
|
:valign "end"
|
||||||
:class "thingy pwrbtn clickable"
|
:class "bigthingy clickable"
|
||||||
:onclick "${EWW_CMD} open --toggle pwrctl"
|
:onclick "${EWW_CMD} open --toggle pwrctl"
|
||||||
(label :text "⏻")
|
(label :text "⏻")
|
||||||
))
|
))
|
||||||
@ -216,3 +238,4 @@
|
|||||||
(defpoll bat_charge :interval "15s" "cat /sys/class/power_supply/BAT0/capacity")
|
(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 bat_status :interval "15s" "cat /sys/class/power_supply/BAT0/status")
|
||||||
(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 color_scheme :interval "5s" "get-color-scheme")
|
||||||
|
|||||||
7
tree/.local/bin/get-color-scheme.tpl
Executable file
7
tree/.local/bin/get-color-scheme.tpl
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
{% if light %}
|
||||||
|
echo light
|
||||||
|
{% else %}
|
||||||
|
echo dark
|
||||||
|
{% end %}
|
||||||
21
tree/.local/bin/set-color-scheme
Executable file
21
tree/.local/bin/set-color-scheme
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/env fish
|
||||||
|
|
||||||
|
switch $argv[1]
|
||||||
|
case 'light'
|
||||||
|
# configure terminal stuff with light theme
|
||||||
|
dotfiles light
|
||||||
|
|
||||||
|
# change gtk theme
|
||||||
|
gsettings set org.gnome.desktop.interface color-scheme prefer-light
|
||||||
|
|
||||||
|
case 'dark'
|
||||||
|
# configure terminal stuff with dark theme
|
||||||
|
dotfiles
|
||||||
|
|
||||||
|
# change gtk theme
|
||||||
|
gsettings set org.gnome.desktop.interface color-scheme prefer-dark
|
||||||
|
|
||||||
|
case '*'
|
||||||
|
echo "usage: set-color-scheme <dark|light>"
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user