From e642c86e21d14ee92bd6edc7592f070534be554a Mon Sep 17 00:00:00 2001 From: Drew Haven Date: Sun, 16 Feb 2025 13:34:14 -0800 Subject: [PATCH] [eww] Adds my Eww config --- home-manager/apps/eww/config/clock.yuck | 31 ++ home-manager/apps/eww/config/eww.scss | 186 +++++++++++ home-manager/apps/eww/config/eww.yuck | 7 + home-manager/apps/eww/config/launcher.yuck | 82 +++++ .../apps/eww/config/power-button.yuck | 50 +++ .../apps/eww/config/primary-statusbar.yuck | 47 +++ .../eww/config/scripts/active-workspace.sh | 21 ++ .../apps/eww/config/scripts/audio-toolkit.sh | 38 +++ .../apps/eww/config/scripts/gpu-stats.sh | 6 + .../apps/eww/config/scripts/workspaces.sh | 38 +++ .../apps/eww/config/secondary-statusbar.yuck | 62 ++++ .../apps/eww/config/system-monitor.yuck | 296 ++++++++++++++++++ home-manager/apps/eww/config/vars.yuck | 24 ++ home-manager/apps/eww/config/workspaces.yuck | 23 ++ home-manager/apps/eww/default.nix | 11 + home-manager/features/linux-desktop.nix | 2 +- 16 files changed, 923 insertions(+), 1 deletion(-) create mode 100644 home-manager/apps/eww/config/clock.yuck create mode 100644 home-manager/apps/eww/config/eww.scss create mode 100644 home-manager/apps/eww/config/eww.yuck create mode 100644 home-manager/apps/eww/config/launcher.yuck create mode 100644 home-manager/apps/eww/config/power-button.yuck create mode 100644 home-manager/apps/eww/config/primary-statusbar.yuck create mode 100755 home-manager/apps/eww/config/scripts/active-workspace.sh create mode 100755 home-manager/apps/eww/config/scripts/audio-toolkit.sh create mode 100755 home-manager/apps/eww/config/scripts/gpu-stats.sh create mode 100755 home-manager/apps/eww/config/scripts/workspaces.sh create mode 100644 home-manager/apps/eww/config/secondary-statusbar.yuck create mode 100644 home-manager/apps/eww/config/system-monitor.yuck create mode 100644 home-manager/apps/eww/config/vars.yuck create mode 100644 home-manager/apps/eww/config/workspaces.yuck create mode 100644 home-manager/apps/eww/default.nix diff --git a/home-manager/apps/eww/config/clock.yuck b/home-manager/apps/eww/config/clock.yuck new file mode 100644 index 0000000..7e8f16c --- /dev/null +++ b/home-manager/apps/eww/config/clock.yuck @@ -0,0 +1,31 @@ +(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')}" + ) + ) +) \ No newline at end of file diff --git a/home-manager/apps/eww/config/eww.scss b/home-manager/apps/eww/config/eww.scss new file mode 100644 index 0000000..39854b6 --- /dev/null +++ b/home-manager/apps/eww/config/eww.scss @@ -0,0 +1,186 @@ +@use '/home/drew/.config/colors/decay' as decay; + +$color-primary: decay.$blue-bright; +$color-standout: decay.$green; +$color-danger: decay.$red; +$color-foreground: decay.$foreground; +$color-background: decay.$background; + +$color-primary-dark: decay.$blue; +$color-background-light: decay.$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: decay.$magenta; + } + &-temp .system-monitor-sparkgraph-graph { + color: decay.$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; +} diff --git a/home-manager/apps/eww/config/eww.yuck b/home-manager/apps/eww/config/eww.yuck new file mode 100644 index 0000000..368c79d --- /dev/null +++ b/home-manager/apps/eww/config/eww.yuck @@ -0,0 +1,7 @@ +(include "./vars.yuck") + +(include "./power-button.yuck") +(include "./primary-statusbar.yuck") +(include "./secondary-statusbar.yuck") +(include "./system-monitor.yuck") +(include "./launcher.yuck") diff --git a/home-manager/apps/eww/config/launcher.yuck b/home-manager/apps/eww/config/launcher.yuck new file mode 100644 index 0000000..973e79f --- /dev/null +++ b/home-manager/apps/eww/config/launcher.yuck @@ -0,0 +1,82 @@ +(defwindow launcher + :monitor '[ "", "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" + ;; ) + ;;) + ) + ) + ) +) diff --git a/home-manager/apps/eww/config/power-button.yuck b/home-manager/apps/eww/config/power-button.yuck new file mode 100644 index 0000000..4d88a8f --- /dev/null +++ b/home-manager/apps/eww/config/power-button.yuck @@ -0,0 +1,50 @@ +(defwidget power-button [] + (box + :width 32 + (button + :onclick `eww close power-menu || eww open power-menu` + (box + :orientation "h" + (label :text "⏻") + ) + ) + ) +) + +(defwindow power-menu + :monitor '[ "", "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") + ) + ) +) diff --git a/home-manager/apps/eww/config/primary-statusbar.yuck b/home-manager/apps/eww/config/primary-statusbar.yuck new file mode 100644 index 0000000..2623031 --- /dev/null +++ b/home-manager/apps/eww/config/primary-statusbar.yuck @@ -0,0 +1,47 @@ +(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 '[ "", "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) +) + diff --git a/home-manager/apps/eww/config/scripts/active-workspace.sh b/home-manager/apps/eww/config/scripts/active-workspace.sh new file mode 100755 index 0000000..9c4c62e --- /dev/null +++ b/home-manager/apps/eww/config/scripts/active-workspace.sh @@ -0,0 +1,21 @@ + +#!/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 \ No newline at end of file diff --git a/home-manager/apps/eww/config/scripts/audio-toolkit.sh b/home-manager/apps/eww/config/scripts/audio-toolkit.sh new file mode 100755 index 0000000..29cf2b3 --- /dev/null +++ b/home-manager/apps/eww/config/scripts/audio-toolkit.sh @@ -0,0 +1,38 @@ +#!/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 \ No newline at end of file diff --git a/home-manager/apps/eww/config/scripts/gpu-stats.sh b/home-manager/apps/eww/config/scripts/gpu-stats.sh new file mode 100755 index 0000000..731dcd4 --- /dev/null +++ b/home-manager/apps/eww/config/scripts/gpu-stats.sh @@ -0,0 +1,6 @@ +#!/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] }' + diff --git a/home-manager/apps/eww/config/scripts/workspaces.sh b/home-manager/apps/eww/config/scripts/workspaces.sh new file mode 100755 index 0000000..441e50f --- /dev/null +++ b/home-manager/apps/eww/config/scripts/workspaces.sh @@ -0,0 +1,38 @@ +#!/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 diff --git a/home-manager/apps/eww/config/secondary-statusbar.yuck b/home-manager/apps/eww/config/secondary-statusbar.yuck new file mode 100644 index 0000000..48a0056 --- /dev/null +++ b/home-manager/apps/eww/config/secondary-statusbar.yuck @@ -0,0 +1,62 @@ +(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 '[ "", "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) +) diff --git a/home-manager/apps/eww/config/system-monitor.yuck b/home-manager/apps/eww/config/system-monitor.yuck new file mode 100644 index 0000000..43bc7bb --- /dev/null +++ b/home-manager/apps/eww/config/system-monitor.yuck @@ -0,0 +1,296 @@ +(include "./clock.yuck") + +(defwindow system-monitor + :monitor '[ "", "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} + ) + ) +) diff --git a/home-manager/apps/eww/config/vars.yuck b/home-manager/apps/eww/config/vars.yuck new file mode 100644 index 0000000..3507d4b --- /dev/null +++ b/home-manager/apps/eww/config/vars.yuck @@ -0,0 +1,24 @@ +; 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` +) \ No newline at end of file diff --git a/home-manager/apps/eww/config/workspaces.yuck b/home-manager/apps/eww/config/workspaces.yuck new file mode 100644 index 0000000..0907f69 --- /dev/null +++ b/home-manager/apps/eww/config/workspaces.yuck @@ -0,0 +1,23 @@ +(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) +) \ No newline at end of file diff --git a/home-manager/apps/eww/default.nix b/home-manager/apps/eww/default.nix new file mode 100644 index 0000000..352f805 --- /dev/null +++ b/home-manager/apps/eww/default.nix @@ -0,0 +1,11 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + eww + ]; + + home.file.".config/eww" = { + source = ./config; + recursive = true; + }; +} diff --git a/home-manager/features/linux-desktop.nix b/home-manager/features/linux-desktop.nix index 5c4d786..615fb12 100644 --- a/home-manager/features/linux-desktop.nix +++ b/home-manager/features/linux-desktop.nix @@ -5,6 +5,7 @@ ./audio.nix ./nix.nix ../apps/element.nix + ../apps/eww ]; home.packages = with pkgs; [ @@ -15,7 +16,6 @@ hyprpaper # wallpaper swayidle # lock on idle swayosd # volume pop-up - eww # widgets swaynotificationcenter # notifications hyprpolkitagent # Privilege managent gnome-keyring # Secret management