61208e3dee
Note: not the actual initial commit. I swear I will stop repeatedly force pushing to this single commit eventually ok.
96 lines
2.9 KiB
Nix
96 lines
2.9 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."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} \
|
|
'') ({
|
|
acpi = "${pkgs.acpi}/bin/acpi";
|
|
hyprctl = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl";
|
|
ruby = "${pkgs.ruby}/bin/ruby";
|
|
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 = {
|
|
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" ];
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|