diff options
| author | Caroline Larimore <caroline@larimo.re> | 2025-02-08 20:28:49 -0800 |
|---|---|---|
| committer | Caroline Larimore <caroline@larimo.re> | 2025-04-14 18:58:53 -0700 |
| commit | 1cfb12afdddce77ab2a8c430b53faf9d8d31d920 (patch) | |
| tree | 9f69be31594e436aa692edc5f15a3fa1efe511c9 /snowfall/modules/home/desktop/components/eww | |
| parent | 1eb21c10c217c60e226d168875def24967570a19 (diff) | |
migration: eww
Diffstat (limited to 'snowfall/modules/home/desktop/components/eww')
26 files changed, 937 insertions, 0 deletions
diff --git a/snowfall/modules/home/desktop/components/eww/assets/album_art_placeholder.png b/snowfall/modules/home/desktop/components/eww/assets/album_art_placeholder.png Binary files differnew file mode 100644 index 0000000..2cdcbab --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/assets/album_art_placeholder.png diff --git a/snowfall/modules/home/desktop/components/eww/default.nix b/snowfall/modules/home/desktop/components/eww/default.nix new file mode 100644 index 0000000..226ccc0 --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/default.nix @@ -0,0 +1,105 @@ +{ options, config, lib, pkgs, namespace, ... }: + +with lib; with lib.${namespace}; let + cfg = config.${namespace}.desktop.components.eww; + desktop = config.${namespace}.desktop; +in { + options.${namespace}.desktop.components.eww = with types; { + enable = mkEnableOption "eww"; + }; + + config = mkIf cfg.enable { + home.packages = with pkgs; [ + eww + + (writeShellScriptBin "eww-toggle" '' + if ${pkgs.eww}/bin/eww active-windows | grep $1; then + ${pkgs.eww}/bin/eww close $1 + else + ${pkgs.eww}/bin/eww open $@ + fi + '') + + (writeShellScriptBin "get-album-art" '' + OUTFILE=".mpris-art" + + while read -r line; do + if [[ -n $line ]]; then + rm -f ~/$OUTFILE + + cmus_path=$(${pkgs.cmus}/bin/cmus-remote -Q | grep file | cut -c 6-) + if [[ -n $cmus_path ]]; then + if [[ -f $(dirname "$cmus_path")/cover.jpg ]]; then + cp "$(dirname "$cmus_path")/cover.jpg" ~/$OUTFILE + else + ${pkgs.ffmpeg}/bin/ffmpeg -y -v quiet -i "$cmus_path" -c:v copy -f mjpeg ~/$OUTFILE + fi + else + mpris=$(${pkgs.playerctl}/bin/playerctl --player=cmus,firefox,%any metadata mpris:artUrl) + + if [[ $mpris == data:image* ]]; then + echo $mpris | sed s/.*,//g | base64 --decode > ~/$OUTFILE + elif [[ -n $mpris ]]; then + curl -s -o ~/$OUTFILE $mpris + fi + fi + + if [[ -f ~/$OUTFILE ]]; then + : + else + cp ${./assets/album_art_placeholder.png} ~/$OUTFILE + fi + + echo ~/$OUTFILE + fi + done + '') + ]; + + xdg.configFile."eww/eww.yuck".source = eww/eww.yuck; + xdg.configFile."eww/eww.css".source = eww/eww.css; + + xdg.configFile."eww/panels".source = eww/panels; + xdg.configFile."eww/windows".source = eww/windows; + xdg.configFile."eww/widgets".source = eww/widgets; + + xdg.configFile."eww/colors.css".text = let c = desktop.theme.colors; in '' + @define-color accent #${c.accent}; + + @define-color black #${c.black}; + @define-color red #${c.red}; + @define-color green #${c.green}; + @define-color yellow #${c.yellow}; + @define-color blue #${c.blue}; + @define-color magenta #${c.magenta}; + @define-color cyan #${c.cyan}; + @define-color white #${c.white}; + + @define-color brightBlack #${c.brightBlack}; + @define-color brightRed #${c.brightRed}; + @define-color brightGreen #${c.brightGreen}; + @define-color brightYellow #${c.brightYellow}; + @define-color brightBlue #${c.brightBlue}; + @define-color brightMagenta #${c.brightMagenta}; + @define-color brightCyan #${c.brightCyan}; + @define-color brightWhite #${c.brightWhite}; + + @define-color bg #${c.bg}; + @define-color bg0 #${c.bg0}; + @define-color bg1 #${c.bg1}; + @define-color bg2 #${c.bg2}; + @define-color bg3 #${c.bg3}; + @define-color bg4 #${c.bg4}; + + @define-color fg #${c.fg}; + @define-color fg0 #${c.fg0}; + @define-color fg1 #${c.fg1}; + @define-color fg2 #${c.fg2}; + @define-color fg3 #${c.fg3}; + @define-color fg4 #${c.fg4}; + + @define-color orange #${c.orange}; + @define-color brightOrange #${c.brightOrange}; + ''; + }; +} diff --git a/snowfall/modules/home/desktop/components/eww/eww/eww.css b/snowfall/modules/home/desktop/components/eww/eww/eww.css new file mode 100644 index 0000000..a715970 --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/eww/eww.css @@ -0,0 +1,86 @@ +@import "colors.css"; +@import "panels/default.css"; +@import "widgets/default.css"; + +window { + color: @fg; + background-color: rgba(0, 0, 0, 0); + /*border: 2px solid @yellow;*/ + font-family: monospace, sans-serif; +} + +.panel { + color: @fg; + background-color: @bg; + opacity: 1; + border: 2px solid @bg1; + outline: 2px solid red; + outline-offset: -20px; + font-family: monospace, sans-serif; + padding: 8px; +} + +.unpadded { + padding: 0px; +} + +.padded { + padding: 8px; +} + +button { + color: @fg; + background: @bg; + + border: none; + border-radius: 0; + box-shadow: none; + text-shadow: none; + margin: 0; + padding: 0; +} + +button:hover { + background: @bg1; +} + +button:active { + background: @bg2; +} + +button.icon { + font-family: 'monospace'; + font-size: 24; +} + +.cutout { + background: @bg1; +} + +.faint { + font-weight: normal; + color: @fg4; +} + +graph { + color: @accent; + background: alpha(@accent, 0.2); +} + +scale trough { + background: @bg2; + min-height: 4px; + min-width: 4px; +} + +scale highlight { + background: @accent; +} + +scale slider { + box-shadow: none; + background: @accent; + margin: -6px; + min-height: 0; + min-width: 0; +} diff --git a/snowfall/modules/home/desktop/components/eww/eww/eww.yuck b/snowfall/modules/home/desktop/components/eww/eww/eww.yuck new file mode 100644 index 0000000..320a207 --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/eww/eww.yuck @@ -0,0 +1,3 @@ +(include "./panels/default.yuck") +(include "./widgets/default.yuck") +(include "./windows/default.yuck") diff --git a/snowfall/modules/home/desktop/components/eww/eww/panels/bar.css b/snowfall/modules/home/desktop/components/eww/eww/panels/bar.css new file mode 100644 index 0000000..a07c3b1 --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/bar.css @@ -0,0 +1,39 @@ +.bar .shutdown { + color: @brightRed; +} + +.bar .restart { + color: @brightGreen; +} + +.bar .sleep { + color: @brightYellow; +} + +.bar .dismiss { + color: @red; +} + +.bar .ws { + font-family: 'Symbols Nerd Font Mono'; + font-size: 18; + + color: @bg2; +} + +.bar .ws.active { + color: @fg4; +} + +.bar .ws.visible { + color: @fg; +} + +.bar .ws.focused { + background: @bg1; + color: @fg0; +} + +.bar .ws.urgent { + background: @red; +} diff --git a/snowfall/modules/home/desktop/components/eww/eww/panels/bar.yuck b/snowfall/modules/home/desktop/components/eww/eww/panels/bar.yuck new file mode 100644 index 0000000..6dc4771 --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/bar.yuck @@ -0,0 +1,102 @@ +(defwidget bar [] + (centerbox :class "bar" + :orientation "h" + + (box + :orientation "h" + :spacing 8 + :space-evenly false + + (tooltip :class "panel" + {EWW_TIME} + {formattime(EWW_TIME, "%T", "America/Los_Angeles")} + ) + + (tooltip :class "panel" + {formattime(EWW_TIME, "%F", "America/Los_Angeles")} + {formattime(EWW_TIME, "%A, %B %d, %Y", "America/Los_Angeles")} + ) + ) + + (box + :orientation "h" + :spacing 8 + :space-evenly false + + ;(label :class "panel" + ; :text "i have no idea what to put here :3" + ;) + + (box :class "unpadded panel" + (ws :num 0 :icon "" :name "Main") + (ws :num 1 :icon "" :name "Terminal") + (ws :num 2 :icon "" :name "Browser") + (ws :num 3 :icon "" :name "Chat") + (ws :num 4 :icon "" :name "Gaming") + (ws :num 5 :icon "" :name "5") + (ws :num 6 :icon "" :name "6") + (ws :num 7 :icon "" :name "7") + (ws :num 8 :icon "" :name "Meow") + (ws :num 9 :icon "" :name "Music") + (ws :num 10 :icon "" :name "Misc") + ) + ) + + (box + :orientation "h" + :spacing 8 + :space-evenly false + :halign "end" + + (box :class "unpadded panel" + :space-evenly false + (button :class "sleep icon" + :width 31 + "" + ) + + (button :class "restart icon" + :width 33 + "" + ) + + (button :class "shutdown icon" + :width 31 + "" + ) + ) + + (box :class "unpadded panel" + (button :class "dismiss icon" + :width 29 + :onclick `${EWW_CMD} close sys` + "" + ) + ) + ) + ) +) + +(defwidget ws [num icon name] + (tooltip {name} + (button :class {"ws" + + (ws-status[num].active ? " active" : "") + + (ws-status[num].visible ? " visible" : "") + + (ws-status[num].focused ? " focused" : "") + + (ws-status[num].urgent ? " urgent" : "") + } + :width { + num == 0 ? 31 : + num == 10 ? 31 : + 33 + } + + {icon} + ) + ) +) + +(defpoll ws-status + :interval "0.1s" + `i3-msg -t get_workspaces | jq -caM 'map({"ws-\\(.num)": {visible, focused, urgent, active: true}}) | add as $orig | [range(0;11)] | [.[] as $i | $orig."ws-\\($i)" // {visible: false, focused: false, urgent: false, active: false}]'` +) diff --git a/snowfall/modules/home/desktop/components/eww/eww/panels/cpu.yuck b/snowfall/modules/home/desktop/components/eww/eww/panels/cpu.yuck new file mode 100644 index 0000000..ef57fa6 --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/cpu.yuck @@ -0,0 +1,45 @@ +(defwidget cpu [] + (box :class "panel" + :orientation "h" + :spacing 8 + :space-evenly false + + (tooltip :class "cutout" + {round(EWW_CPU.avg, 2) + "%"} + (graph + :value {EWW_CPU.avg} + :time-range "30s" + :width 76 + :height 76 + :hexpand true + ) + ) + + (box :orientation "v" + :spacing 8 + :space-evenly false + :hexpand true + + (label :halign "start" :markup {"<b>" + cpu-name + "</b>"}) + + (stat :key "Temperature" :value {round(EWW_TEMPS.K10TEMP_TCTL, 2) + "°C"}) + (stat :key "Frequency" :value {round(cpu-max-freq * cpu-freq/100, 0) + " MHz"}) + (stat :key "Usage" :value {round(EWW_CPU.avg, 2) + "%"}) + ) + ) +) + +(defpoll cpu-freq + :interval "2s" + `lscpu | sed -n '/CPU(s) scaling MHz/ s/.*:\\s*\\(.*\\)%/\\1/p'` +) + +(defpoll cpu-max-freq + :interval "9999s" + `lscpu | sed -n '/CPU max MHz/ s/.*:\\s*\\(.*\\)/\\1/p'` +) + +(defpoll cpu-name + :interval "9999s" + `lscpu | sed -n '/Model name/ s/.*:\\s*\\(.*\\)/\\1/p'` +) diff --git a/snowfall/modules/home/desktop/components/eww/eww/panels/default.css b/snowfall/modules/home/desktop/components/eww/eww/panels/default.css new file mode 100644 index 0000000..8cd39a3 --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/default.css @@ -0,0 +1,4 @@ +@import "bar.css"; +@import "fs.css"; +@import "launcher.css"; +@import "music.css"; diff --git a/snowfall/modules/home/desktop/components/eww/eww/panels/default.yuck b/snowfall/modules/home/desktop/components/eww/eww/panels/default.yuck new file mode 100644 index 0000000..3c20c4b --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/default.yuck @@ -0,0 +1,7 @@ +(include "./panels/bar.yuck") +(include "./panels/cpu.yuck") +(include "./panels/fs.yuck") +(include "./panels/launcher.yuck") +(include "./panels/memory.yuck") +(include "./panels/music.yuck") +(include "./panels/volume.yuck") diff --git a/snowfall/modules/home/desktop/components/eww/eww/panels/fs.css b/snowfall/modules/home/desktop/components/eww/eww/panels/fs.css new file mode 100644 index 0000000..8ca2dd2 --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/fs.css @@ -0,0 +1,13 @@ +.disks .meter.almost-full .progress { + color: @orange; + background: rgba(0, 0, 0, 0); +} + +.disks .meter.full .progress { + color: @red; + background: rgba(0, 0, 0, 0); +} + +.zfs .total { + font-weight: bold; +} diff --git a/snowfall/modules/home/desktop/components/eww/eww/panels/fs.yuck b/snowfall/modules/home/desktop/components/eww/eww/panels/fs.yuck new file mode 100644 index 0000000..54bbd46 --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/fs.yuck @@ -0,0 +1,74 @@ +(defwidget disks [] + (box :class "panel disks" + :orientation "h" + :spacing 8 + :space-evenly false + :height {100+16} + + (disk :mount "total" + :zfs true + :name "zpool" + ) + + (disk :mount "/mnt/4tb" + :name "4tb" + ) + (disk :mount "/mnt/ssd" + :name "ssd" + ) + ) +) + +(defwidget zfs [] + (box :class "panel zfs" + :orientation "v" + :spacing 8 + :space-evenly false + :hexpand true + + (label :halign "start" :markup "<b>ZFS Volumes</b>") + + (zvol :mount "/nix") + (zvol :mount "/persist") + + (zvol :class "faint" + :mount "/home" + ) + + (zvol :class "faint" + :mount "/" + ) + + (zvol :class "total" + :mount "total" + :name "Total" + ) + ) +) + +(defwidget disk [mount ?name ?zfs] + (meter + :value { + (zfs == true ? zpool : disks)[mount].used / ((zfs == true ? zpool : disks)[mount].used + (zfs == true ? zpool : disks)[mount].free) * 100} + :label {name != "" ? name : mount} + + {round((zfs == true ? zpool : disks)[mount].used/1024/1024, 0) + " GiB"} + ) +) + +(defwidget zvol [mount ?name ?class] + (stat :class {class} + :key {name != "" ? name : mount} + :value {round(zpool[mount].used/1024/1024, 2) + " GiB"} + ) +) + +(defpoll disks + :interval "10s" + `df -x fuse -x tmpfs -x efivarfs -x devtmpfs -x zfs | tail -n +2 | awk '{ printf "%s free %d\\n%s used %d\\n", $6, $4, $6, $3 }' | xargs printf '{"%s": {"%s": %d}}\\n' | jq -scaM 'map(to_entries) | flatten | group_by(.key) | map({"\\(.[0].key)": map(.value | to_entries) | flatten | from_entries}) | add'` +) + +(defpoll zpool + :interval "10s" + `df -t zfs --total | tail -n +2 | awk '{ printf "%s free %d\\n%s used %d\\n", $6, $4, $6, $3 }' | xargs printf '{"%s": {"%s": %d}}\\n' | jq -scaM 'map(to_entries) | flatten | group_by(.key) | map({"\\(.[0].key)": map(.value | to_entries) | flatten | from_entries}) | add | .total = ."-" | del(."-") | .total.free = ."/zpool".free'` +) diff --git a/snowfall/modules/home/desktop/components/eww/eww/panels/launcher.css b/snowfall/modules/home/desktop/components/eww/eww/panels/launcher.css new file mode 100644 index 0000000..5055191 --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/launcher.css @@ -0,0 +1,7 @@ +.launcher entry { + border-radius: 0; +} + +.launcher entry:focus { + box-shadow: 0 0 0 2px @accent inset; +} diff --git a/snowfall/modules/home/desktop/components/eww/eww/panels/launcher.yuck b/snowfall/modules/home/desktop/components/eww/eww/panels/launcher.yuck new file mode 100644 index 0000000..a568346 --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/launcher.yuck @@ -0,0 +1,27 @@ +(defwidget launcher [] + (box :class "launcher panel" + :orientation "v" + :spacing 8 + :space-evenly false + :height {556 - ((128 + 16 + 4) + 8)} + :width 768 + + (input + :valign "start" + ) + + (scroll + :vscroll true + :hscroll false + :vexpand true + + (literal :content {lunch}) + ) + ) +) + +(defpoll lunch + :interval "60s" + ;`~/lunch.sh` + `~/code/lunch/zig-out/bin/lunch` +) diff --git a/snowfall/modules/home/desktop/components/eww/eww/panels/memory.yuck b/snowfall/modules/home/desktop/components/eww/eww/panels/memory.yuck new file mode 100644 index 0000000..4f6633a --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/memory.yuck @@ -0,0 +1,28 @@ +(defwidget memory [] + (box :class "panel" + :orientation "v" + :spacing 8 + :space-evenly false + + (box + (label :markup "<b>Memory</b>" + :halign "start" + ) + + (label :markup {round(EWW_RAM.used_mem/1024/1024/1024, 2) + " GiB / " + round(EWW_RAM.total_mem/1024/1024/1024, 2) + " GiB"} + :halign "end" + ) + ) + + (tooltip :class "cutout" + {round(EWW_RAM.used_mem_perc, 2) + "%"} + (graph + :hexpand true + :value {EWW_RAM.used_mem} + :max {EWW_RAM.total_mem} + :time-range "30s" + :height 100 + ) + ) + ) +) diff --git a/snowfall/modules/home/desktop/components/eww/eww/panels/music.css b/snowfall/modules/home/desktop/components/eww/eww/panels/music.css new file mode 100644 index 0000000..e5bbc60 --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/music.css @@ -0,0 +1,38 @@ +.music { + padding: 8px; + opacity: 1.0; +} + +.music .right { + margin-top: 8px; +} + +.music .song-title { + font-size: 17px; + font-weight: bold; +} + +.music .song-album { + color: @fg2; +} + +.music .song-artist { + color: @fg2; +} + +.music scale trough { + background: @bg2; + min-height: 4px; +} + +.music scale highlight { + background: @accent; +} + +.music scale slider { + box-shadow: none; + background: @accent; + margin: -6px; + min-height: 0; + min-width: 0; +} diff --git a/snowfall/modules/home/desktop/components/eww/eww/panels/music.yuck b/snowfall/modules/home/desktop/components/eww/eww/panels/music.yuck new file mode 100644 index 0000000..feae96a --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/music.yuck @@ -0,0 +1,102 @@ + +(defwidget music [] + (box :class "panel music" + :orientation "h" + :spacing 8 + :space-evenly false + :height {128 + 16 + 4} + + (image + :path song-cover + :image-width 128 + :image-height 128 + ) + + (box :class "right" + :orientation "v" + :spacing 0 + :space-evenly true + :hexpand true + + (box :class "info" + :orientation "v" + :space-evenly false + :valign "center" + + (tooltip {song.title} + (label :class "song-title" + :text {song.title} + :halign "start" + :truncate true + ) + ) + (tooltip {song.album} + (label :class "song-album" + :text {song.album} + :halign "start" + :truncate true + ) + ) + (tooltip {song.artist} + (label :class "song-artist" + :text {song.artist} + :halign "start" + :truncate true + ) + ) + ) + + (box + :valign "end" + :space-evenly false + + (box :class "control" + :space-evenly false + + (button :class "icon" + :width 36 + :onclick `playerctl --player=cmus,firefox,%any previous` + + "" + ) + (button :class "icon" + :onclick `playerctl --player=cmus,firefox,%any play-pause` + :width 36 + + { song.status == "Playing" ? "" : "" } + ) + (button :class "icon" + :width 36 + :onclick `playerctl --player=cmus,firefox,%any next` + + "" + ) + ) + + (scale + :hexpand true + :value {song-position} + :max {song.length/1000/1000} + ;:onchange `/home/c/seek.sh {}` + ) + + {formattime(round(song-position, 0), "%M:%S") + " / " + formattime(round(song.length/1000/1000, 0), "%M:%S")} + + (box :width 16) + ) + ) + ) +) + +(deflisten song-cover + `playerctl --player=cmus,firefox,%any -F metadata title | get-album-art` +) + +(deflisten song + `playerctl --player=cmus,firefox,%any -F metadata --format='{"title": "{{title}}", "album": "{{album}}", "artist": "{{artist}}", "status": "{{status}}", "length": "{{mpris:length}}"}'` +) + +(defpoll song-position + :interval "0.2s" + `playerctl --player=cmus,firefox,%any position` +) diff --git a/snowfall/modules/home/desktop/components/eww/eww/panels/volume.yuck b/snowfall/modules/home/desktop/components/eww/eww/panels/volume.yuck new file mode 100644 index 0000000..0c342c3 --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/volume.yuck @@ -0,0 +1,40 @@ +(defwidget volume [] + (box :class "volume panel" + :orientation "v" + :space-evenly false + + (label :markup "<b>Volume</b>") + + (box + :orientation "h" + :vexpand true + + (box + :orientation "v" + :space-evenly false + :vexpand true + + (scale + :orientation "v" + :flipped true + :value {sink-volume} + :max 101 + :onchange `pactl set-sink-volume @DEFAULT_SINK@ {}%` + :vexpand true + ) + + {sink-volume + "%"} + ) + ) + ) +) + +(defpoll sink-volume + :interval "0.2s" + `pactl get-sink-volume @DEFAULT_SINK@ | head -n1 | awk '{print substr($5, 1, length($5)-1)}'` +) + +;(defpoll source-volume +; :interval "0.2s" +; `pactl get-source-volume @DEFAULT_SOURCE@ | head -n1 | awk '{print substr($5, 1, length($5)-1)}'` +;) diff --git a/snowfall/modules/home/desktop/components/eww/eww/widgets/default.css b/snowfall/modules/home/desktop/components/eww/eww/widgets/default.css new file mode 100644 index 0000000..e6d3764 --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/eww/widgets/default.css @@ -0,0 +1 @@ +@import "meter.css"; diff --git a/snowfall/modules/home/desktop/components/eww/eww/widgets/default.yuck b/snowfall/modules/home/desktop/components/eww/eww/widgets/default.yuck new file mode 100644 index 0000000..bedb80e --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/eww/widgets/default.yuck @@ -0,0 +1,2 @@ +(include "./widgets/meter.yuck") +(include "./widgets/stat.yuck") diff --git a/snowfall/modules/home/desktop/components/eww/eww/widgets/meter.css b/snowfall/modules/home/desktop/components/eww/eww/widgets/meter.css new file mode 100644 index 0000000..df65382 --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/eww/widgets/meter.css @@ -0,0 +1,9 @@ +.meter .background { + color: @bg1; + background: rgba(0, 0, 0, 0); +} + +.meter .progress { + color: @accent; + background: rgba(0, 0, 0, 0); +} diff --git a/snowfall/modules/home/desktop/components/eww/eww/widgets/meter.yuck b/snowfall/modules/home/desktop/components/eww/eww/widgets/meter.yuck new file mode 100644 index 0000000..af2c3f3 --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/eww/widgets/meter.yuck @@ -0,0 +1,41 @@ +(defwidget meter [value label] + (overlay :class {"meter" + + (value >= 90 ? " almost-full" : "") + + (value >= 99 ? " full" : "") + + (value <= 10 ? " almost-empty" : "") + + (value <= 1 ? " empty" : "") + } + + :width 100 + + (circular-progress :class "background" + :value 80 + :start-at 35 + :thickness 10 + :width 100 + ) + + (circular-progress :class "progress" + :value {value*0.8} + :start-at 35 + :thickness 10 + :width 100 + ) + + (box + :orientation "v" + :valign "center" + :space-evenly false + :spacing 2 + + (children) + + {round(value, 2)+"%"} + ) + + (transform + :translate-y "44px" + (label :markup {"<b>"+label+"</b>"}) + ) + ) +) diff --git a/snowfall/modules/home/desktop/components/eww/eww/widgets/stat.yuck b/snowfall/modules/home/desktop/components/eww/eww/widgets/stat.yuck new file mode 100644 index 0000000..1ef76f2 --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/eww/widgets/stat.yuck @@ -0,0 +1,24 @@ +(defwidget stat [key value ?class] + (overlay + (box :class {class} + :orientation "h" + :spacing 45 + + (label + :text {key} + :halign "start" + :hexpand true + ) + + (label + :text {value} + :halign "end" + :hexpand true + ) + ) + + (label :class "faint" + :text "..." + ) + ) +) diff --git a/snowfall/modules/home/desktop/components/eww/eww/windows/default.yuck b/snowfall/modules/home/desktop/components/eww/eww/windows/default.yuck new file mode 100644 index 0000000..77e8cf3 --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/eww/windows/default.yuck @@ -0,0 +1,2 @@ +(include "./windows/sys.yuck") +(include "./windows/music.yuck") diff --git a/snowfall/modules/home/desktop/components/eww/eww/windows/music.yuck b/snowfall/modules/home/desktop/components/eww/eww/windows/music.yuck new file mode 100644 index 0000000..f83340b --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/eww/windows/music.yuck @@ -0,0 +1,19 @@ +(defwindow music [pos gaps] + :monitor "<primary>" + :geometry (geometry + :x { + pos == "right" + ? gaps == "true" + ? "-8px" : "2px" + : "0px" + } + :y { gaps == "true" ? "-8px" : "2px" } + :width 512 + :anchor { pos == "right" ? "bottom right" : "bottom center" } + ) + :stacking "fg" + :windowtype "dock" + :wm-ignore true + + (music) +) diff --git a/snowfall/modules/home/desktop/components/eww/eww/windows/net.yuck b/snowfall/modules/home/desktop/components/eww/eww/windows/net.yuck new file mode 100644 index 0000000..8c5c299 --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/eww/windows/net.yuck @@ -0,0 +1,35 @@ +(box :class "panel" + :orientation "v" + :spacing 8 + :space-evenly true + :height {100+16} + :width {(100+8)*3+8} + + (graph + :value {net.rx} + :thickness 2 + :time-range "30s" + :min 0 + :max 100 + :dynamic true + :line-style "round" + ) + + {"Download: " + round(net.rx/1024/1024, 2) + " MiB/s (peak: " + round(net.rx_peak/1024/1024, 2) + " MiB/s)"} + + (graph + :value {net.tx} + :thickness 2 + :time-range "30s" + :min 0 + :max 100 + :dynamic true + :line-style "round" + ) + + {"Upload: " + round(net.tx/1024/1024, 2) + " MiB/s (peak: " + round(net.tx_peak/1024/1024, 2) + " MiB/s)"} +) + +(deflisten net + `/home/c/net.sh` +) diff --git a/snowfall/modules/home/desktop/components/eww/eww/windows/sys.yuck b/snowfall/modules/home/desktop/components/eww/eww/windows/sys.yuck new file mode 100644 index 0000000..fa6a719 --- /dev/null +++ b/snowfall/modules/home/desktop/components/eww/eww/windows/sys.yuck @@ -0,0 +1,84 @@ +(defwindow sys + :monitor "<primary>" + ;:monitor "HDMI-A-0" + :geometry (geometry + :x "0px" + :y "0px" + :anchor "center" + ) + :stacking "fg" + :windowtype "dialog" + :wm-ignore false + + (box :class "main" + :orientation "v" + :spacing 8 + :space-evenly false + + (bar) + + (box + :orientation "h" + :spacing 8 + :space-evenly false + + (box + :orientation "v" + :spacing 8 + :space-evenly false + + (disks) + + (box + :orientation "h" + :spacing 8 + :space-evenly false + + (zfs) + + (box :class "unpadded panel" + (image + :path "/home/c/Pictures/suit ryo.png" + :image-width 134 + ) + ) + ) + + (centerbox :class "panel" + (image + :path "/home/c/Pictures/car.png" + :image-height 13 + ) + + "silly zone :3" + + (image + :path "/home/c/Pictures/car.png" + :image-height 13 + ) + ) + + (memory) + (cpu) + ) + + (box + :orientation "v" + :spacing 8 + :space-evenly false + + (launcher) + + (box + :orientation "h" + :spacing 8 + :space-evenly false + + (box :hexpand true (music)) + + (volume) + ) + ) + ) + ) +) |