feat: eww temperature monitoring
This commit is contained in:
parent
9b2bd7ad99
commit
07aef5a19b
|
@ -34,12 +34,27 @@ $memory_bg: #333333;
|
|||
// previously bluetooth colour
|
||||
$memory: #caa9c7;
|
||||
//$memory: #88bbeb;
|
||||
$temperature: #ddb6f2;
|
||||
$temperature_critical: #ff6666;
|
||||
$battery: #b6b2b3;
|
||||
$temperature-bg: rgba(180, 180, 180, 0.5);
|
||||
$temperature: #b6b2b3;
|
||||
$temperature-critical: #ff6666;
|
||||
$battery: #ddb6f2;
|
||||
|
||||
|
||||
// Styles all scales
|
||||
progressbar trough {
|
||||
all: unset;
|
||||
background-color: #333333;
|
||||
border-radius: 5px;
|
||||
min-height: 80px;
|
||||
min-width: 2px;
|
||||
//margin: .3rem 0 .3rem 0;
|
||||
}
|
||||
trough progress {
|
||||
all: unset;
|
||||
background-color: #00ff00;
|
||||
border-radius: 5px;
|
||||
min-width: 2px;
|
||||
}
|
||||
scale trough {
|
||||
all: unset;
|
||||
background-color: #333333;
|
||||
|
@ -181,6 +196,22 @@ box .weather {
|
|||
}
|
||||
}
|
||||
|
||||
box .temperature {
|
||||
color: $temperature;
|
||||
border-left: 2px solid $temperature-bg;
|
||||
margin-bottom: 1px;
|
||||
margin-top: 1px;
|
||||
}
|
||||
.temperature-progress trough progress {
|
||||
background-color: $temperature;
|
||||
}
|
||||
.temperature-progress-cpu trough progress {
|
||||
background-color: mix($cpu, $temperature, 50%);
|
||||
}
|
||||
.temperature-progress-critical trough progress {
|
||||
background-color: $temperature-critical;
|
||||
}
|
||||
|
||||
box .cpu {
|
||||
.progress {
|
||||
background-color: $cpu_bg;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
(defvar amixer "amixer -D pulse")
|
||||
(defvar temperature-monitor "psensor")
|
||||
|
||||
(defwindow vbar
|
||||
:exclusive true
|
||||
|
@ -14,9 +15,12 @@
|
|||
:reserve (struts :side "left" :distance "20px")
|
||||
(centerbox
|
||||
:orientation "v"
|
||||
(box :orientation "v" :space-evenly false :valign "start"
|
||||
(box
|
||||
:orientation "v" :space-evenly false :valign "start"
|
||||
(label
|
||||
:class "launcher" :valign "start" :width "20px" :height "20px"
|
||||
:class "launcher"
|
||||
:valign "start"
|
||||
:width "20px" :height "20px"
|
||||
:unindent true
|
||||
:tooltip active-window-title
|
||||
:text "☯")
|
||||
|
@ -29,7 +33,7 @@
|
|||
(widget-tray)
|
||||
(widget-volume)
|
||||
(widget-microphone)
|
||||
;(widget-temperature)
|
||||
(widget-temperature)
|
||||
(widget-cpu)
|
||||
(widget-memory)
|
||||
(widget-clock)
|
||||
|
@ -41,7 +45,8 @@
|
|||
:class "workspaces"
|
||||
:orientation "v"
|
||||
:space-evenly true
|
||||
:valign "start" :spacing 10
|
||||
:spacing 10
|
||||
:valign "start"
|
||||
:halign "center"
|
||||
(for workspace in workspaces
|
||||
(button
|
||||
|
@ -61,6 +66,7 @@
|
|||
:orientation "v"
|
||||
:space-evenly false
|
||||
:valign "center"
|
||||
:tooltip {media-position-text}
|
||||
(eventbox
|
||||
:onclick "playerctl play-pause"
|
||||
(circular-progress
|
||||
|
@ -68,7 +74,6 @@
|
|||
:width 20
|
||||
:height 20
|
||||
:thickness 5
|
||||
:tooltip {media-position-text}
|
||||
:value {100.0 * media-position / (media-length / 1000000.0)}
|
||||
:visible {media-current != "" && media-length != 1}
|
||||
))
|
||||
|
@ -155,14 +160,38 @@
|
|||
(defvar show-volume false)
|
||||
(defvar show-microphone false)
|
||||
|
||||
; FIXME: Maybe use a env var here instead
|
||||
(defvar cpu-temp-key "ASUS_WMI_SENSORS_CPU_TEMPERATURE")
|
||||
(defvar gpu-temp-key "AMDGPU_MEM")
|
||||
(defvar temperature-threshold 80)
|
||||
|
||||
(defwidget widget-temperature []
|
||||
(label
|
||||
(eventbox
|
||||
:onclick temperature-monitor
|
||||
(box
|
||||
:class "temperature"
|
||||
:orientation "h"
|
||||
:tooltip "CPU ${EWW_TEMPS[cpu-temp-key]}C; GPU ${EWW_TEMPS[gpu-temp-key]}C"
|
||||
:space-evenly true
|
||||
:width 20
|
||||
:height 20
|
||||
:tooltip {EWW_TEMPS}
|
||||
:text ""
|
||||
))
|
||||
:halign "" :valign "center"
|
||||
(progress
|
||||
:class { EWW_TEMPS[cpu-temp-key] > temperature-threshold ? "temperature-progress-critical" : "temperature-progress-cpu" }
|
||||
:halign "center" :valign "center"
|
||||
:flipped "true"
|
||||
:width 3
|
||||
:orientation "v"
|
||||
:value {EWW_TEMPS[cpu-temp-key]}
|
||||
)
|
||||
(progress
|
||||
:class { EWW_TEMPS[gpu-temp-key] > temperature-threshold ? "temperature-progress-critical" : "temperature-progress" }
|
||||
:halign "center" :valign "center"
|
||||
:flipped "true"
|
||||
:width 3
|
||||
:orientation "v"
|
||||
:value {EWW_TEMPS[gpu-temp-key]}
|
||||
)
|
||||
)))
|
||||
(defwidget widget-cpu []
|
||||
(box
|
||||
:class "cpu"
|
||||
|
@ -205,9 +234,11 @@
|
|||
:width 20
|
||||
:tooltip {formattime(EWW_TIME, "%F (%a) %T [%Z]")}
|
||||
;(box :class "icon" "")
|
||||
"${clock.m}" "${clock.d}"
|
||||
(box :class "icon" "")
|
||||
"${clock.H}" "${clock.M}"
|
||||
(label :text "${clock.m}")
|
||||
(label :text "${clock.d}")
|
||||
(label :class "icon" :text "")
|
||||
(label :text "${clock.H}")
|
||||
(label :text "${clock.M}")
|
||||
))
|
||||
|
||||
(defpoll clock :initial "{}" :interval "10s"
|
||||
|
|
Loading…
Reference in New Issue