diff options
| author | Jakub Stachurski <j.stachurski@student.utwente.nl> | 2026-01-17 20:13:22 +0100 |
|---|---|---|
| committer | Jakub Stachurski <j.stachurski@student.utwente.nl> | 2026-01-17 20:13:22 +0100 |
| commit | a36426ffd6314bd367f042410d81ae9807df2eee (patch) | |
| tree | 20437a0a03188fd1e3591ffc2e0b7aff81cffb56 | |
| parent | 69e57b6f623251df0c28bcb8e4634fb24c9546ac (diff) | |
Rewrite systemd service for mako so it only runs on hyprland
| -rw-r--r-- | home-modules/desktop/hyprland.nix | 1 | ||||
| -rw-r--r-- | home-modules/desktop/wayland/mako.nix | 48 |
2 files changed, 41 insertions, 8 deletions
diff --git a/home-modules/desktop/hyprland.nix b/home-modules/desktop/hyprland.nix index 80773d4..442910e 100644 --- a/home-modules/desktop/hyprland.nix +++ b/home-modules/desktop/hyprland.nix @@ -22,6 +22,7 @@ with lib; homeprogs.waybar.enable = true; homeprogs.mako.enable = true; + homeprogs.mako.systemdWantedBy = [ "hyprland-session.target" ]; # Environment variables for hyprland. # This can be used to configure wayland/hyprland-specific things home.file.".config/uwsm/env-hyprland".text = '' diff --git a/home-modules/desktop/wayland/mako.nix b/home-modules/desktop/wayland/mako.nix index ddf0a91..9b13e77 100644 --- a/home-modules/desktop/wayland/mako.nix +++ b/home-modules/desktop/wayland/mako.nix @@ -1,16 +1,48 @@ { + pkgs, config, lib, ... }: +let + cfg = config.homeprogs.mako; +in { - options.homeprogs.mako.enable = lib.mkEnableOption "Enable Mako notification manager"; - config = lib.mkIf config.homeprogs.mako.enable { - services.mako = { - enable = true; + options.homeprogs.mako = { + enable = lib.mkEnableOption "Enable Mako notification manager"; + systemdWantedBy = lib.mkOption { + description = "SystemD targets where mako should start for."; + default = [ "graphical-session.target"]; + example = [ "hyprland-session.target" ]; + type = lib.types.listOf lib.types.str; + }; + package = lib.mkOption { + description = "mako package to use"; + default = pkgs.mako; + example = pkgs.mako; + type = lib.types.package; }; - xdg.configFile."mako/config".source = ./mako.ini; - - }; - + }; + config = lib.mkIf config.homeprogs.mako.enable ({ + home.packages = [ pkgs.mako ]; + xdg.configFile."mako/config" = { + onChange = "${pkgs.mako}/bin/makoctl reload || true"; + source = ./mako.ini; + }; + systemd.user.services.mako = { + Install.WantedBy = config.homeprogs.mako.systemdWantedBy; + Unit = { + Description = "Lightweight Wayland notification daemon"; + Documentation="man:mako(1)"; + After= "graphical-session.target"; + } ; + Service = { + Type = "dbus"; + BusName = "org.freedesktop.Notifications"; + ExecCondition="/bin/sh -c '[ -n \"$WAYLAND_DISPLAY\" ]'"; + ExecStart="${cfg.package}/bin/mako"; + ExecReload="${cfg.package}/bin/makoctl reload"; + }; + }; + }); } |
