eww: Add color-scheme switch button
This commit is contained in:
@ -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;
|
||||
|
||||
@ -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")
|
||||
|
||||
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