Added mini-sidebar for laptop screens

This commit is contained in:
Ezri 2025-03-13 09:32:37 -06:00
parent 66d886c4e6
commit 9320af98a3
Signed by: ezri
GPG Key ID: 058A78E5680C6F24
6 changed files with 182 additions and 23 deletions

View File

@ -23,12 +23,14 @@
margin: 10px;
margin-top: 20px;
margin-right: 0px;
padding-bottom: 26px;
}
&.right-side {
margin: 10px;
margin-top: 20px;
margin-left: 0px;
padding-bottom: 26px;
}
&.bg {
@ -108,6 +110,10 @@
// sway module
.sway--root.sway--vertical {
padding-top: 20px;
}
.sway--ws {
color: $bg1;

View File

@ -61,23 +61,6 @@
(sidebar :orientation {side}))
;; (defwindow network-status
;; :monitor 0
;; :geometry (geometry :width "200px"
;; :height "0px"
;; :x "300px"
;; :y "0px"
;; :anchor "top right")
;; :exclusive false
;; :focusable false
;; :stacking "overlay"
;; (box :orientation "v"
;; :class "bar root bg outline"
;; :visible {network--show-details}
;; (network-detail)))
(defwindow laptopbar [group battery]
:geometry (geometry :width "100%"
:height "36px"
@ -87,7 +70,21 @@
:stacking "fg"
(centerbox :orientation "h"
:class "bar root"
(ws-group-leftalign :workspace-group {group})
(box :orientation "h"
:halign "start"
(sway-workspace :group {group}))
(hostname-centeralign)
(laptop-details-rightalign :battery {battery} )))
(defwindow laptopsidebar [group battery side]
:geometry (geometry :width "35px"
:height "100%"
:anchor "${side} center")
:exclusive true
:focusable false
:stacking "fg"
(small-sidebar :orientation {side}
:battery {battery}
:workspace-group {group}))

View File

@ -12,6 +12,22 @@
:text "${EWW_BATTERY[battery].capacity}%")
(label :text "${EWW_BATTERY[battery].status == 'Charging' || EWW_BATTERY[battery].status == 'Full' ? 'external' : 'internal'} power")))
(defwidget system-battery-gauge-small [battery]
(box :orientation "v"
:halign "center"
:width 35
:space-evenly false
:spacing 10
:class "nebula"
(label :text "PWR"
:class "special")
(box :halign "center"
(overlay
(system--small-gauge :value {EWW_BATTERY[battery].capacity}
:threshold 25
:invert-threshold true
:green {EWW_BATTERY[battery].status == "Charging" || EWW_BATTERY[battery].capacity == 100})))))
(defwidget system-name []
(label :halign "center"
:valign "center"
@ -56,7 +72,7 @@
:text "${round(system--data.memory.used / 1024 / 1024 / 1024, 2)} / ${round(system--data.memory.total / 1024 / 1024 / 1024, 2)} GiB")
(label :text "system memory")))
(defwidget system--gauge [value ?threshold]
(defwidget system--gauge [value ?threshold ?green]
(overlay :width 80
:height 80
(circular-progress :value 75
@ -68,6 +84,18 @@
:start-at 37.5
:thickness 2)))
(defwidget system--small-gauge [value ?threshold ?green ?invert-threshold]
(overlay :width 30
:height 30
(circular-progress :value 75
:class "gauge-gutter"
:start-at 37.5
:thickness 2)
(circular-progress :value {value * 0.75}
:class 'gauge ${((invert-threshold ?: false) ? (value < (threshold ?: 20)) : (value > (threshold ?: 80))) ? "highlight" : ((green ?: false) ? "green" : "")}'
:start-at 37.5
:thickness 2)))
(defwidget cpu-mem-gauges []
(box :orientation "v"
:space-evenly false
@ -121,7 +149,22 @@
(transform
:translate-y "3px"
(label :text "%"
:class "offline"))))))))
:class "offline"))))))))
(defwidget system--memory-gauge-small []
(box :orientation "v"
:halign "center"
:width 35
:space-evenly false
:spacing 10
:class "nebula"
(label :text "MEM"
:class "special")
(box :halign "center"
(overlay
(system--small-gauge :value {system--data.memory.percent})))))
(defwidget system--cpu-gauge []
(box :orientation "v"
@ -151,6 +194,20 @@
:class "offline"))))))
))
(defwidget system--cpu-gauge-small []
(box :orientation "v"
:halign "center"
:width 35
:space-evenly false
:spacing 10
:class "nebula"
(label :text "CPU"
:class "special")
(box :halign "center"
(overlay
(system--small-gauge :value {system--data.cpu.avg}
:threshold 80)))))
(defwidget system--gpu-gauge []
(box :orientation "v"
:halign "start"
@ -176,7 +233,20 @@
(transform
:translate-y "3px"
(label :text "%"
:class "offline"))))))))
:class "offline"))))))))
(defwidget system--gpu-gauge-small []
(box :orientation "v"
:halign "center"
:width 35
:space-evenly false
:spacing 10
:class "nebula"
(label :text "GPU"
:class "special")
(box :halign "center"
(overlay
(system--small-gauge :value {system--data.gpu.load * 100})))))
(defwidget system--vram-gauge []
(box :orientation "v"
@ -203,7 +273,20 @@
(transform
:translate-y "3px"
(label :text "%"
:class "offline"))))))))
:class "offline"))))))))
(defwidget system--vram-gauge-small []
(box :orientation "v"
:halign "center"
:width 35
:space-evenly false
:spacing 10
:class "nebula"
(label :text "VRM"
:class "special")
(box :halign "center"
(overlay
(system--small-gauge :value {system--data.gpu.memory * 100})))))
(defwidget system--gauge-generic [value value-fmt big-text little-text ?subscript ?threshold]
@ -248,3 +331,4 @@
:class "big nebula")
(label :text {little-text}
:class "nebula special")))))

View File

@ -28,6 +28,36 @@
:text "${volume--data.input.volume}%"))
"audio system"))
(defwidget volume-small-gauge []
(box :orientation "v"
:halign "center"
:width 35
:space-evenly false
:spacing 10
:class "nebula"
(label :text "aud"
:class "special")
(overlay :width 30
:height 30
(circular-progress :value {75 / 2.05}
:class "gauge-gutter"
:start-at 37.5
:thickness 2)
(circular-progress :value {75 / 2.05}
:class "gauge-gutter"
:start-at 12.5
:clockwise false
:thickness 2)
(circular-progress :value {volume--data.output.mute ? 0 : min(volume--data.output.volume * 0.75 / 2.05, 75 / 2.05)}
:class 'gauge ${volume--data.output.mute ? "green" : volume--data.output.volume > 100 ? "highlight" : ""}'
:start-at 37.5
:thickness 2)
(circular-progress :value {volume--data.input.mute ? 0 : min(volume--data.input.volume * 0.75 / 2.05, 75 / 2.05)}
:class 'gauge ${volume--data.input.mute ? "green" : volume--data.input.volume > 100 ? "highlight" : ""}'
:start-at 12.5
:clockwise false
:thickness 2))))
(defwidget volume--gauge [io]
(box :orientation "v"
:halign {io == "in" ? "start" : "end"}
@ -62,6 +92,19 @@
:class "offline"))
))))))
(defwidget volume--gauge-small [io]
(box :orientation "v"
:halign "center"
:width 35
:space-evenly false
:spacing 10
:class "nebula"
(label :text "CPU"
:class "special")
(box :halign "center"
(overlay
(system--small-gauge :value {system--data.gpu.load * 100})))))
(defwidget volume-gauges []
(box :orientation "v"
:space-evenly false

View File

@ -12,6 +12,7 @@
:start-at 0
:clockwise true
:width 16
:height 16
:thickness 1
(box :class 'fill' ))))
@ -68,6 +69,17 @@
(for workspace in {sway--data.ws[sway--data.context ?: "personal"][group]}
(sway--workspace :ws workspace))))
(defwidget sway-workspaces-vertical [group]
(box :orientation "v"
:valign "start"
:halign "center"
:visible {sway--data != ''}
:space-evenly false
:spacing 5
:class "sway--root sway--vertical"
(for workspace in {sway--data.ws[sway--data.context ?: "personal"][group]}
(sway--workspace :ws workspace))))
(defwidget hypr-workspaces [group]
(box :orientation "h"
:halign "start"

View File

@ -17,6 +17,23 @@
(system-gauges)
(volume-gauges)))
(defwidget small-sidebar [orientation battery workspace-group]
(centerbox :orientation "v"
:class "root ${orientation}-side"
(sway-workspaces-vertical :group {workspace-group})
""
(box :orientation "v"
:valign "end"
:space-evenly false
:spacing 10
(system--cpu-gauge-small)
(system--memory-gauge-small)
(system--gpu-gauge-small)
(system--vram-gauge-small)
(volume-small-gauge)
(system-battery-gauge-small :battery {battery}))))
(defwidget ws-group-rightalign [workspace-group]
(box :orientation "h"
:halign "end"