2020-03-23 10:52:02 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
2023-03-02 11:58:42 +01:00
|
|
|
cfg = config.services.mako;
|
2020-03-23 10:52:02 +01:00
|
|
|
|
|
|
|
in {
|
|
|
|
meta.maintainers = [ maintainers.onny ];
|
|
|
|
|
2023-03-02 11:58:42 +01:00
|
|
|
imports =
|
|
|
|
[ (mkRenamedOptionModule [ "programs" "mako" ] [ "services" "mako" ]) ];
|
|
|
|
|
2020-03-23 10:52:02 +01:00
|
|
|
options = {
|
2023-03-02 11:58:42 +01:00
|
|
|
services.mako = {
|
2023-07-02 01:45:18 +02:00
|
|
|
enable = mkEnableOption ''
|
2020-03-23 10:52:02 +01:00
|
|
|
Mako, lightweight notification daemon for Wayland
|
2023-07-02 01:45:18 +02:00
|
|
|
'';
|
2020-03-23 10:52:02 +01:00
|
|
|
|
2022-05-13 16:27:23 +02:00
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.mako;
|
|
|
|
defaultText = literalExpression "pkgs.mako";
|
2023-07-02 01:45:18 +02:00
|
|
|
description = "The mako package to use.";
|
2022-05-13 16:27:23 +02:00
|
|
|
};
|
|
|
|
|
2020-03-23 10:52:02 +01:00
|
|
|
maxVisible = mkOption {
|
|
|
|
default = 5;
|
|
|
|
type = types.nullOr types.int;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2020-03-23 10:52:02 +01:00
|
|
|
Set maximum number of visible notifications. Set -1 to show all.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
sort = mkOption {
|
|
|
|
default = "-time";
|
|
|
|
type =
|
|
|
|
types.nullOr (types.enum [ "+time" "-time" "+priority" "-priority" ]);
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2020-03-23 10:52:02 +01:00
|
|
|
Sorts incoming notifications by time and/or priority in ascending(+)
|
|
|
|
or descending(-) order.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
output = mkOption {
|
|
|
|
default = null;
|
|
|
|
type = types.nullOr types.str;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2020-03-23 10:52:02 +01:00
|
|
|
Show notifications on the specified output. If empty, notifications
|
|
|
|
will appear on the focused output. Requires the compositor to support
|
|
|
|
the Wayland protocol xdg-output-unstable-v1 version 2.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
layer = mkOption {
|
|
|
|
default = "top";
|
|
|
|
type =
|
|
|
|
types.nullOr (types.enum [ "background" "bottom" "top" "overlay" ]);
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2020-03-23 10:52:02 +01:00
|
|
|
Arrange mako at the specified layer, relative to normal windows.
|
|
|
|
Supported values are background, bottom, top, and overlay. Using
|
|
|
|
overlay will cause notifications to be displayed above fullscreen
|
|
|
|
windows, though this may also occur at top depending on your
|
|
|
|
compositor.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
anchor = mkOption {
|
|
|
|
default = "top-right";
|
|
|
|
type = types.nullOr (types.enum [
|
|
|
|
"top-right"
|
|
|
|
"top-center"
|
|
|
|
"top-left"
|
|
|
|
"bottom-right"
|
|
|
|
"bottom-center"
|
|
|
|
"bottom-left"
|
|
|
|
"center"
|
|
|
|
]);
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2020-03-23 10:52:02 +01:00
|
|
|
Show notifications at the specified position on the output.
|
|
|
|
Supported values are top-right, top-center, top-left, bottom-right,
|
|
|
|
bottom-center, bottom-left, and center.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
font = mkOption {
|
|
|
|
default = "monospace 10";
|
|
|
|
type = types.nullOr types.str;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2020-03-23 10:52:02 +01:00
|
|
|
Font to use, in Pango format.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
backgroundColor = mkOption {
|
|
|
|
default = "#285577FF";
|
|
|
|
type = types.nullOr types.str;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2020-03-23 10:52:02 +01:00
|
|
|
Set popup background color to a specific color, represented in hex
|
|
|
|
color code.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
textColor = mkOption {
|
|
|
|
default = "#FFFFFFFF";
|
|
|
|
type = types.nullOr types.str;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2020-03-23 10:52:02 +01:00
|
|
|
Set popup text color to a specific color, represented in hex color
|
|
|
|
code.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
width = mkOption {
|
|
|
|
default = 300;
|
|
|
|
type = types.nullOr types.int;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2020-03-23 10:52:02 +01:00
|
|
|
Set width of notification popups in specified number of pixels.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
height = mkOption {
|
|
|
|
default = 100;
|
|
|
|
type = types.nullOr types.int;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2020-03-23 10:52:02 +01:00
|
|
|
Set maximum height of notification popups. Notifications whose text
|
|
|
|
takes up less space are shrunk to fit.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
margin = mkOption {
|
|
|
|
default = "10";
|
|
|
|
type = types.nullOr types.str;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2020-03-23 10:52:02 +01:00
|
|
|
Set margin of each edge specified in pixels. Specify single value to
|
2022-12-03 05:20:00 +01:00
|
|
|
apply margin on all sides. Two comma-separated values will set
|
2023-01-24 11:30:04 +01:00
|
|
|
vertical and horizontal edges separately. Four comma-separated will
|
|
|
|
give each edge a separate value.
|
2020-03-23 10:52:02 +01:00
|
|
|
For example: 10,20,5 will set top margin to 10, left and right to 20
|
|
|
|
and bottom to five.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
padding = mkOption {
|
|
|
|
default = "5";
|
|
|
|
type = types.nullOr types.str;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2020-03-23 10:52:02 +01:00
|
|
|
Set padding of each edge specified in pixels. Specify single value to
|
2022-12-03 05:20:00 +01:00
|
|
|
apply margin on all sides. Two comma-separated values will set
|
2023-01-24 11:30:04 +01:00
|
|
|
vertical and horizontal edges separately. Four comma-separated will
|
|
|
|
give each edge a separate value.
|
2020-03-23 10:52:02 +01:00
|
|
|
For example: 10,20,5 will set top margin to 10, left and right to 20
|
|
|
|
and bottom to five.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
borderSize = mkOption {
|
|
|
|
default = 1;
|
|
|
|
type = types.nullOr types.int;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2020-03-23 10:52:02 +01:00
|
|
|
Set popup border size to the specified number of pixels.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
borderColor = mkOption {
|
|
|
|
default = "#4C7899FF";
|
|
|
|
type = types.nullOr types.str;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2020-03-23 10:52:02 +01:00
|
|
|
Set popup border color to a specific color, represented in hex color
|
|
|
|
code.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
borderRadius = mkOption {
|
|
|
|
default = 0;
|
|
|
|
type = types.nullOr types.int;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2020-03-23 10:52:02 +01:00
|
|
|
Set popup corner radius to the specified number of pixels.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
progressColor = mkOption {
|
|
|
|
default = "over #5588AAFF";
|
|
|
|
type = types.nullOr types.str;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2020-03-23 10:52:02 +01:00
|
|
|
Set popup progress indicator color to a specific color,
|
|
|
|
represented in hex color code. To draw the progress
|
|
|
|
indicator on top of the background color, use the
|
2023-07-01 01:30:13 +02:00
|
|
|
`over` attribute. To replace the background
|
|
|
|
color, use the `source` attribute (this can
|
2020-03-23 10:52:02 +01:00
|
|
|
be useful when the notification is semi-transparent).
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
icons = mkOption {
|
|
|
|
default = true;
|
|
|
|
type = types.nullOr types.bool;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2020-03-23 10:52:02 +01:00
|
|
|
Whether or not to show icons in notifications.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
maxIconSize = mkOption {
|
|
|
|
default = 64;
|
|
|
|
type = types.nullOr types.int;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2020-03-23 10:52:02 +01:00
|
|
|
Set maximum icon size to the specified number of pixels.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
iconPath = mkOption {
|
|
|
|
default = null;
|
|
|
|
type = types.nullOr types.str;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2020-03-23 10:52:02 +01:00
|
|
|
Paths to search for icons when a notification specifies a name
|
|
|
|
instead of a full path. Colon-delimited. This approximates the search
|
|
|
|
algorithm used by the XDG Icon Theme Specification, but does not
|
|
|
|
support any of the theme metadata. Therefore, if you want to search
|
|
|
|
parent themes, you'll need to add them to the path manually.
|
2023-07-01 01:30:13 +02:00
|
|
|
|
|
|
|
The {file}`/usr/share/icons/hicolor` and
|
|
|
|
{file}`/usr/share/pixmaps` directories are
|
2020-03-23 10:52:02 +01:00
|
|
|
always searched.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
markup = mkOption {
|
|
|
|
default = true;
|
|
|
|
type = types.nullOr types.bool;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2020-03-23 10:52:02 +01:00
|
|
|
If 1, enable Pango markup. If 0, disable Pango markup. If enabled,
|
|
|
|
Pango markup will be interpreted in your format specifier and in the
|
|
|
|
body of notifications.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
actions = mkOption {
|
|
|
|
default = true;
|
|
|
|
type = types.nullOr types.bool;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2020-03-23 10:52:02 +01:00
|
|
|
Applications may request an action to be associated with activating a
|
|
|
|
notification. Disabling this will cause mako to ignore these requests.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
format = mkOption {
|
|
|
|
default = "<b>%s</b>\\n%b";
|
|
|
|
type = types.nullOr types.str;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2020-03-23 10:52:02 +01:00
|
|
|
Set notification format string to format. See FORMAT SPECIFIERS for
|
|
|
|
more information. To change this for grouped notifications, set it
|
|
|
|
within a grouped criteria.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
defaultTimeout = mkOption {
|
|
|
|
default = 0;
|
|
|
|
type = types.nullOr types.int;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2020-03-23 10:52:02 +01:00
|
|
|
Set the default timeout to timeout in milliseconds. To disable the
|
|
|
|
timeout, set it to zero.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
ignoreTimeout = mkOption {
|
|
|
|
default = false;
|
|
|
|
type = types.nullOr types.bool;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2020-03-23 10:52:02 +01:00
|
|
|
If set, mako will ignore the expire timeout sent by notifications
|
|
|
|
and use the one provided by default-timeout instead.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
groupBy = mkOption {
|
|
|
|
default = null;
|
|
|
|
type = types.nullOr types.str;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2020-03-23 10:52:02 +01:00
|
|
|
A comma-separated list of criteria fields that will be compared to
|
|
|
|
other visible notifications to determine if this one should form a
|
|
|
|
group with them. All listed criteria must be exactly equal for two
|
|
|
|
notifications to group.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2020-12-21 13:11:38 +01:00
|
|
|
extraConfig = mkOption {
|
|
|
|
default = "";
|
|
|
|
type = types.lines;
|
2021-10-09 11:14:08 +02:00
|
|
|
example = literalExpression ''
|
2020-12-21 13:11:38 +01:00
|
|
|
[urgency=low]
|
|
|
|
border-color=#b8bb26
|
|
|
|
'';
|
2023-07-02 01:45:18 +02:00
|
|
|
description = "Additional configuration.";
|
2020-12-21 13:11:38 +01:00
|
|
|
};
|
2020-03-23 10:52:02 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = let
|
|
|
|
boolToString = v: if v then "true" else "false";
|
|
|
|
optionalBoolean = name: val:
|
|
|
|
lib.optionalString (val != null) "${name}=${boolToString val}";
|
|
|
|
optionalInteger = name: val:
|
|
|
|
lib.optionalString (val != null) "${name}=${toString val}";
|
|
|
|
optionalString = name: val:
|
|
|
|
lib.optionalString (val != null) "${name}=${val}";
|
|
|
|
in mkIf cfg.enable {
|
2021-07-07 23:24:27 +02:00
|
|
|
assertions =
|
|
|
|
[ (hm.assertions.assertPlatform "services.mako" pkgs platforms.linux) ];
|
|
|
|
|
2022-05-13 16:27:23 +02:00
|
|
|
home.packages = [ cfg.package ];
|
2021-07-07 23:24:27 +02:00
|
|
|
|
2021-08-29 03:57:22 +02:00
|
|
|
xdg.configFile."mako/config" = {
|
|
|
|
onChange = ''
|
2022-05-13 16:27:23 +02:00
|
|
|
${cfg.package}/bin/makoctl reload || true
|
2021-08-29 03:57:22 +02:00
|
|
|
'';
|
|
|
|
text = ''
|
|
|
|
${optionalInteger "max-visible" cfg.maxVisible}
|
|
|
|
${optionalString "sort" cfg.sort}
|
|
|
|
${optionalString "output" cfg.output}
|
|
|
|
${optionalString "layer" cfg.layer}
|
|
|
|
${optionalString "anchor" cfg.anchor}
|
|
|
|
|
|
|
|
${optionalString "font" cfg.font}
|
|
|
|
${optionalString "background-color" cfg.backgroundColor}
|
|
|
|
${optionalString "text-color" cfg.textColor}
|
|
|
|
${optionalInteger "width" cfg.width}
|
|
|
|
${optionalInteger "height" cfg.height}
|
|
|
|
${optionalString "margin" cfg.margin}
|
|
|
|
${optionalString "padding" cfg.padding}
|
|
|
|
${optionalInteger "border-size" cfg.borderSize}
|
|
|
|
${optionalString "border-color" cfg.borderColor}
|
|
|
|
${optionalInteger "border-radius" cfg.borderRadius}
|
|
|
|
${optionalString "progress-color" cfg.progressColor}
|
|
|
|
${optionalBoolean "icons" cfg.icons}
|
|
|
|
${optionalInteger "max-icon-size" cfg.maxIconSize}
|
|
|
|
${optionalString "icon-path" cfg.iconPath}
|
|
|
|
${optionalBoolean "markup" cfg.markup}
|
|
|
|
${optionalBoolean "actions" cfg.actions}
|
|
|
|
${optionalString "format" cfg.format}
|
|
|
|
${optionalInteger "default-timeout" cfg.defaultTimeout}
|
|
|
|
${optionalBoolean "ignore-timeout" cfg.ignoreTimeout}
|
|
|
|
${optionalString "group-by" cfg.groupBy}
|
|
|
|
|
|
|
|
${cfg.extraConfig}
|
|
|
|
'';
|
|
|
|
};
|
2020-03-23 10:52:02 +01:00
|
|
|
};
|
|
|
|
}
|