{ pkgs, config, lib, self, theme, ... }: let cfg = config.my.graphical.wayland.eww; in { options.my.graphical.wayland.eww = { enable = lib.mkEnableOption null; }; config = let inherit (pkgs) eww; in lib.mkIf cfg.enable { home.packages = [ eww ]; xdg.configFile."eww" = { source = pkgs.symlinkJoin { name = "eww"; paths = [ (pkgs.runCommandLocal "eww-config" {} (let substArgs = lib.strings.concatStrings (lib.attrsets.mapAttrsToList (from: to: '' --subst-var-by \ ${lib.strings.escapeShellArg from} \ ${lib.strings.escapeShellArg to} \ '') ({ soyjak = "${self}/assets/pointingSoyjaks.png"; } // theme)); in '' cp -r ${./config} $out substituteInPlace $(find $out -type f -name '[^.]*') ${substArgs} #chmod +x "$(grep -lr '^#!/' "$out/scripts")" '')) (pkgs.writeTextDir "_mocha.scss" (lib.mapAttrsToList (name: value: "\$${name}: #${value};") theme)) ]; }; }; wayland.windowManager.hyprland.settings = let inherit (config.my.graphical.wayland.hyprland) mainMod; toggleSoyjaks = pkgs.writeShellScript "toggle-soyjaks" '' if ${eww}/bin/eww active-windows | ${pkgs.gnugrep}/bin/grep -q 'soyjak-layer'; then ${eww}/bin/eww close soyjak-layer else ${eww}/bin/eww open soyjak-layer fi ''; in { bind = [ "${mainMod} CTRL, S, exec, ${toggleSoyjaks}" ]; }; systemd.user = { services = let ewwBarOpen = pkgs.writeShellScriptBin "eww-bar-open" '' # Lack of quotes intentional exec ${eww}/bin/eww open-many \ $(hyprctl monitors -j | \ jaq -r '.[] | .id' | \ sed 's/^/bar/') ''; path = lib.makeBinPath (with pkgs; [ acpi bash config.wayland.windowManager.hyprland.package coreutils ewwBarOpen gnused jaq ruby ]); in { eww = { Unit = { Description = "Eww background daemon"; partOf = [ "tray.target" ]; }; Service = { Environment = "PATH=${path}"; ExecStart = "${eww}/bin/eww daemon --no-daemonize"; }; Install = { WantedBy = [ "tray.target" ]; }; }; eww-bar = { Unit = { Description = "Eww bar"; After = "eww.service"; }; Service = { Type = "oneshot"; ExecStart = "${ewwBarOpen}/bin/eww-bar-open"; }; Install = { WantedBy = [ "eww.service" ]; }; }; }; }; }; }