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: 10px;
margin-top: 20px; margin-top: 20px;
margin-right: 0px; margin-right: 0px;
padding-bottom: 26px;
} }
&.right-side { &.right-side {
margin: 10px; margin: 10px;
margin-top: 20px; margin-top: 20px;
margin-left: 0px; margin-left: 0px;
padding-bottom: 26px;
} }
&.bg { &.bg {
@ -108,6 +110,10 @@
// sway module // sway module
.sway--root.sway--vertical {
padding-top: 20px;
}
.sway--ws { .sway--ws {
color: $bg1; color: $bg1;

View File

@ -60,23 +60,6 @@
:stacking "fg" :stacking "fg"
(sidebar :orientation {side})) (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] (defwindow laptopbar [group battery]
:geometry (geometry :width "100%" :geometry (geometry :width "100%"
@ -87,7 +70,21 @@
:stacking "fg" :stacking "fg"
(centerbox :orientation "h" (centerbox :orientation "h"
:class "bar root" :class "bar root"
(ws-group-leftalign :workspace-group {group}) (box :orientation "h"
:halign "start"
(sway-workspace :group {group}))
(hostname-centeralign) (hostname-centeralign)
(laptop-details-rightalign :battery {battery} ))) (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}%") :text "${EWW_BATTERY[battery].capacity}%")
(label :text "${EWW_BATTERY[battery].status == 'Charging' || EWW_BATTERY[battery].status == 'Full' ? 'external' : 'internal'} power"))) (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 [] (defwidget system-name []
(label :halign "center" (label :halign "center"
:valign "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") :text "${round(system--data.memory.used / 1024 / 1024 / 1024, 2)} / ${round(system--data.memory.total / 1024 / 1024 / 1024, 2)} GiB")
(label :text "system memory"))) (label :text "system memory")))
(defwidget system--gauge [value ?threshold] (defwidget system--gauge [value ?threshold ?green]
(overlay :width 80 (overlay :width 80
:height 80 :height 80
(circular-progress :value 75 (circular-progress :value 75
@ -68,6 +84,18 @@
:start-at 37.5 :start-at 37.5
:thickness 2))) :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 [] (defwidget cpu-mem-gauges []
(box :orientation "v" (box :orientation "v"
:space-evenly false :space-evenly false
@ -121,7 +149,22 @@
(transform (transform
:translate-y "3px" :translate-y "3px"
(label :text "%" (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 [] (defwidget system--cpu-gauge []
(box :orientation "v" (box :orientation "v"
@ -151,6 +194,20 @@
:class "offline")))))) :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 [] (defwidget system--gpu-gauge []
(box :orientation "v" (box :orientation "v"
:halign "start" :halign "start"
@ -176,7 +233,20 @@
(transform (transform
:translate-y "3px" :translate-y "3px"
(label :text "%" (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 [] (defwidget system--vram-gauge []
(box :orientation "v" (box :orientation "v"
@ -203,7 +273,20 @@
(transform (transform
:translate-y "3px" :translate-y "3px"
(label :text "%" (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] (defwidget system--gauge-generic [value value-fmt big-text little-text ?subscript ?threshold]
@ -247,4 +330,5 @@
(label :text {big-text} (label :text {big-text}
:class "big nebula") :class "big nebula")
(label :text {little-text} (label :text {little-text}
:class "nebula special"))))) :class "nebula special")))))

View File

@ -28,6 +28,36 @@
:text "${volume--data.input.volume}%")) :text "${volume--data.input.volume}%"))
"audio system")) "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] (defwidget volume--gauge [io]
(box :orientation "v" (box :orientation "v"
:halign {io == "in" ? "start" : "end"} :halign {io == "in" ? "start" : "end"}
@ -62,6 +92,19 @@
:class "offline")) :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 [] (defwidget volume-gauges []
(box :orientation "v" (box :orientation "v"
:space-evenly false :space-evenly false

View File

@ -12,6 +12,7 @@
:start-at 0 :start-at 0
:clockwise true :clockwise true
:width 16 :width 16
:height 16
:thickness 1 :thickness 1
(box :class 'fill' )))) (box :class 'fill' ))))
@ -68,6 +69,17 @@
(for workspace in {sway--data.ws[sway--data.context ?: "personal"][group]} (for workspace in {sway--data.ws[sway--data.context ?: "personal"][group]}
(sway--workspace :ws workspace)))) (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] (defwidget hypr-workspaces [group]
(box :orientation "h" (box :orientation "h"
:halign "start" :halign "start"

View File

@ -17,6 +17,23 @@
(system-gauges) (system-gauges)
(volume-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] (defwidget ws-group-rightalign [workspace-group]
(box :orientation "h" (box :orientation "h"
:halign "end" :halign "end"