diff --git a/Assets/Translations/zh-CN.json b/Assets/Translations/zh-CN.json index 0cd370f3..5f325884 100644 --- a/Assets/Translations/zh-CN.json +++ b/Assets/Translations/zh-CN.json @@ -617,7 +617,7 @@ } }, "session-menu": { - "action-in-seconds": "在 {seconds} 后将 {action}...", + "action-in-seconds": "在 {seconds} 秒后将{action}...", "lock": "锁定", "lock-and-suspend": "锁定并挂起", "logout": "注销", @@ -1342,7 +1342,7 @@ }, "respect-expire": { "description": "使用通知中设置的过期超时。", - "label": "启用过期超时" + "label": "尊重过期超时" }, "section": { "description": "根据紧急级别配置通知保持可见的时间。", @@ -1604,7 +1604,7 @@ "select-monitor-folder": "选择显示器壁纸文件夹", "selector-position": { "description": "选择壁纸选择面板的显示位置。", - "label": "显示位置" + "label": "选择器位置" } }, "title": "壁纸" diff --git a/README.md b/README.md index 0480a3c9..2a47a5b2 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,7 @@ While all donations are greatly appreciated, they are completely voluntary. * Nyxion ツ * MrDowntempo * Tempus Thales +* Raine --- diff --git a/nix/home-module.nix b/nix/home-module.nix index 713c8f65..c27e6725 100644 --- a/nix/home-module.nix +++ b/nix/home-module.nix @@ -16,6 +16,8 @@ in { options.programs.noctalia-shell = { enable = lib.mkEnableOption "Noctalia shell configuration"; + systemd.enable = lib.mkEnableOption "Noctalia shell systemd integration"; + package = lib.mkOption { type = lib.types.nullOr lib.types.package; description = "The noctalia-shell package to use"; @@ -23,13 +25,13 @@ in { settings = lib.mkOption { type = with lib.types; - nullOr (oneOf [ + oneOf [ attrs str path - ]); + ]; default = {}; - apply = x: lib.recursiveUpdate defaultSettings (extractAttrs x); + apply = x: if x == {} then x else lib.recursiveUpdate defaultSettings (extractAttrs x); example = lib.literalExpression '' { bar = { @@ -103,18 +105,48 @@ in { useApp2Unit = cfg.settings.appLauncher.useApp2Unit or false; in lib.mkIf cfg.enable { - home.packages = lib.optional useApp2Unit cfg.app2unit.package + systemd.user.services.noctalia-shell = lib.mkIf cfg.systemd.enable { + Unit = { + Description = "Noctalia Shell - Wayland desktop shell"; + Documentation = "https://docs.noctalia.dev/docs"; + PartOf = [ config.wayland.systemd.target ]; + After = [ config.wayland.systemd.target ]; + X-Restart-Triggers = + lib.optional (cfg.settings != {}) "${config.xdg.configFile."noctalia/settings.json".source}" + ++ lib.optional (cfg.colors != {}) "${config.xdg.configFile."noctalia/colors.json".source}"; + }; + + Service = { + ExecStart = lib.getExe cfg.package; + Restart = "on-failure"; + Environment = [ + "NOCTALIA_SETTINGS_FALLBACK=%h/.config/noctalia/gui-settings.json" + ]; + }; + + Install.WantedBy = [ config.wayland.systemd.target ]; + }; + + home.packages = + lib.optional useApp2Unit cfg.app2unit.package ++ lib.optional (cfg.package != null) cfg.package; xdg.configFile = { - "noctalia/settings.json" = { - onChange = restart; + "noctalia/settings.json" = lib.mkIf (cfg.settings != {}) { + onChange = lib.mkIf (!cfg.systemd.enable) restart; text = builtins.toJSON cfg.settings; }; "noctalia/colors.json" = lib.mkIf (cfg.colors != {}) { - onChange = restart; + onChange = lib.mkIf (!cfg.systemd.enable) restart; text = builtins.toJSON cfg.colors; }; }; + + assertions = [ + { + assertion = !cfg.systemd.enable || cfg.package != null; + message = "noctalia-shell: The package option must not be null when systemd service is enabled."; + } + ]; }; }