372a4de5c2
Note: not the actual initial commit. I swear I will stop repeatedly force pushing to this single commit eventually ok.
84 lines
2.5 KiB
Nix
84 lines
2.5 KiB
Nix
{ 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 = builtins.mapAttrs (name: src: {
|
|
source = pkgs.substituteAll ({
|
|
inherit src;
|
|
acpi = "${pkgs.acpi}/bin/acpi";
|
|
hyprctl = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl";
|
|
ruby = "${pkgs.ruby}/bin/ruby";
|
|
soyjak = "${self}/assets/pointingSoyjaks.png";
|
|
} // theme);
|
|
target = "eww/${name}";
|
|
executable = builtins.match "\\./scripts/.*" name != null;
|
|
}) (self.lib.filterNixReadDir ./.) // {
|
|
"eww/_mocha.scss".text = builtins.concatStringsSep "\n"
|
|
(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 = {
|
|
eww = {
|
|
Unit = {
|
|
Description = "Eww background daemon";
|
|
partOf = [ "tray.target" ];
|
|
};
|
|
Service = {
|
|
Environment = "PATH=${lib.makeBinPath (with pkgs; [ coreutils bash ])}";
|
|
ExecStart = "${eww}/bin/eww daemon --no-daemonize";
|
|
};
|
|
Install = {
|
|
WantedBy = [ "tray.target" ];
|
|
};
|
|
};
|
|
|
|
eww-bar = {
|
|
Unit = {
|
|
Description = "Eww bar";
|
|
After = "eww.service";
|
|
};
|
|
Service = {
|
|
Type = "oneshot";
|
|
ExecStart = pkgs.writeShellScript "eww-bar-open" ''
|
|
# Lack of quotes intentional
|
|
exec ${eww}/bin/eww open-many \
|
|
$(${config.wayland.windowManager.hyprland.package}/bin/hyprctl monitors -j | \
|
|
${pkgs.jaq}/bin/jaq -r '.[] | .id' | \
|
|
${pkgs.gnused}/bin/sed 's/^/bar/')
|
|
'';
|
|
};
|
|
Install = {
|
|
WantedBy = [ "eww.service" ];
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|