[vega] Sets up working system. [Eww] Moves config to be specific to drew-desktop

This commit is contained in:
2025-03-28 10:28:10 -07:00
parent c95d3419a2
commit b241ccd7d8
21 changed files with 23 additions and 50 deletions

View File

@@ -1,31 +0,0 @@
(defwidget clock-small []
(box
:orientation "h"
:class "clock small"
:space-evenly false
(label
:class "time"
:text "${formattime(EWW_TIME, '%I:%M')}"
)
(label
:class "date"
:text "${formattime(EWW_TIME, '%a %b %d')}"
)
)
)
(defwidget clock-large []
(box
:orientation "v"
:class "clock large"
:space-evenly true
(label
:class "time"
:text "${formattime(EWW_TIME, '%I:%M')}"
)
(label
:class "date"
:text "${formattime(EWW_TIME, '%a %b %d')}"
)
)
)

View File

@@ -1,186 +0,0 @@
@use 'tokyonight-night.scss' as colors;
$color-primary: colors.$blue;
$color-standout: colors.$green;
$color-danger: colors.$red;
$color-foreground: colors.$foreground;
$color-background: colors.$background;
$color-primary-dark: darker(colors.$blue);
$color-background-light: colors.$black;
$color-border: darker($color-background);
$color-foreground-dark: darker($color-foreground);
$color-standout-dark: darker($color-standout);
* {
all: unset;
}
@mixin rounded-widget {
border-radius: 8px;
padding-left: 16px;
padding-right: 16px;
}
.statusbar {
background-color: $color-background;
// background-image: linear-gradient(160deg, rgba(255,00,00,0.5), $color-background);
color: $color-foreground;
padding-left: 10px;
padding-right: 10px;
font-size: 14px;
border-bottom: 3px solid $color-border;
font-family: 'Noto Sans Nerd Font', sans-serif;
}
.system-monitor {
padding-top: 8px;
padding-right: 8px;
}
.bar-and-monitor {
background-color: $color-background;
// background-image: linear-gradient(160deg, rgba(255,00,00,0.5), $color-background);
color: $color-foreground;
}
.workspaces {
.workspace {
padding-left: 8px;
padding-right: 8px;
margin-bottom: -3px;
}
.active {
background-color: $color-background-light;
color: $color-foreground;
box-shadow: inset 0 -3px $color-standout-dark;
}
.focused {
background-color: $color-standout;
color: $color-background;
box-shadow: inset 0 -3px $color-standout-dark;
}
.inactive {
color: $color-foreground-dark;
}
}
.clock {
@include rounded-widget();
&.small {
background-color: $color-standout;
margin-right: 16px;
.time {
font-size: 120%;
padding-right: 8px;
font-weight: bold;
}
.date {
color: darker($color-foreground)
}
}
&.large {
background-color: lighter($color-background);
padding: 16px 32px;
.time {
font-size: 200%;
font-weight: bold;
}
.date {
color: darker($color-foreground);
font-size: 150%;
}
}
}
.system-monitor-widget {
@include rounded-widget();
background-color: lighter($color-background);
padding: 8px 16px;
.widget-title {
font-size: 120%;
font-weight: bold;
margin-bottom: 4px;
}
}
.system-monitor-gauge {
border-radius: 8px;
background-color: $color-background;
padding: 0 16px;
&-circle {
color: $color-primary;
}
}
.system-monitor-network-name {
color: $color-foreground-dark;
font-size: 110%;
}
.system-monitor-sparkgraph {
&-graph {
margin: 2px 8px;
color: $color-primary;
border-bottom: 1px solid $color-border;
border-left: 1px solid $color-border;
background-image: linear-gradient(45deg, $color-border, $color-background-light);
}
&-mem .system-monitor-sparkgraph-graph {
color: colors.$magenta;
}
&-temp .system-monitor-sparkgraph-graph {
color: colors.$green;
}
&-value {
color: $color-foreground;
}
&-units {
color: $color-foreground-dark;
font-size: 80%;
}
}
.system-monitor-audio {
&-name {
color: $color-foreground-dark;
}
&-slider {
scale trough {
background-color: $color-background;
min-height: 8px;
border-radius: 4px;
highlight {
border-radius: 4px;
border: 4px solid $color-primary;
}
}
&.muted scale trough highlight {
border-color: $color-danger;
}
}
}
.systray {
@include rounded-widget();
background-color: $color-background-light;
padding: 2px 10px;
}
.stand-alone {
background-color: $color-background;
border-radius: 5px;
border: 3px solid $color-border;
padding: 8px;
}
.power-menu {
padding: 10px;
}

View File

@@ -1,6 +0,0 @@
(include "./vars.yuck")
(include "./power-button.yuck")
(include "./primary-statusbar.yuck")
(include "./secondary-statusbar.yuck")
(include "./system-monitor.yuck")
(include "./launcher.yuck")

View File

@@ -1,82 +0,0 @@
(defwindow launcher
:monitor '[ "<primary>", "DP-2", 0 ]'
:geometry (geometry
:x "100px"
:y "100px"
:anchor "top left"
)
:stacking "bottom"
:exclusive false
:focusable false
(box
:class "launcher-window stand-alone"
:orientation "v"
:spacing 4
:visible { arraylength(jq(workspaces-json-dp2, "map(select(.active and (.has_windows | not)))")) > 0 }
(box
:orientation "v"
:halign "start"
:spacing 4
:space-evenly false
(label
:text "Apps"
:halign "start"
)
(box
:orientation "h"
:halign "start"
:spacing 4
:space-evenly false
(button
:onclick "firefox"
(image
:class "launcher-icon"
:icon "firefox"
:icon-size "dialog"
)
)
)
)
(box
:orientation "v"
:halign "start"
:spacing 4
:space-evenly false
(label
:text "Games"
:halign "start"
)
(box
:orientation "h"
:halign "start"
:spacing 4
:space-evenly false
(button
;; :onclick "env LUTRIS_SKIP_INIT=1 lutris lutris:rungameid/1"
:onclick "notify-send 'Launching Lutris' && env LUTRIS_SKIP_INIT=1 lutris lutris:rungameid/1"
(image
:class "launcher-icon"
:image-width 48
:path "/home/drew/.local/share/icons/hicolor/128x128/apps/lutris_battlenet.png"
)
)
(button
:onclick "steam steam://rungameid/1091500"
(image
:class "launcher-icon"
:icon "steam_icon_1091500"
:icon-size "dialog"
)
)
;; (button
;; :onclick "steam steam://rungameid/1145350"
;; (image
;; :class "launcher-icon"
;; :icon "steam_icon_1145350"
;; :icon-size "dialog"
;; )
;;)
)
)
)
)

View File

@@ -1,51 +0,0 @@
(defwidget power-button []
(box
:width 32
(button
;; :onclick `eww close power-menu || eww open power-menu`
:onclick `/home/drew/.config/rofi/powermenu/type-2/powermenu.sh`
(box
:orientation "h"
(label :text "⏻")
)
)
)
)
(defwindow power-menu
:monitor '[ "<secondary>", "DP-1" ]'
:geometry (geometry
:x "8px"
:y "8px"
:anchor "top right"
)
:stacking "overlay"
:exclusive false
:focusable false
(box
:class "power-menu stand-alone"
:orientation "v"
:halign "start"
:spacing 10
;; (button
;; :onclick "hyprlock"
;; :halign "start"
;; (label :text "🔒 Lock")
;; )
(button
:onclick "eww close power-menu && systemctl suspend"
:halign "start"
(label :text "⏾ Suspend")
)
(button
:onclick "eww close power-menu && systemctl reboot"
:halign "start"
(label :text "⟳ Reboot")
)
(button
:onclick "eww close power-menu && systemctl poweroff"
:halign "start"
(label :text "⏻ Shutdown")
)
)
)

View File

@@ -1,47 +0,0 @@
(include "./workspaces.yuck")
(defwidget primary-bar []
(box
:class "statusbar"
:orientation "h"
:height 30
(primary-leftstuff)
(primary-rightstuff)
)
)
(defwidget primary-leftstuff []
(box
:class "leftstuff"
:orientation "h"
:space-evenly true
:halign "start"
(workspaces-primary)
)
)
(defwidget primary-rightstuff []
(box
:class "rightstuff"
:orientation "h"
:halign "end"
(label :text "")
)
)
(defwindow primary-statusbar
:monitor '[ "<primary>", "DP-2", 0 ]'
:geometry (geometry
:x "0%"
:y "0%"
:width "100%"
:height "30px"
:anchor "top center"
)
:stacking "fg"
:exclusive true
:focusable false
:wm-ignore false
(primary-bar)
)

View File

@@ -1,21 +0,0 @@
#!/usr/bin/env bash
set -e
handle_event() {
case $1 in
focusedmon*) active_workspace;;
workspace*) active_workspace;;
esac
}
active_workspace() {
hyprctl activeworkspace -j | jq --compact-output --monochrome-output '{ id, name, monitor, has_windows: (.lastwindowtitle != "") }'
}
# Run it once before any events come in.
active_workspace
# Then listen for events
socat -U - "UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" | while read -r event; do handle_event "$event"; done

View File

@@ -1,38 +0,0 @@
#!/usr/bin/env bash
set -e
SOURCE='@DEFAULT_AUDIO_SOURCE@'
SINK='@DEFAULT_AUDIO_SINK@'
case $1 in
source)
device=$SOURCE
;;
sink)
device=$SINK
;;
*)
echo "Invalid device: $1"
echo "Valid options are 'source' and 'sink'"
exit 1
;;
esac
print_device_info() {
# The node description seems to be the most useful value here, though different values are available.
# However, we'll strip the "Analog Stereo" part.
description=$(wpctl inspect "$device" | sed -n -e 's/.*node.description = "\(.*\) Analog Stereo"/\1/p')
# The output of a muted device is something like "Volume: 0.55", so we just nab the second field.
volume=$(wpctl get-volume "$device" | awk '/Volume/ { print $2 }')
# The output of a muted device is something like "Volume: 0.55 [MUTED]", so "true" if the third field is present, "false" otherwise.
muted=$(wpctl get-volume "$device" | awk '/Volume/ { print ($3 ? "true" : "false") }')
echo "{ \"description\": \"$description\", \"volume\": $volume, \"muted\": $muted }"
}
print_device_info
pactl --format=json subscribe | grep --line-buffered $1 | while read -r event; do print_device_info; done

View File

@@ -1,6 +0,0 @@
#!/usr/bin/env bash
nvidia-smi --format=csv,noheader,nounits --query-gpu=utilization.gpu,utilization.memory,temperature.gpu --loop-ms=1000 \
| sed --unbuffered -e 's/.*/[&]/' \
| jq --unbuffered --compact-output '{"gpu": .[0], "memory": .[1], "temp": .[2] }'

View File

@@ -1,38 +0,0 @@
#!/usr/bin/env bash
set -e
handle_event() {
case $1 in
focusedmon*\
|workspace*\
|openwindow*\
|closewindow*) list_workspaces;;
esac
}
list_workspaces() {
focused=`hyprctl activeworkspace -j | jq '.id'`
active=`hyprctl monitors -j | jq 'map(select(.name == "'$monitor'")) | .[0].activeWorkspace.id'`
# Explanation
# 1. Select only workspaces on the current monitor.
# 2. Remove duplicates (might be a bug with split-monitor-workspaces
# 3. Create the output structure
# 4. Select interesting entries, ones that are focused, active or have windows
# 5. Sort
hyprctl workspaces -j | jq --compact-output --monochrome-output "
map( select( .monitor | contains(\"${monitor}\") ) ) |
reduce .[] as \$item ( []; if any( .[]; .id == \$item.id ) then . else . + [\$item] end ) |
map( { id: .id, name, active: (.id == ${active}), focused: (.id == ${focused}), has_windows: (.lastwindowtitle != \"\") } ) |
map( select (.active or .focused or .has_windows)) |
sort_by(.id)
"
}
monitor=$1
# List all workspaces once at the start
list_workspaces
# Then listen for events
socat -U - "UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" | while read -r event; do handle_event "$event"; done

View File

@@ -1,62 +0,0 @@
(defwidget secondary-bar []
(box
:class "statusbar"
:orientation "h"
:height 30
(secondary-leftstuff)
(secondary-rightstuff)
)
)
(defwidget secondary-leftstuff []
(box
:class "leftstuff"
:orientation "h"
:space-evenly true
:halign "start"
(workspaces-secondary)
)
)
(defwidget secondary-rightstuff []
(box
:class "rightstuff"
:orientation "h"
:halign "end"
:space-evenly false
(systray
:class "systray"
:spacing 3
:orientation "h"
:space-evenly true
:icon-size 16
)
(power-button)
)
)
(defwidget bar-and-monitor []
(box
:class "bar-and-monitor"
:orientation "v"
:space-evenly false
:spacing 8
(system-monitor)
(secondary-bar)
)
)
(defwindow secondary-statusbar
:monitor '[ "<secondary>", "DP-1" ]'
:geometry (geometry
:x "0px"
:y "0px"
:width "1440px" ;; Eww seems to treat both monitors as having the same width, so explicitly set this one to 1440px so it doesn't overflow.
:height "30px"
:anchor "top center"
)
:stacking "fg"
:exclusive true
:focusable false
(bar-and-monitor)
)

View File

@@ -1,296 +0,0 @@
(include "./clock.yuck")
(defwindow system-monitor
:monitor '[ "<secondary>", "DP-2" ]'
:class "system-monitor"
:geometry (geometry
:x "0px"
:y "36px"
:width "100%"
:height "200px"
:anchor "top center"
)
:stacking "fg"
:exclusive true
:focusable false
(system-monitor)
)
(defwidget system-monitor []
(box
:orientation "h"
:spacing 8
:space-evenly false
:halign "end"
:class "system-monitor"
(box
:orientation "h"
:halign "start"
:space-evenly false
:spacing 8
(system-monitor-perf)
(system-monitor-disks)
(system-monitor-net)
)
(box
:orientation "h"
:halign "end"
:space-evenly false
:spacing 8
(system-monitor-audio)
(clock-large)
)
)
)
(defwidget system-monitor-group [name ?orientation]
(box
:class "system-monitor-widget"
:orientation "v"
:space-evenly false
(label
:class "widget-title"
:text name
)
(box
:orientation {orientation ?: "h"}
:spacing 8
:space-evenly false
(children)
)
)
)
(defwidget system-monitor-perf []
(system-monitor-group
:name "Performance"
:orientation "h"
(box
:orientation "v"
(system-monitor-sparkgraph
:name "CPU"
:class "system-monitor-sparkgraph-cpu"
:value {EWW_CPU.avg}
:units "%"
)
(system-monitor-sparkgraph
:name "Mem"
:class "system-monitor-sparkgraph-mem"
:value {EWW_RAM.used_mem_perc}
:units "%"
)
(system-monitor-sparkgraph
:name "Temp"
:class "system-monitor-sparkgraph-temp"
:value {EWW_TEMPS["CORETEMP_PACKAGE_ID_0"]}
:units "°"
)
)
(box
:orientation "v"
(system-monitor-sparkgraph
:name "GPU"
:class "system-monitor-sparkgraph-cpu"
:value {gpu-stats.gpu}
:units "%"
)
(system-monitor-sparkgraph
:name "VRAM"
:class "system-monitor-sparkgraph-mem"
:value {gpu-stats.memory}
:units "%"
)
(system-monitor-sparkgraph
:name "Temp"
:class "system-monitor-sparkgraph-temp"
:value {gpu-stats.temp}
:units "°"
)
)
)
)
(defwidget system-monitor-gauge [name text-value gauge-pct units ?precision]
(box
:orientation "v"
:valign "center"
:halign "center"
:class "system-monitor-gauge"
:width 60
(label
:text name
)
(circular-progress
:class "system-monitor-gauge-circle"
:value {gauge-pct}
:height 32
:thickness 5
)
(label
:text "${round(text-value, precision ?: 0)}${units}"
)
)
)
(defwidget system-monitor-disks []
(system-monitor-group
:name "Disks"
(system-monitor-gauge
:name "Root"
:text-value {EWW_DISK['/'].free / powi(2, 30)}
:gauge-pct {EWW_DISK['/'].used_perc}
:units " GB"
)
(system-monitor-gauge
:name "Home"
:text-value {EWW_DISK['/home'].free / powi(2, 30)}
:gauge-pct {EWW_DISK['/home'].used_perc}
:units " GB"
)
)
)
(defpoll network-name
:interval "1s"
:initial "Loading..."
`iwgetid -r`
)
(defwidget system-monitor-net []
(system-monitor-group
:name "Network"
:orientation "v"
(label
:class "system-monitor-network-name"
:text {network-name}
)
(system-monitor-sparkgraph
:name "Down"
:value {EWW_NET["wlo1"]["NET_DOWN"] / 1000000}
:units " MB/s"
)
(system-monitor-sparkgraph
:name "Up"
:value {EWW_NET["wlo1"]["NET_UP"] / 1000000}
:units " MB/s"
)
)
)
(defwidget system-monitor-sparkgraph [name value units ?class]
(box
:class "system-monitor-sparkgraph ${class ?: ""}"
:orientation "h"
:halign "start"
:space-evenly false
(box
:width 40
:orientation "h"
:halign "end"
(label
:text name
:valign "end"
:halign "end"
)
)
(box
:class "system-monitor-sparkgraph-graph ${ value > 80 ? "danger" : "" }"
(graph
:width 80
:height 30
:dynamic true
:value { value ?: 0 }
:thickness 1
:time-range "60s"
)
)
(box
:orientation "h"
:halign "center"
:space-evenly false
(box
:halign "end"
:width 30
(label
:class "system-monitor-sparkgraph-value"
:text "${round(value ?: 0, 1)}"
:valign "end"
:halign "end"
)
)
(label
:class "system-monitor-sparkgraph-units"
:text "${units}"
:valign "end"
)
)
)
)
(defwidget system-monitor-audio-slider [name volume muted onchange]
(box
:class "system-monitor-audio"
:orientation "v"
:valign "start"
:halign "fill"
:space-evenly false
(box
:width 40
:orientation "h"
:class "system-monitor-audio-name"
(label
:text name
)
)
(box
:class "system-monitor-audio-slider ${muted ? "muted" : ""}"
:width 150
:orientation "h"
:halign "fill"
:space-evenly false
(image
:class "system-monitor-audio-icon"
:icon {
(muted ?: false) ? "audio-volume-muted" : (
(volume ?: 0) > 75 ? "audio-volume-high" : (
(volume ?: 0) > 25 ? "audio-volume-medium" : "audio-volume-low"
)
)
}
)
(scale
:hexpand true
:value {volume * 100}
:min 0
:max 100
:orientation "h"
:onchange {onchange ?: ""}
)
(label
:text "${round(volume * 100, 0)}"
:class "system-monitor-audio-slider-value"
:halign "end"
:width 30
)
)
)
)
(defwidget system-monitor-audio []
(system-monitor-group
:name "Audio"
:orientation "v"
(system-monitor-audio-slider
:name {audio-output?.description ?: ""}
:volume {audio-output?.volume ?: 0}
:onchange "wpctl set-volume @DEFAULT_AUDIO_SINK@ {}%"
:muted {audio-output?.muted ?: true}
)
(system-monitor-audio-slider
:name {audio-input?.description ?: ""}
:volume {audio-input?.volume ?: 0}
:onchange "wpctl set-volume @DEFAULT_AUDIO_SOURCE@ {}%"
:muted {audio-input?.muted ?: true}
)
)
)

View File

@@ -1,20 +0,0 @@
$background: #1a1b26;
$foreground: #c0caf5;
$black: #15161e;
$red: #f7768e;
$green: #9ece6a;
$yellow: #e0af68;
$blue: #7aa2f7;
$magenta: #bb9af7;
$cyan: #7dcfff;
$white: #a9b1d6;
$black-bright: lighter(#15161e);
$red-bright: lighter(#f7768e);
$green-bright: lighter(#9ece6a);
$yellow-bright: lighter(#e0af68);
$blue-bright: lighter(#7aa2f7);
$magenta-bright: lighter(#bb9af7);
$cyan-bright: lighter(#7dcfff);
$white-bright: lighter(#a9b1d6);

View File

@@ -1,24 +0,0 @@
; Variables go here if they are shared.
(deflisten gpu-stats
:initial "{}"
`/home/drew/.config/eww/scripts/gpu-stats.sh`
)
(deflisten workspaces-json-dp1
:initial "[]"
`~/.config/eww/scripts/workspaces.sh DP-1`
)
(deflisten workspaces-json-dp2
:initial "[]"
`~/.config/eww/scripts/workspaces.sh DP-2`
)
(deflisten audio-output
`~/.config/eww/scripts/audio-toolkit.sh sink`
)
(deflisten audio-input
`~/.config/eww/scripts/audio-toolkit.sh source`
)

View File

@@ -1,23 +0,0 @@
(defwidget workspaces [workspaces-json]
(box
:class "workspaces"
:orientation "h"
:space-evenly false
(for ws in workspaces-json
(box
(label
:text "${ws.name}"
:class "workspace ${ ws.active ? "active" : "inactive" } ${ws.focused ? "focused" : "unfocused"}"
)
)
)
)
)
(defwidget workspaces-primary []
(workspaces :workspaces-json workspaces-json-dp2)
)
(defwidget workspaces-secondary []
(workspaces :workspaces-json workspaces-json-dp1)
)

View File

@@ -1,7 +0,0 @@
{ ... }:
{
programs.eww = {
enable = true;
configDir = ./config;
};
}