From 29826a80818bb7ae05072d02a9d4c62fdd74a235 Mon Sep 17 00:00:00 2001 From: Ezri Brimhall Date: Fri, 8 Mar 2024 10:24:54 -0700 Subject: [PATCH] Repaired normandy config --- .config/eww/eww.scss | 59 ++++-- .config/eww/eww.yuck##hostname.normandy | 41 +--- .config/eww/modules/clock.yuck | 56 +++++ .../modules/network.yuck##hostname.normandy | 4 +- .config/eww/modules/system.yuck | 194 +++++++++++++++++- .../eww/scripts/network.py##hostname.normandy | 0 .config/eww/scripts/system.py | 24 +++ .config/eww/windows.yuck | 9 +- .config/sway/config | 6 + .../50-sidebar-gaps.conf##class.has-sidebar | 16 ++ .../sway/workspaces.json##hostname.normandy | 21 +- .config/systemd/user/eww.service | 1 - .../bar-launch.conf##hostname.normandy | 4 + .../bar-launch.conf##hostname.rocinante | 4 + .../bar-launch.conf##hostname.tycho | 4 + 15 files changed, 376 insertions(+), 67 deletions(-) mode change 100644 => 100755 .config/eww/scripts/network.py##hostname.normandy create mode 100644 .config/sway/local-config.d/50-sidebar-gaps.conf##class.has-sidebar create mode 100644 .config/systemd/user/eww.service.d/bar-launch.conf##hostname.normandy create mode 100644 .config/systemd/user/eww.service.d/bar-launch.conf##hostname.rocinante create mode 100644 .config/systemd/user/eww.service.d/bar-launch.conf##hostname.tycho diff --git a/.config/eww/eww.scss b/.config/eww/eww.scss index 6bebf27..f39a56b 100644 --- a/.config/eww/eww.scss +++ b/.config/eww/eww.scss @@ -28,29 +28,49 @@ background-color: $bg0; padding: 10px; } +} - .nebula { - font-family: "Nebula"; - font-size: 1.2em; - &.big, - .big { - font-size: 2em; - } - &.medium, - .medium { - font-size: 1.6em; - } - &.small, - .small { - font-size: 1.4em; - } +.nebula { + font-family: "Nebula"; + font-size: 1.2em; + &.big, + .big { + font-size: 2em; } + &.bigger, + .bigger { + font-size: 2.5em; + } + &.medium, + .medium { + font-size: 1.6em; + } + &.small, + .small { + font-size: 1.4em; + } +} + +.gauge { + color: $foreground; +} + +.gauge-hole { + color: $wallpaper; +} + +.gauge-gutter { + color: $bg0; } .icon { font-family: "Font Awesome 5 Free Solid"; } +.invisible { + color: $wallpaper; +} + .highlight { color: $red; } @@ -71,6 +91,10 @@ font-size: 12pt; } +.message-overlay { + background-color: $wallpaper; +} + // sway module .sway--ws { @@ -97,6 +121,11 @@ background-color: $red; } +.big .normal, +.bigger .normal { + font-size: 1rem; +} + // clock module .clock--time { diff --git a/.config/eww/eww.yuck##hostname.normandy b/.config/eww/eww.yuck##hostname.normandy index 1896653..be1188f 100644 --- a/.config/eww/eww.yuck##hostname.normandy +++ b/.config/eww/eww.yuck##hostname.normandy @@ -11,7 +11,7 @@ (include "./windows.yuck") (defwindow leftbar - :monitor 0 + :monitor 1 :geometry (geometry :width "100%" :height "36px" :anchor "top center") @@ -21,11 +21,11 @@ (centerbox :orientation "h" :class "bar root" (normandy-leftbar--left) - (normandy-leftbar--center) + "" ;;(normandy-leftbar--center) (normandy-leftbar--right))) (defwindow rightbar - :monitor 1 + :monitor 0 :geometry (geometry :width "100%" :height "26px" :anchor "top center") @@ -35,37 +35,16 @@ (centerbox :orientation "h" :class "bar root" (normandy-rightbar--left) - (normandy-rightbar--center) + "" ;;(normandy-rightbar--center) (normandy-rightbar--right))) -(defwindow network-status - :monitor 0 - :geometry (geometry :width "200px" - :height "0px" - :x "80px" - :y "0px" - :anchor "top left") - :exclusive false - :focusable false - :stacking "overlay" - (box :orientation "v" - :class "bar root bg" - :visible {network--show-details} - (network-detail))) - -(defwindow network-status - :monitor 0 - :geometry (geometry :width "200px" - :height "0px" - :x "80px" - :y "0px" - :anchor "top left") +(defwindow sidebar + :monitor 1 + :geometry (geometry :width "210px" + :height "1044px" + :anchor "left bottom") :exclusive true :focusable false :stacking "fg" - (box :orientation "v" - :class "bar root bg" - :visible {network--show-details} - (network-detail))) - + (normandy-sidebar)) diff --git a/.config/eww/modules/clock.yuck b/.config/eww/modules/clock.yuck index 20f96b3..ad14c7a 100644 --- a/.config/eww/modules/clock.yuck +++ b/.config/eww/modules/clock.yuck @@ -2,6 +2,8 @@ (defpoll clock--data :interval "500ms" `date +'{"hour": "%H", "minute": "%M", "second": "%S", "year": "%Y", "day": "%d", "month": "%m", "dow": "%A", "month_name": "%B", "unix": %s}'`) +(defvar clock--show "clock") + (defwidget clock [] (box :class "module text" :spacing 0 @@ -9,3 +11,57 @@ (label :class "special" :text "${clock--data.hour}:${clock--data.minute}:${clock--data.second}") (label :text "${clock--data.year}-${clock--data.month}-${clock--data.day}"))) +(defwidget sideclock [] + (button :onclick "echo -n $(date +%Y-%d-%m) | wl-copy" + :onrightclick "echo -n $(date +%s) | wl-copy && eww update clock--show=unixtime && sleep 2 && eww update clock--show=clock" + (overlay + (box :class "module text nebula" + :spacing 0 + :space-evenly false + :orientation "v" + (centerbox :class "bigger nebula" + :space-evenly false + :width 150 + :halign "center" + :orientation "h" + (box :halign "start" "${clock--data.hour}") + (box :halign "center" ":") + (box :halign "end" "${clock--data.minute}")) + (label :text "${clock--data.dow}" + :class "special") + (label :text "${clock--data.month_name} ${clock--data.day}")) + (box + :height 100 + (revealer :transition "crossfade" + :reveal {clock--show == "unixtime"} + :duration {clock--show == "unixtime" ? "2s" : "500ms"} + (box :width 200 + :height 50 + :class "message-overlay nebula special" + (box + :space-evenly false + :spacing 0 + :halign "center" + :valign "center" + :orientation "v" + "Copied UNIX" + "timestamp" + )))) + (box + :height 100 + (revealer :transition "crossfade" + :reveal {clock--show == "date"} + :duration {clock--show == "date" ? "2s" : "500ms"} + (box :width 200 + :height 50 + :class "message-overlay nebula special" + (box + :space-evenly false + :spacing 0 + :halign "center" + :valign "center" + :orientation "v" + "Copied" + "current date" + + ))))))) diff --git a/.config/eww/modules/network.yuck##hostname.normandy b/.config/eww/modules/network.yuck##hostname.normandy index cf95775..a9d13f1 100644 --- a/.config/eww/modules/network.yuck##hostname.normandy +++ b/.config/eww/modules/network.yuck##hostname.normandy @@ -1,5 +1,5 @@ (deflisten network--data - `~/.config/eww/modules/network/network.py`) + `~/.config/eww/scripts/network.py`) (defwidget network--wlan [device] (box :orientation "h" @@ -83,7 +83,7 @@ (network--proxy-vpn :device "wg-mullvad" :required {!network--data.trusted})) "communications")) -(defwidget network-details [] +(defwidget network-sidebar-details [] (box :orientation "v" :halign "start" :class "module" diff --git a/.config/eww/modules/system.yuck b/.config/eww/modules/system.yuck index 070e594..151d2a5 100644 --- a/.config/eww/modules/system.yuck +++ b/.config/eww/modules/system.yuck @@ -56,5 +56,195 @@ :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] + (overlay :width 80 + :height 80 + (circular-progress :value 75 + :class "gauge-gutter" + :start-at 37.5 + :thickness 2) + (circular-progress :value {value * 0.75} + :class 'gauge ${value > (threshold ?: 80) ? "highlight" : ""}' + :start-at 37.5 + :thickness 2))) + +(defwidget cpu-mem-gauges [] + (box :orientation "v" + :space-evenly false + :spacing 20 + :width 95 + :halign "start" + (system--cpu-gauge) + (system--gpu-gauge))) + +(defwidget gpu-gauges [] + (box :orientation "v" + :space-evenly false + :spacing 20 + :width 95 + :halign "end" + (system--memory-gauge) + (system--vram-gauge))) + + +(defwidget system-gauges [] + (box :orientation "h" + :space-evenly false + :width 200 + :halign "start" + :spacing 10 + (cpu-mem-gauges) + (gpu-gauges))) + +(defwidget system--memory-gauge [] + (box :orientation "v" + :halign "end" + :width 95 + :space-evenly false + :spacing 10 + :class "nebula" + (label :text "RAM" + :class "medium special") + (box :halign "center" + (overlay + (system--gauge :value {system--data.memory.percent}) + (transform + :translate-y "-2px" + (box :halign "center" + :valign "center" + :orientation "h" + :space-evenly false + (label :text "%" + :class "invisible") + (label :text {round(system--data.memory.percent, 0)} + :class "medium special") + (transform + :translate-y "3px" + (label :text "%" + :class "offline")))))))) + +(defwidget system--cpu-gauge [] + (box :orientation "v" + :halign "start" + :width 95 + :space-evenly false + :spacing 10 + :class "nebula" + (label :text "CPU" + :class "medium special") + (box :halign "center" + (overlay + (system--gauge :value {system--data.cpu.avg}) + (transform + :translate-y "-2px" + (box :halign "center" + :valign "center" + :orientation "h" + :space-evenly false + (label :text "%" + :class "invisible") + (label :text {system--data.cpu.avg_display} + :class "medium special") + (transform + :translate-y "3px" + (label :text "%" + :class "offline")))))) + )) + +(defwidget system--gpu-gauge [] + (box :orientation "v" + :halign "start" + :width 95 + :space-evenly false + :spacing 10 + :class "nebula" + (label :text "GPU" + :class "medium special") + (box :halign "center" + (overlay + (system--gauge :value {system--data.gpu.load * 100}) + (transform + :translate-y "-2px" + (box :halign "center" + :valign "center" + :orientation "h" + :space-evenly false + (label :text "%" + :class "invisible") + (label :text {round(system--data.gpu.load * 100, 0)} + :class "medium special") + (transform + :translate-y "3px" + (label :text "%" + :class "offline")))))))) + +(defwidget system--vram-gauge [] + (box :orientation "v" + :halign "start" + :width 95 + :space-evenly false + :spacing 10 + :class "nebula" + (label :text "VRAM" + :class "medium special") + (box :halign "center" + (overlay + (system--gauge :value {system--data.gpu.memory * 100}) + (transform + :translate-y "-2px" + (box :halign "center" + :valign "center" + :orientation "h" + :space-evenly false + (label :text "%" + :class "invisible") + (label :text {round(system--data.gpu.memory * 100, 0)} + :class "medium special") + (transform + :translate-y "3px" + (label :text "%" + :class "offline")))))))) + + +(defwidget system--gauge-generic [value value-fmt big-text little-text ?subscript ?threshold] + (box :orientation "h" + :halign "start" + :class "module gauge-widget" + :space-evenly true + :spacing 0 + (overlay :width 100 + (circular-progress :value 100 + :class "gauge-hole" + :start-at 0 + :thickness 50 + ) + (circular-progress :value 80 + :class "gauge-gutter" + :start-at 35 + :thickness 2) + (circular-progress :value {value * 0.8} + :class 'gauge ${value > (threshold ?: 80) ? "highlight" : ""}' + :start-at 35 + :thickness 2) + (transform :translate-y "-5px" + :translate-x "3px" + (box :halign "center" + :valign "center" + :class "big nebula" + :space-evenly false + "${value-fmt}" + (box :class "normal offline" + :halign "start" + :valign "end" + (transform :translate-y "-2px" + :translate-x "1px" + {subscript}))))) + (transform :translate-y "-5px" + (box :orientation "v" + :halign "center" + :valign "center" + :space-evenly false + (label :text {big-text} + :class "big nebula") + (label :text {little-text} + :class "nebula special"))))) diff --git a/.config/eww/scripts/network.py##hostname.normandy b/.config/eww/scripts/network.py##hostname.normandy old mode 100644 new mode 100755 diff --git a/.config/eww/scripts/system.py b/.config/eww/scripts/system.py index e2a7e2d..71c2834 100755 --- a/.config/eww/scripts/system.py +++ b/.config/eww/scripts/system.py @@ -7,6 +7,13 @@ import subprocess import os from dotenv import dotenv_values +amdgpuinfo_installed = False +# Try to import GPU info +try: + import pyamdgpuinfo as gpuinfo + amdgpuinfo_installed = True +except: + pass def cpu(): util = psutil.cpu_percent(percpu=False) @@ -19,6 +26,22 @@ def cpu(): "core_count": len(per_core), } +def gpu(): + if not amdgpuinfo_installed or gpuinfo.detect_gpus() <= 0: + return { + "available": False, + "load": 0, + "power_state": 0, + "memory": 0 + } + gpu = gpuinfo.get_gpu(0) + return { + "available": True, + "load": gpu.query_load(), + "power_state": gpu.query_power(), + "memory": gpu.query_vram_usage() / gpu.memory_info['vram_size'] + } + def sensor(chip: str): return { @@ -73,6 +96,7 @@ while True: result = { "cpu": cpu(), + "gpu": gpu(), "sensors": {chip: sensor(chip) for chip in sensor_list}, "memory": memory(), "swap": swap(), diff --git a/.config/eww/windows.yuck b/.config/eww/windows.yuck index ad5e3ef..2acf80e 100644 --- a/.config/eww/windows.yuck +++ b/.config/eww/windows.yuck @@ -64,8 +64,8 @@ :space-evenly false :spacing 20 :class "leftbox" - (sway-workspace :group "right") - (sway-workspaces :group "right"))) + (sway-workspaces :group "right") + (sway-workspace :group "right"))) (defwidget normandy-rightbar--right [] (box :orientation "h" @@ -80,11 +80,10 @@ :valign "start" :space-evenly false :spacing 20 - :class "sidebar" + :class "root side" (sideclock) (network-sidebar-details) - (cpu-mem-gauges) - (gpu-gauges))) + (system-gauges))) ;;; ;;; diff --git a/.config/sway/config b/.config/sway/config index 8afe4e1..0194fc0 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -105,6 +105,12 @@ bindsym { ## Close focused window bindsym $mod+Shift+q kill +## Floating and Fullscreen +bindsym $mod+Space focus mode_toggle +bindsym $mod+Shift+Space floating toggle +bindsym $mod+$alt+f fullscreen toggle +bindsym $mod+$alt+Shift+f fullscreen global + ### ### # Style Configuration # ### ### diff --git a/.config/sway/local-config.d/50-sidebar-gaps.conf##class.has-sidebar b/.config/sway/local-config.d/50-sidebar-gaps.conf##class.has-sidebar new file mode 100644 index 0000000..e34bd83 --- /dev/null +++ b/.config/sway/local-config.d/50-sidebar-gaps.conf##class.has-sidebar @@ -0,0 +1,16 @@ +#### -*-conf-space-*- #### +## Sidebar Gaps Config ## +#### #### + +workspace { + 1 gaps left 210 + 2 gaps left 210 + 3 gaps left 210 + 4 gaps left 210 + 5 gaps left 210 + 6 gaps left 210 + 7 gaps left 210 + 8 gaps left 210 + 9 gaps left 210 + 10 gaps left 210 +} diff --git a/.config/sway/workspaces.json##hostname.normandy b/.config/sway/workspaces.json##hostname.normandy index 83f78f6..70a95ab 100644 --- a/.config/sway/workspaces.json##hostname.normandy +++ b/.config/sway/workspaces.json##hostname.normandy @@ -13,7 +13,7 @@ }, { "index": 3, - "name": "web", + "name": "internet", "exec": "firefox --new-window" }, { @@ -23,8 +23,8 @@ }, { "index": 5, - "name": "images", - "exec": "dolphin" + "name": "VM management", + "exec": "virt-manager" }, { "index": 6, @@ -34,13 +34,12 @@ { "index": 7, "name": "music", - "exec": "spotify" + "exec": "feishin" }, { "index": 8, "name": "discord", - "exec": "discord", - "systemd": false + "exec": "discord" }, { "index": 9, @@ -66,7 +65,7 @@ }, { "index": 13, - "name": "web", + "name": "internet", "exec": "firefox --new-window" }, { @@ -77,17 +76,17 @@ { "index": 15, "name": "minecraft", - "exec": "polymc" + "exec": "prism-launcher" }, { "index": 16, - "name": "virtual machines", - "exec": "virt-manager" + "name": "images", + "exec": "gimp" }, { "index": 17, "name": "video", - "exec": "vlc" + "exec": "jellyfinmediaplayer" }, { "index": 18, diff --git a/.config/systemd/user/eww.service b/.config/systemd/user/eww.service index f36ed9f..5da995d 100644 --- a/.config/systemd/user/eww.service +++ b/.config/systemd/user/eww.service @@ -5,7 +5,6 @@ PartOf=sway-session.target [Service] Type=simple ExecStart=eww daemon --no-daemonize -ExecStartPost=eww open-many leftbar rightbar network-status ExecReload=eww reload Slice=session.slice MemoryAccounting=yes diff --git a/.config/systemd/user/eww.service.d/bar-launch.conf##hostname.normandy b/.config/systemd/user/eww.service.d/bar-launch.conf##hostname.normandy new file mode 100644 index 0000000..da9fb01 --- /dev/null +++ b/.config/systemd/user/eww.service.d/bar-launch.conf##hostname.normandy @@ -0,0 +1,4 @@ +# -*-conf-unix-*- + +[Service] +ExecStartPost=eww open-many leftbar rightbar sidebar diff --git a/.config/systemd/user/eww.service.d/bar-launch.conf##hostname.rocinante b/.config/systemd/user/eww.service.d/bar-launch.conf##hostname.rocinante new file mode 100644 index 0000000..f57e9d6 --- /dev/null +++ b/.config/systemd/user/eww.service.d/bar-launch.conf##hostname.rocinante @@ -0,0 +1,4 @@ +# -*-conf-unix-*- + +[Service] +ExecStartPost=eww open-many builtinbar diff --git a/.config/systemd/user/eww.service.d/bar-launch.conf##hostname.tycho b/.config/systemd/user/eww.service.d/bar-launch.conf##hostname.tycho new file mode 100644 index 0000000..5a2f977 --- /dev/null +++ b/.config/systemd/user/eww.service.d/bar-launch.conf##hostname.tycho @@ -0,0 +1,4 @@ +# -*-conf-unix-*- + +[Service] +ExecStartPost=eww open-many leftbar rightbar network-status