aboutsummaryrefslogtreecommitdiff
path: root/modules/services/dunst.nix
diff options
context:
space:
mode:
authorRobert Helgesson <robert@rycee.net>2017-11-07 00:27:46 +0100
committerRobert Helgesson <robert@rycee.net>2017-11-07 17:13:51 +0100
commitfad1e108d835bc4408634da11bff8e0fdb8d0cda (patch)
tree4752323a8843ec8f0447ca737c79550555dbf1d9 /modules/services/dunst.nix
parentfc3e82584bda579739f01b57e5f31adea2bce593 (diff)
dunst: add option `services.dunst.iconTheme`
Fixes #119
Diffstat (limited to 'modules/services/dunst.nix')
-rw-r--r--modules/services/dunst.nix81
1 files changed, 81 insertions, 0 deletions
diff --git a/modules/services/dunst.nix b/modules/services/dunst.nix
index a2f5dae9f92..e5c83da2575 100644
--- a/modules/services/dunst.nix
+++ b/modules/services/dunst.nix
@@ -16,6 +16,35 @@ let
"${key}=${value'}";
};
+ themeType = types.submodule {
+ options = {
+ package = mkOption {
+ type = types.package;
+ example = literalExample "pkgs.gnome3.adwaita-icon-theme";
+ description = "Package providing the theme.";
+ };
+
+ name = mkOption {
+ type = types.str;
+ example = "Adwaita";
+ description = "The name of the theme within the package.";
+ };
+
+ size = mkOption {
+ type = types.str;
+ default = "32x32";
+ example = "16x16";
+ description = "The desired icon size.";
+ };
+ };
+ };
+
+ hicolorTheme = {
+ package = pkgs.hicolor_icon_theme;
+ name = "hicolor";
+ size = "32x32";
+ };
+
in
{
@@ -25,6 +54,12 @@ in
services.dunst = {
enable = mkEnableOption "the dunst notification daemon";
+ iconTheme = mkOption {
+ type = themeType;
+ default = hicolorTheme;
+ description = "Set the icon theme.";
+ };
+
settings = mkOption {
type = types.attrsOf types.attrs;
default = {};
@@ -55,6 +90,52 @@ in
home.file.".local/share/dbus-1/services/org.knopwob.dunst.service".source =
"${pkgs.dunst}/share/dbus-1/services/org.knopwob.dunst.service";
+ services.dunst.settings.global.icon_folders =
+ let
+ useCustomTheme =
+ cfg.iconTheme.package != hicolorTheme.package
+ || cfg.iconTheme.name != hicolorTheme.name
+ || cfg.iconTheme.size != hicolorTheme.size;
+
+ basePaths = [
+ "/run/current-system/sw"
+ "${config.home.homeDirectory}/.nix-profile"
+ 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";