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 | |
| parent | 1eb21c10c217c60e226d168875def24967570a19 (diff) | |
migration: eww
31 files changed, 154 insertions, 144 deletions
@@ -1,8 +1,13 @@ # eww colors.css is generated from the current theme. This copy is for local # widget development without rebuilding my entire system for every change, -# using `eww -c /etc/nixos/roles/home/desktop/eww/`. +# using `eww -c /etc/nixos/snowfall/modules/home/desktop/components/eww/eww`. # It is just a static copy of the generated file -roles/home/desktop/eww/colors.css +#TODO: change path on finalization +snowfall/modules/home/desktop/components/eww/eww/colors.css + +# WIP new stuff. ignored because git is annoying about it +#TODO: change path on finalization +snowfall/modules/home/desktop/components/eww/eww/new # NixOS VM files result diff --git a/assets/SOURCES.md b/assets/SOURCES.md deleted file mode 100644 index a061183..0000000 --- a/assets/SOURCES.md +++ /dev/null @@ -1,4 +0,0 @@ -# Asset Sources - -## Misc -- `album_art_placeholder.png`: Me and my legendary artistic talent diff --git a/roles/home/desktop/eww.nix b/roles/home/desktop/eww.nix deleted file mode 100644 index ee93f92..0000000 --- a/roles/home/desktop/eww.nix +++ /dev/null @@ -1,96 +0,0 @@ -{ config, lib, pkgs, ... }: - -lib.mkIf config.home.roles.desktop.eww { - 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 = config.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/roles/home/desktop/eww/windows/net.yuck b/roles/home/desktop/eww/windows/net.yuck deleted file mode 100644 index b1e9792..0000000 --- a/roles/home/desktop/eww/windows/net.yuck +++ /dev/null @@ -1,38 +0,0 @@ -(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` -)
\ No newline at end of file diff --git a/assets/album_art_placeholder.png b/snowfall/modules/home/desktop/components/eww/assets/album_art_placeholder.png Binary files differindex 2cdcbab..2cdcbab 100644 --- a/assets/album_art_placeholder.png +++ 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/roles/home/desktop/eww/eww.css b/snowfall/modules/home/desktop/components/eww/eww/eww.css index f770055..a715970 100644 --- a/roles/home/desktop/eww/eww.css +++ b/snowfall/modules/home/desktop/components/eww/eww/eww.css @@ -14,6 +14,8 @@ window { background-color: @bg; opacity: 1; border: 2px solid @bg1; + outline: 2px solid red; + outline-offset: -20px; font-family: monospace, sans-serif; padding: 8px; } diff --git a/roles/home/desktop/eww/eww.yuck b/snowfall/modules/home/desktop/components/eww/eww/eww.yuck index 320a207..320a207 100644 --- a/roles/home/desktop/eww/eww.yuck +++ b/snowfall/modules/home/desktop/components/eww/eww/eww.yuck diff --git a/roles/home/desktop/eww/panels/bar.css b/snowfall/modules/home/desktop/components/eww/eww/panels/bar.css index a07c3b1..a07c3b1 100644 --- a/roles/home/desktop/eww/panels/bar.css +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/bar.css diff --git a/roles/home/desktop/eww/panels/bar.yuck b/snowfall/modules/home/desktop/components/eww/eww/panels/bar.yuck index 6dc4771..6dc4771 100644 --- a/roles/home/desktop/eww/panels/bar.yuck +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/bar.yuck diff --git a/roles/home/desktop/eww/panels/cpu.yuck b/snowfall/modules/home/desktop/components/eww/eww/panels/cpu.yuck index ef57fa6..ef57fa6 100644 --- a/roles/home/desktop/eww/panels/cpu.yuck +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/cpu.yuck diff --git a/roles/home/desktop/eww/panels/default.css b/snowfall/modules/home/desktop/components/eww/eww/panels/default.css index 8cd39a3..8cd39a3 100644 --- a/roles/home/desktop/eww/panels/default.css +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/default.css diff --git a/roles/home/desktop/eww/panels/default.yuck b/snowfall/modules/home/desktop/components/eww/eww/panels/default.yuck index 3c20c4b..3c20c4b 100644 --- a/roles/home/desktop/eww/panels/default.yuck +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/default.yuck diff --git a/roles/home/desktop/eww/panels/fs.css b/snowfall/modules/home/desktop/components/eww/eww/panels/fs.css index 8ca2dd2..8ca2dd2 100644 --- a/roles/home/desktop/eww/panels/fs.css +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/fs.css diff --git a/roles/home/desktop/eww/panels/fs.yuck b/snowfall/modules/home/desktop/components/eww/eww/panels/fs.yuck index 54bbd46..54bbd46 100644 --- a/roles/home/desktop/eww/panels/fs.yuck +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/fs.yuck diff --git a/roles/home/desktop/eww/panels/launcher.css b/snowfall/modules/home/desktop/components/eww/eww/panels/launcher.css index 5055191..5055191 100644 --- a/roles/home/desktop/eww/panels/launcher.css +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/launcher.css diff --git a/roles/home/desktop/eww/panels/launcher.yuck b/snowfall/modules/home/desktop/components/eww/eww/panels/launcher.yuck index a568346..a568346 100644 --- a/roles/home/desktop/eww/panels/launcher.yuck +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/launcher.yuck diff --git a/roles/home/desktop/eww/panels/memory.yuck b/snowfall/modules/home/desktop/components/eww/eww/panels/memory.yuck index 4f6633a..4f6633a 100644 --- a/roles/home/desktop/eww/panels/memory.yuck +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/memory.yuck diff --git a/roles/home/desktop/eww/panels/music.css b/snowfall/modules/home/desktop/components/eww/eww/panels/music.css index e5bbc60..e5bbc60 100644 --- a/roles/home/desktop/eww/panels/music.css +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/music.css diff --git a/roles/home/desktop/eww/panels/music.yuck b/snowfall/modules/home/desktop/components/eww/eww/panels/music.yuck index 757efd5..feae96a 100644 --- a/roles/home/desktop/eww/panels/music.yuck +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/music.yuck @@ -99,4 +99,4 @@ (defpoll song-position :interval "0.2s" `playerctl --player=cmus,firefox,%any position` -)
\ No newline at end of file +) diff --git a/roles/home/desktop/eww/panels/volume.yuck b/snowfall/modules/home/desktop/components/eww/eww/panels/volume.yuck index 0c342c3..0c342c3 100644 --- a/roles/home/desktop/eww/panels/volume.yuck +++ b/snowfall/modules/home/desktop/components/eww/eww/panels/volume.yuck diff --git a/roles/home/desktop/eww/widgets/default.css b/snowfall/modules/home/desktop/components/eww/eww/widgets/default.css index e6d3764..e6d3764 100644 --- a/roles/home/desktop/eww/widgets/default.css +++ b/snowfall/modules/home/desktop/components/eww/eww/widgets/default.css diff --git a/roles/home/desktop/eww/widgets/default.yuck b/snowfall/modules/home/desktop/components/eww/eww/widgets/default.yuck index bedb80e..bedb80e 100644 --- a/roles/home/desktop/eww/widgets/default.yuck +++ b/snowfall/modules/home/desktop/components/eww/eww/widgets/default.yuck diff --git a/roles/home/desktop/eww/widgets/meter.css b/snowfall/modules/home/desktop/components/eww/eww/widgets/meter.css index df65382..df65382 100644 --- a/roles/home/desktop/eww/widgets/meter.css +++ b/snowfall/modules/home/desktop/components/eww/eww/widgets/meter.css diff --git a/roles/home/desktop/eww/widgets/meter.yuck b/snowfall/modules/home/desktop/components/eww/eww/widgets/meter.yuck index af2c3f3..af2c3f3 100644 --- a/roles/home/desktop/eww/widgets/meter.yuck +++ b/snowfall/modules/home/desktop/components/eww/eww/widgets/meter.yuck diff --git a/roles/home/desktop/eww/widgets/stat.yuck b/snowfall/modules/home/desktop/components/eww/eww/widgets/stat.yuck index 1ef76f2..1ef76f2 100644 --- a/roles/home/desktop/eww/widgets/stat.yuck +++ b/snowfall/modules/home/desktop/components/eww/eww/widgets/stat.yuck diff --git a/roles/home/desktop/eww/windows/default.yuck b/snowfall/modules/home/desktop/components/eww/eww/windows/default.yuck index 77e8cf3..77e8cf3 100644 --- a/roles/home/desktop/eww/windows/default.yuck +++ b/snowfall/modules/home/desktop/components/eww/eww/windows/default.yuck diff --git a/roles/home/desktop/eww/windows/music.yuck b/snowfall/modules/home/desktop/components/eww/eww/windows/music.yuck index f6cf02b..f83340b 100644 --- a/roles/home/desktop/eww/windows/music.yuck +++ b/snowfall/modules/home/desktop/components/eww/eww/windows/music.yuck @@ -16,4 +16,4 @@ :wm-ignore true (music) -)
\ No newline at end of file +) 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/roles/home/desktop/eww/windows/sys.yuck b/snowfall/modules/home/desktop/components/eww/eww/windows/sys.yuck index a84e5aa..fa6a719 100644 --- a/roles/home/desktop/eww/windows/sys.yuck +++ b/snowfall/modules/home/desktop/components/eww/eww/windows/sys.yuck @@ -1,6 +1,6 @@ (defwindow sys - ;:monitor "<primary>" - :monitor "DisplayPort-1" + :monitor "<primary>" + ;:monitor "HDMI-A-0" :geometry (geometry :x "0px" :y "0px" diff --git a/snowfall/modules/home/suites/desktop/default.nix b/snowfall/modules/home/suites/desktop/default.nix index 7322e0a..077843a 100644 --- a/snowfall/modules/home/suites/desktop/default.nix +++ b/snowfall/modules/home/suites/desktop/default.nix @@ -21,6 +21,7 @@ in { polybar.enable = true; rofi.enable = true; picom.enable = true; + eww.enable = true; gtk.enable = true; fcitx5.enable = true; |