Repaired normandy config

This commit is contained in:
Ezri Brimhall 2024-03-08 10:24:54 -07:00
parent fc50f6ca1c
commit 29826a8081
Signed by: ezri
GPG Key ID: 41520EAF66DF5A25
15 changed files with 376 additions and 67 deletions

View File

@ -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 {

View File

@ -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))

View File

@ -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"
)))))))

View File

@ -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"

View File

@ -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")))))

0
.config/eww/scripts/network.py##hostname.normandy Normal file → Executable file
View File

View File

@ -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(),

View File

@ -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)))
;;; ;;;

View File

@ -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 #
### ###

View File

@ -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
}

View File

@ -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,

View File

@ -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

View File

@ -0,0 +1,4 @@
# -*-conf-unix-*-
[Service]
ExecStartPost=eww open-many leftbar rightbar sidebar

View File

@ -0,0 +1,4 @@
# -*-conf-unix-*-
[Service]
ExecStartPost=eww open-many builtinbar

View File

@ -0,0 +1,4 @@
# -*-conf-unix-*-
[Service]
ExecStartPost=eww open-many leftbar rightbar network-status