summaryrefslogtreecommitdiff
path: root/home-modules/desktop/wayland/mako.nix
blob: 9b13e770f3f7ce13b5790c76558615e1e7e7203e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{
  pkgs, 
  config,
  lib,
  ...
}:
let
   cfg = config.homeprogs.mako; 
in 
{
  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; 
    };
  }; 
  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"; 
      };
    };
  });
}