aboutsummaryrefslogtreecommitdiff
path: root/modules/services/dunst.nix
diff options
context:
space:
mode:
authorRobert Helgesson <robert@rycee.net>2020-02-02 00:39:17 +0100
committerRobert Helgesson <robert@rycee.net>2020-02-02 01:07:28 +0100
commit45abf3d38a2b51c00c347cab6950f3734e023bba (patch)
tree414fde5d14d1d075fa65e59175660fd1fb680c43 /modules/services/dunst.nix
parent9799d3de2d270a9c40fcf81d600bfd71088e144d (diff)
Apply `nixfmt` on many files
Diffstat (limited to 'modules/services/dunst.nix')
-rw-r--r--modules/services/dunst.nix171
1 files changed, 79 insertions, 92 deletions
diff --git a/modules/services/dunst.nix b/modules/services/dunst.nix
index 96b1f71a2fa..d32e875137b 100644
--- a/modules/services/dunst.nix
+++ b/modules/services/dunst.nix
@@ -6,17 +6,19 @@ let
cfg = config.services.dunst;
- eitherStrBoolIntList = with types; either str (either bool (either int (listOf str)));
+ eitherStrBoolIntList = with types;
+ either str (either bool (either int (listOf str)));
toDunstIni = generators.toINI {
mkKeyValue = key: value:
- let
- value' =
- if isBool value then (if value then "yes" else "no")
- else if isString value then "\"${value}\""
- else toString value;
- in
- "${key}=${value'}";
+ let
+ value' = if isBool value then
+ (if value then "yes" else "no")
+ else if isString value then
+ ''"${value}"''
+ else
+ toString value;
+ in "${key}=${value'}";
};
themeType = types.submodule {
@@ -48,9 +50,7 @@ let
size = "32x32";
};
-in
-
-{
+in {
meta.maintainers = [ maintainers.rycee ];
options = {
@@ -65,7 +65,7 @@ in
settings = mkOption {
type = with types; attrsOf (attrsOf eitherStrBoolIntList);
- default = {};
+ default = { };
description = "Configuration written to ~/.config/dunstrc";
example = literalExample ''
{
@@ -87,86 +87,73 @@ in
};
};
- config = mkIf cfg.enable (
- mkMerge [
- {
- xdg.dataFile."dbus-1/services/org.knopwob.dunst.service".source =
- "${pkgs.dunst}/share/dbus-1/services/org.knopwob.dunst.service";
-
- services.dunst.settings.global.icon_path =
- let
- useCustomTheme =
- cfg.iconTheme.package != hicolorTheme.package
- || cfg.iconTheme.name != hicolorTheme.name
- || cfg.iconTheme.size != hicolorTheme.size;
-
- basePaths = [
- "/run/current-system/sw"
- config.home.profileDirectory
- cfg.iconTheme.package
- ] ++ optional useCustomTheme hicolorTheme.package;
-
- themes =
- [
- cfg.iconTheme
- ] ++ optional useCustomTheme (
- hicolorTheme // { size = cfg.iconTheme.size; }
- );
-
- categories = [
- "actions"
- "animations"
- "apps"
- "categories"
- "devices"
- "emblems"
- "emotes"
- "filesystem"
- "intl"
- "mimetypes"
- "places"
- "status"
- "stock"
- ];
- in
- concatStringsSep ":" (
- concatMap (theme:
- concatMap (basePath:
- map (category:
- "${basePath}/share/icons/${theme.name}/${theme.size}/${category}"
- ) categories
- ) basePaths
- ) themes
- );
-
- systemd.user.services.dunst = {
- Unit = {
- Description = "Dunst notification daemon";
- After = [ "graphical-session-pre.target" ];
- PartOf = [ "graphical-session.target" ];
- };
-
- Service = {
- Type = "dbus";
- BusName = "org.freedesktop.Notifications";
- ExecStart = "${pkgs.dunst}/bin/dunst";
- };
+ config = mkIf cfg.enable (mkMerge [
+ {
+ xdg.dataFile."dbus-1/services/org.knopwob.dunst.service".source =
+ "${pkgs.dunst}/share/dbus-1/services/org.knopwob.dunst.service";
+
+ services.dunst.settings.global.icon_path = let
+ useCustomTheme = cfg.iconTheme.package != hicolorTheme.package
+ || cfg.iconTheme.name != hicolorTheme.name || cfg.iconTheme.size
+ != hicolorTheme.size;
+
+ basePaths = [
+ "/run/current-system/sw"
+ config.home.profileDirectory
+ cfg.iconTheme.package
+ ] ++ optional useCustomTheme hicolorTheme.package;
+
+ themes = [ cfg.iconTheme ] ++ optional useCustomTheme
+ (hicolorTheme // { size = cfg.iconTheme.size; });
+
+ categories = [
+ "actions"
+ "animations"
+ "apps"
+ "categories"
+ "devices"
+ "emblems"
+ "emotes"
+ "filesystem"
+ "intl"
+ "mimetypes"
+ "places"
+ "status"
+ "stock"
+ ];
+ in concatStringsSep ":" (concatMap (theme:
+ concatMap (basePath:
+ map (category:
+ "${basePath}/share/icons/${theme.name}/${theme.size}/${category}")
+ categories) basePaths) themes);
+
+ systemd.user.services.dunst = {
+ Unit = {
+ Description = "Dunst notification daemon";
+ After = [ "graphical-session-pre.target" ];
+ PartOf = [ "graphical-session.target" ];
};
- }
-
- (mkIf (cfg.settings != {}) {
- xdg.configFile."dunst/dunstrc" = {
- text = toDunstIni cfg.settings;
- onChange = ''
- pkillVerbose=""
- if [[ -v VERBOSE ]]; then
- pkillVerbose="-e"
- fi
- $DRY_RUN_CMD ${pkgs.procps}/bin/pkill -u $USER $pkillVerbose dunst || true
- unset pkillVerbose
- '';
+
+ Service = {
+ Type = "dbus";
+ BusName = "org.freedesktop.Notifications";
+ ExecStart = "${pkgs.dunst}/bin/dunst";
};
- })
- ]
- );
+ };
+ }
+
+ (mkIf (cfg.settings != { }) {
+ xdg.configFile."dunst/dunstrc" = {
+ text = toDunstIni cfg.settings;
+ onChange = ''
+ pkillVerbose=""
+ if [[ -v VERBOSE ]]; then
+ pkillVerbose="-e"
+ fi
+ $DRY_RUN_CMD ${pkgs.procps}/bin/pkill -u $USER $pkillVerbose dunst || true
+ unset pkillVerbose
+ '';
+ };
+ })
+ ]);
}