Skip to content

armgit / Handy

Public Imported from GitHub
0

A free, open source, and extensible speech-to-text application that works completely offline.

Disable update checks for Nix/NixOS packaging (#1576)

Evgeny Khudobab0266607df2a
diff --git a/AGENTS.md b/AGENTS.md
index 2b37bea4..daeea5f4 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -199,6 +199,7 @@ Access debug features: `Cmd+Shift+D` (macOS) or `Ctrl+Shift+D` (Windows/Linux)
- **macOS**: Metal acceleration, accessibility permissions required for keyboard shortcuts
- **Windows**: Vulkan acceleration, code signing
- **Linux**: OpenBLAS + Vulkan, limited Wayland support, overlay uses GTK layer shell (disable with `HANDY_NO_GTK_LAYER_SHELL=1`)
+- **Nix/NixOS**: the Nix package sets `HANDY_DISABLE_UPDATER=1` to force-disable the self-updater at runtime without touching the persisted setting (self-update can't work against an immutable `/nix/store`)
## Troubleshooting
diff --git a/flake.nix b/flake.nix
index 00fddddc..28e217cc 100644
--- a/flake.nix
+++ b/flake.nix
@@ -169,6 +169,10 @@
gappsWrapperArgs+=(
--set WEBKIT_DISABLE_DMABUF_RENDERER 1
--set ALSA_PLUGIN_DIR "${combinedAlsaPlugins}"
+ # Self-update can't work against an immutable /nix/store install
+ # (downloadAndInstall would try to overwrite the store path), so
+ # the Nix-built package always disables the updater.
+ --set HANDY_DISABLE_UPDATER 1
)
'';
diff --git a/src-tauri/src/commands/mod.rs b/src-tauri/src/commands/mod.rs
index 4efc2817..e3c4238b 100644
--- a/src-tauri/src/commands/mod.rs
+++ b/src-tauri/src/commands/mod.rs
@@ -3,7 +3,9 @@ pub mod history;
pub mod models;
pub mod transcription;
-use crate::settings::{get_settings, write_settings, AppSettings, LogLevel};
+use crate::settings::{
+ get_settings, update_checks_forced_disabled, write_settings, AppSettings, LogLevel,
+};
use crate::utils::cancel_current_operation;
use tauri::{AppHandle, Manager};
use tauri_plugin_opener::OpenerExt;
@@ -20,6 +22,12 @@ pub fn is_portable() -> bool {
crate::portable::is_portable()
}
+#[tauri::command]
+#[specta::specta]
+pub fn is_update_checks_locked() -> bool {
+ update_checks_forced_disabled()
+}
+
#[tauri::command]
#[specta::specta]
pub fn get_app_dir_path(app: AppHandle) -> Result<String, String> {
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 98df83e1..c8bbf1dc 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -261,7 +261,7 @@ fn initialize_core_logic(app_handle: &AppHandle) {
}
"check_updates" => {
let settings = settings::get_settings(app);
- if settings.update_checks_enabled {
+ if settings::update_checks_effectively_enabled(&settings) {
show_main_window(app);
let _ = app.emit("check-for-updates", ());
}
@@ -341,7 +341,7 @@ fn initialize_core_logic(app_handle: &AppHandle) {
#[specta::specta]
fn trigger_update_check(app: AppHandle) -> Result<(), String> {
let settings = settings::get_settings(&app);
- if !settings.update_checks_enabled {
+ if !settings::update_checks_effectively_enabled(&settings) {
return Ok(());
}
app.emit("check-for-updates", ())
@@ -680,6 +680,7 @@ pub fn run(cli_args: CliArgs) {
show_main_window_command,
commands::cancel_operation,
commands::is_portable,
+ commands::is_update_checks_locked,
commands::get_app_dir_path,
commands::get_app_settings,
commands::get_default_settings,
diff --git a/src-tauri/src/overlay.rs b/src-tauri/src/overlay.rs
index a51ab855..1157a6b5 100644
--- a/src-tauri/src/overlay.rs
+++ b/src-tauri/src/overlay.rs
@@ -18,10 +18,10 @@ use tauri::WebviewUrl;
use tauri_nspanel::{tauri_panel, CollectionBehavior, PanelBuilder, PanelLevel, StyleMask};
#[cfg(target_os = "linux")]
-use gtk_layer_shell::{Edge, KeyboardMode, Layer, LayerShell};
+use crate::utils;
#[cfg(target_os = "linux")]
-use std::env;
+use gtk_layer_shell::{Edge, KeyboardMode, Layer, LayerShell};
#[cfg(target_os = "macos")]
tauri_panel! {
@@ -112,26 +112,11 @@ fn configure_layer_shell_surface(
gtk_window.resize(1, 1);
}
-/// Returns true when the environment variable is set to a truthy value
-/// (e.g. "1", "true", "yes", "on").
-/// "0", "false", "no", "off" and empty string are treated as falsy (case-insensitive).
-/// Returns false when the variable is not set.
-#[cfg(target_os = "linux")]
-fn env_flag_enabled(name: &str) -> bool {
- match env::var(name) {
- Ok(v) => !matches!(
- v.trim().to_ascii_lowercase().as_str(),
- "" | "0" | "false" | "no" | "off"
- ),
- Err(_) => false,
- }
-}
-
/// Initializes GTK layer shell for Linux overlay window
/// Returns true if layer shell was successfully initialized, false otherwise
#[cfg(target_os = "linux")]
fn init_gtk_layer_shell(overlay_window: &tauri::webview::WebviewWindow) -> bool {
- if env_flag_enabled("HANDY_NO_GTK_LAYER_SHELL") {
+ if utils::env_flag_enabled("HANDY_NO_GTK_LAYER_SHELL") {
debug!("Skipping GTK layer shell init (HANDY_NO_GTK_LAYER_SHELL is enabled)");
return false;
}
diff --git a/src-tauri/src/settings.rs b/src-tauri/src/settings.rs
index 76d5127f..8e50fbd9 100644
--- a/src-tauri/src/settings.rs
+++ b/src-tauri/src/settings.rs
@@ -1,3 +1,4 @@
+use crate::utils;
use log::{debug, warn};
use serde::de::{self, Visitor};
use serde::{Deserialize, Deserializer, Serialize};
@@ -1151,6 +1152,23 @@ fn apply_settings_migrations(
updated
}
+/// Update checks are forced off (without touching the persisted setting) when
+/// `HANDY_DISABLE_UPDATER` is set — e.g. by the Nix package, since self-update
+/// can't work against an immutable /nix/store install.
+pub fn update_checks_forced_disabled() -> bool {
+ use std::sync::OnceLock;
+ static IS_UPDATER_DISABLED: OnceLock<bool> = OnceLock::new();
+ *IS_UPDATER_DISABLED.get_or_init(|| utils::env_flag_enabled("HANDY_DISABLE_UPDATER"))
+}
+
+/// Effective updater state: the user's stored preference, overridden to `false`
+/// while `HANDY_DISABLE_UPDATER` is set. Callers deciding whether to actually
+/// check for updates must use this rather than reading `update_checks_enabled`
+/// directly, so the forced-off state never leaks into the persisted setting.
+pub fn update_checks_effectively_enabled(settings: &AppSettings) -> bool {
+ settings.update_checks_enabled && !update_checks_forced_disabled()
+}
+
pub fn write_settings(app: &AppHandle, settings: AppSettings) {
let store = app
.store(crate::portable::store_path(SETTINGS_STORE_PATH))
diff --git a/src-tauri/src/shortcut/mod.rs b/src-tauri/src/shortcut/mod.rs
index 6594c27c..cb9ff4a4 100644
--- a/src-tauri/src/shortcut/mod.rs
+++ b/src-tauri/src/shortcut/mod.rs
@@ -751,6 +751,12 @@ pub fn change_autostart_setting(app: AppHandle, enabled: bool) -> Result<(), Str
#[tauri::command]
#[specta::specta]
pub fn change_update_checks_setting(app: AppHandle, enabled: bool) -> Result<(), String> {
+ if settings::update_checks_forced_disabled() {
+ return Err(
+ "Update checks are disabled by system configuration (HANDY_DISABLE_UPDATER)".into(),
+ );
+ }
+
let mut settings = settings::get_settings(&app);
settings.update_checks_enabled = enabled;
settings::write_settings(&app, settings);
diff --git a/src-tauri/src/tray.rs b/src-tauri/src/tray.rs
index aba2f045..8db5eb71 100644
--- a/src-tauri/src/tray.rs
+++ b/src-tauri/src/tray.rs
@@ -452,7 +452,9 @@ fn version_label() -> String {
}
/// Builds the tray menu and tooltip for the given inputs. Pure with respect
-/// to app state: everything it depends on is in `inputs`.
+/// to app state: everything it depends on is in `inputs`, plus the
+/// process-constant `HANDY_DISABLE_UPDATER` env flag behind
+/// `update_checks_forced_disabled()`, which cannot change during a run.
fn build_menu(app: &AppHandle, inputs: &MenuInputs) -> tauri::Result<(Menu<tauri::Wry>, String)> {
let strings = get_tray_translations(Some(inputs.locale.clone()));
@@ -570,6 +572,16 @@ fn build_menu(app: &AppHandle, inputs: &MenuInputs) -> tauri::Result<(Menu<tauri
)?
};
+ // When update checks are forced off (e.g. HANDY_DISABLE_UPDATER, set by
+ // the Nix package), the item is dropped from the menu rather than shown
+ // disabled — it can never do anything in that case, and a disabled item
+ // still shifts every entry below it by one position. A manually-disabled
+ // toggle in Debug Settings keeps the old greyed-out behavior via the
+ // enabled flag.
+ if settings::update_checks_forced_disabled() {
+ menu.remove(&check_updates_i)?;
+ }
+
// Both layouts start with [version, separator, ...]; slot the warning in
// right below the version line so it's the first actionable thing seen.
let mut tooltip = version_label;
diff --git a/src-tauri/src/utils.rs b/src-tauri/src/utils.rs
index d62cc460..d80ec2a4 100644
--- a/src-tauri/src/utils.rs
+++ b/src-tauri/src/utils.rs
@@ -151,6 +151,20 @@ pub fn is_gnome_wayland() -> bool {
is_wayland() && is_gnome()
}
+/// Returns true when the environment variable is set to a truthy value
+/// (e.g. "1", "true", "yes", "on").
+/// "0", "false", "no", "off" and empty string are treated as falsy (case-insensitive).
+/// Returns false when the variable is not set.
+pub fn env_flag_enabled(name: &str) -> bool {
+ match std::env::var(name) {
+ Ok(v) => !matches!(
+ v.trim().to_ascii_lowercase().as_str(),
+ "" | "0" | "false" | "no" | "off"
+ ),
+ Err(_) => false,
+ }
+}
+
#[cfg(test)]
mod tests {
use super::*;
@@ -162,4 +176,24 @@ mod tests {
assert!(!native_machine_is_arm64(Some(0x014c))); // I386
assert!(!native_machine_is_arm64(None)); // API unavailable or failed
}
+
+ #[test]
+ fn env_flag_enabled_true_for_truthy_values() {
+ for value in ["1", "true", "TRUE", "yes", "on", " 1 "] {
+ std::env::set_var("HANDY_TEST_FLAG_TRUTHY", value);
+ assert!(env_flag_enabled("HANDY_TEST_FLAG_TRUTHY"), "{value:?}");
+ }
+ std::env::remove_var("HANDY_TEST_FLAG_TRUTHY");
+ }
+
+ #[test]
+ fn env_flag_enabled_false_for_falsy_or_unset() {
+ assert!(!env_flag_enabled("HANDY_TEST_FLAG_UNSET"));
+
+ for value in ["0", "false", "FALSE", "no", "off", ""] {
+ std::env::set_var("HANDY_TEST_FLAG_FALSY", value);
+ assert!(!env_flag_enabled("HANDY_TEST_FLAG_FALSY"), "{value:?}");
+ }
+ std::env::remove_var("HANDY_TEST_FLAG_FALSY");
+ }
}
diff --git a/src/bindings.ts b/src/bindings.ts
index 7710120a..8570ea68 100644
--- a/src/bindings.ts
+++ b/src/bindings.ts
@@ -525,6 +525,9 @@ async cancelOperation() : Promise<void> {
async isPortable() : Promise<boolean> {
return await TAURI_INVOKE("is_portable");
},
+async isUpdateChecksLocked() : Promise<boolean> {
+ return await TAURI_INVOKE("is_update_checks_locked");
+},
async getAppDirPath() : Promise<Result<string, string>> {
try {
return { status: "ok", data: await TAURI_INVOKE("get_app_dir_path") };
diff --git a/src/components/settings/UpdateChecksToggle.tsx b/src/components/settings/UpdateChecksToggle.tsx
index 675dc3a4..4adc6a2e 100644
--- a/src/components/settings/UpdateChecksToggle.tsx
+++ b/src/components/settings/UpdateChecksToggle.tsx
@@ -13,16 +13,22 @@ export const UpdateChecksToggle: React.FC<UpdateChecksToggleProps> = ({
grouped = false,
}) => {
const { t } = useTranslation();
- const { getSetting, updateSetting, isUpdating } = useSettings();
+ const { getSetting, updateSetting, isUpdating, updateChecksLocked } =
+ useSettings();
const updateChecksEnabled = getSetting("update_checks_enabled") ?? true;
return (
<ToggleSwitch
- checked={updateChecksEnabled}
+ checked={updateChecksLocked ? false : updateChecksEnabled}
onChange={(enabled) => updateSetting("update_checks_enabled", enabled)}
isUpdating={isUpdating("update_checks_enabled")}
+ disabled={updateChecksLocked !== false}
label={t("settings.debug.updateChecks.label")}
- description={t("settings.debug.updateChecks.description")}
+ description={
+ updateChecksLocked
+ ? t("settings.debug.updateChecks.lockedDescription")
+ : t("settings.debug.updateChecks.description")
+ }
descriptionMode={descriptionMode}
grouped={grouped}
/>
diff --git a/src/components/update-checker/UpdateChecker.tsx b/src/components/update-checker/UpdateChecker.tsx
index aea87bf6..74228418 100644
--- a/src/components/update-checker/UpdateChecker.tsx
+++ b/src/components/update-checker/UpdateChecker.tsx
@@ -31,9 +31,16 @@ const UpdateChecker: React.FC<UpdateCheckerProps> = ({ className = "" }) => {
PORTABLE_RELEASES_URL,
);
- const { settings, isLoading } = useSettings();
- const settingsLoaded = !isLoading && settings !== null;
- const updateChecksEnabled = settings?.update_checks_enabled ?? false;
+ const { settings, isLoading, updateChecksLocked } = useSettings();
+ // Wait for the lock state too (null = not loaded yet), otherwise the first
+ // render could fire an update check before HANDY_DISABLE_UPDATER is known.
+ const settingsLoaded =
+ !isLoading && settings !== null && updateChecksLocked !== null;
+ // Forced-off by system configuration (HANDY_DISABLE_UPDATER) overrides the
+ // stored preference without persisting it, mirroring the backend's effective
+ // updater state.
+ const updateChecksEnabled =
+ (settings?.update_checks_enabled ?? false) && updateChecksLocked === false;
const upToDateTimeoutRef = useRef<ReturnType<typeof setTimeout>>();
const isManualCheckRef = useRef(false);
diff --git a/src/hooks/useSettings.ts b/src/hooks/useSettings.ts
index ab6b830d..33c17d3d 100644
--- a/src/hooks/useSettings.ts
+++ b/src/hooks/useSettings.ts
@@ -11,6 +11,7 @@ interface UseSettingsReturn {
outputDevices: AudioDevice[];
audioFeedbackEnabled: boolean;
postProcessModelOptions: Record<string, string[]>;
+ updateChecksLocked: boolean | null;
// Actions
updateSetting: <K extends keyof Settings>(
@@ -61,6 +62,7 @@ export const useSettings = (): UseSettingsReturn => {
outputDevices: store.outputDevices,
audioFeedbackEnabled: store.settings?.audio_feedback || false,
postProcessModelOptions: store.postProcessModelOptions,
+ updateChecksLocked: store.updateChecksLocked,
updateSetting: store.updateSetting,
resetSetting: store.resetSetting,
refreshSettings: store.refreshSettings,
diff --git a/src/i18n/locales/ar/translation.json b/src/i18n/locales/ar/translation.json
index 6fdd2160..64d94c56 100644
--- a/src/i18n/locales/ar/translation.json
+++ b/src/i18n/locales/ar/translation.json
@@ -459,7 +459,8 @@
},
"updateChecks": {
"label": "التحقق من وجود تحديثات",
- "description": "التحقق تلقائياً من وجود إصدارات جديدة من Handy"
+ "description": "التحقق تلقائياً من وجود إصدارات جديدة من Handy",
+ "lockedDescription": "معطّل بواسطة إعدادات النظام (HANDY_DISABLE_UPDATER)"
},
"soundTheme": {
"label": "سمة الصوت",
diff --git a/src/i18n/locales/bg/translation.json b/src/i18n/locales/bg/translation.json
index 50132e96..5f363f90 100644
--- a/src/i18n/locales/bg/translation.json
+++ b/src/i18n/locales/bg/translation.json
@@ -482,7 +482,8 @@
},
"updateChecks": {
"label": "Проверка за актуализации",
- "description": "Автоматична проверка за нови версии на Handy"
+ "description": "Автоматична проверка за нови версии на Handy",
+ "lockedDescription": "Деактивирано от системната конфигурация (HANDY_DISABLE_UPDATER)"
},
"soundTheme": {
"label": "Звукова тема",
diff --git a/src/i18n/locales/cs/translation.json b/src/i18n/locales/cs/translation.json
index 866c35d9..929fa61c 100644
--- a/src/i18n/locales/cs/translation.json
+++ b/src/i18n/locales/cs/translation.json
@@ -482,7 +482,8 @@
},
"updateChecks": {
"label": "Kontrolovat aktualizace",
- "description": "Automaticky kontrolovat nové verze Handy"
+ "description": "Automaticky kontrolovat nové verze Handy",
+ "lockedDescription": "Zakázáno systémovou konfigurací (HANDY_DISABLE_UPDATER)"
},
"soundTheme": {
"label": "Zvukový motiv",
diff --git a/src/i18n/locales/da/translation.json b/src/i18n/locales/da/translation.json
index 14eaf654..efbe92b3 100644
--- a/src/i18n/locales/da/translation.json
+++ b/src/i18n/locales/da/translation.json
@@ -482,7 +482,8 @@
},
"updateChecks": {
"label": "Tjek for opdateringer",
- "description": "Tjek automatisk for nye versioner af Handy"
+ "description": "Tjek automatisk for nye versioner af Handy",
+ "lockedDescription": "Deaktiveret af systemkonfiguration (HANDY_DISABLE_UPDATER)"
},
"whatsNewPreview": {
"title": "Forhåndsvisning af nyheder",
diff --git a/src/i18n/locales/de/translation.json b/src/i18n/locales/de/translation.json
index fc920d95..241266d1 100644
--- a/src/i18n/locales/de/translation.json
+++ b/src/i18n/locales/de/translation.json
@@ -482,7 +482,8 @@
},
"updateChecks": {
"label": "Nach Updates suchen",
- "description": "Automatisch nach neuen Versionen von Handy suchen"
+ "description": "Automatisch nach neuen Versionen von Handy suchen",
+ "lockedDescription": "Durch Systemkonfiguration deaktiviert (HANDY_DISABLE_UPDATER)"
},
"soundTheme": {
"label": "Sound-Thema",
diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json
index 27121cbc..e9e1eb17 100644
--- a/src/i18n/locales/en/translation.json
+++ b/src/i18n/locales/en/translation.json
@@ -482,7 +482,8 @@
},
"updateChecks": {
"label": "Check for Updates",
- "description": "Automatically check for new versions of Handy"
+ "description": "Automatically check for new versions of Handy",
+ "lockedDescription": "Disabled by system configuration (HANDY_DISABLE_UPDATER)"
},
"whatsNewPreview": {
"title": "Preview What's New",
diff --git a/src/i18n/locales/es/translation.json b/src/i18n/locales/es/translation.json
index db106c82..fc79123e 100644
--- a/src/i18n/locales/es/translation.json
+++ b/src/i18n/locales/es/translation.json
@@ -482,7 +482,8 @@
},
"updateChecks": {
"label": "Buscar actualizaciones",
- "description": "Buscar automáticamente nuevas versiones de Handy"
+ "description": "Buscar automáticamente nuevas versiones de Handy",
+ "lockedDescription": "Deshabilitado por la configuración del sistema (HANDY_DISABLE_UPDATER)"
},
"soundTheme": {
"label": "Tema de sonido",
diff --git a/src/i18n/locales/fr/translation.json b/src/i18n/locales/fr/translation.json
index a268f1be..349ebb22 100644
--- a/src/i18n/locales/fr/translation.json
+++ b/src/i18n/locales/fr/translation.json
@@ -482,7 +482,8 @@
},
"updateChecks": {
"label": "Vérifier les mises à jour",
- "description": "Vérifier automatiquement les nouvelles versions de Handy"
+ "description": "Vérifier automatiquement les nouvelles versions de Handy",
+ "lockedDescription": "Désactivé par la configuration système (HANDY_DISABLE_UPDATER)"
},
"soundTheme": {
"label": "Thème sonore",
diff --git a/src/i18n/locales/he/translation.json b/src/i18n/locales/he/translation.json
index 4addf774..bee57cd0 100644
--- a/src/i18n/locales/he/translation.json
+++ b/src/i18n/locales/he/translation.json
@@ -482,7 +482,8 @@
},
"updateChecks": {
"label": "בדוק עדכונים",
- "description": "בדוק אוטומטית אם קיימות גרסאות חדשות של Handy"
+ "description": "בדוק אוטומטית אם קיימות גרסאות חדשות של Handy",
+ "lockedDescription": "מושבת על ידי תצורת המערכת (HANDY_DISABLE_UPDATER)"
},
"soundTheme": {
"label": "ערכת צלילים",
diff --git a/src/i18n/locales/hi/translation.json b/src/i18n/locales/hi/translation.json
index 729e8ee7..059d5b7f 100644
--- a/src/i18n/locales/hi/translation.json
+++ b/src/i18n/locales/hi/translation.json
@@ -482,7 +482,8 @@
},
"updateChecks": {
"label": "अपडेट जांचें",
- "description": "Handy के नए वर्शन की अपने आप जांच करें"
+ "description": "Handy के नए वर्शन की अपने आप जांच करें",
+ "lockedDescription": "सिस्टम कॉन्फ़िगरेशन द्वारा अक्षम (HANDY_DISABLE_UPDATER)"
},
"whatsNewPreview": {
"title": "'नया क्या है' की झलक देखें",
diff --git a/src/i18n/locales/it/translation.json b/src/i18n/locales/it/translation.json
index d76e3737..ed6d2ccd 100644
--- a/src/i18n/locales/it/translation.json
+++ b/src/i18n/locales/it/translation.json
@@ -482,7 +482,8 @@
},
"updateChecks": {
"label": "Controlla aggiornamenti",
- "description": "Controlla automaticamente la disponibilità di nuove versioni di Handy"
+ "description": "Controlla automaticamente la disponibilità di nuove versioni di Handy",
+ "lockedDescription": "Disabilitato dalla configurazione di sistema (HANDY_DISABLE_UPDATER)"
},
"soundTheme": {
"label": "Tema Sonoro",
diff --git a/src/i18n/locales/ja/translation.json b/src/i18n/locales/ja/translation.json
index e074d9b3..28934462 100644
--- a/src/i18n/locales/ja/translation.json
+++ b/src/i18n/locales/ja/translation.json
@@ -482,7 +482,8 @@
},
"updateChecks": {
"label": "アップデートを確認",
- "description": "Handy の新しいバージョンを自動的にチェック"
+ "description": "Handy の新しいバージョンを自動的にチェック",
+ "lockedDescription": "システム設定により無効化されています (HANDY_DISABLE_UPDATER)"
},
"soundTheme": {
"label": "サウンドテーマ",
diff --git a/src/i18n/locales/ko/translation.json b/src/i18n/locales/ko/translation.json
index 25857ac9..59b6e847 100644
--- a/src/i18n/locales/ko/translation.json
+++ b/src/i18n/locales/ko/translation.json
@@ -482,7 +482,8 @@
},
"updateChecks": {
"label": "업데이트 확인",
- "description": "Handy의 새 버전을 자동으로 확인합니다"
+ "description": "Handy의 새 버전을 자동으로 확인합니다",
+ "lockedDescription": "시스템 구성에 의해 비활성화됨 (HANDY_DISABLE_UPDATER)"
},
"soundTheme": {
"label": "사운드 테마",
diff --git a/src/i18n/locales/ne/translation.json b/src/i18n/locales/ne/translation.json
index d177eee8..950c5462 100644
--- a/src/i18n/locales/ne/translation.json
+++ b/src/i18n/locales/ne/translation.json
@@ -482,7 +482,8 @@
},
"updateChecks": {
"label": "अपडेटहरू जाँच गर्नुहोस्",
- "description": "Handy को नयाँ संस्करण स्वतः जाँच गर्नुहोस्"
+ "description": "Handy को नयाँ संस्करण स्वतः जाँच गर्नुहोस्",
+ "lockedDescription": "प्रणाली कन्फिगरेसनद्वारा असक्षम पारिएको (HANDY_DISABLE_UPDATER)"
},
"whatsNewPreview": {
"title": "नयाँ के छ पूर्वावलोकन",
diff --git a/src/i18n/locales/nl/translation.json b/src/i18n/locales/nl/translation.json
index b1a5cef3..391f9f53 100644
--- a/src/i18n/locales/nl/translation.json
+++ b/src/i18n/locales/nl/translation.json
@@ -482,7 +482,8 @@
},
"updateChecks": {
"label": "Controleren op updates",
- "description": "Automatisch controleren op nieuwe versies van Handy"
+ "description": "Automatisch controleren op nieuwe versies van Handy",
+ "lockedDescription": "Uitgeschakeld door systeemconfiguratie (HANDY_DISABLE_UPDATER)"
},
"whatsNewPreview": {
"title": "Voorbeeld van release-notes",
diff --git a/src/i18n/locales/pl/translation.json b/src/i18n/locales/pl/translation.json
index 53fc1dfe..baa675cb 100644
--- a/src/i18n/locales/pl/translation.json
+++ b/src/i18n/locales/pl/translation.json
@@ -482,7 +482,8 @@
},
"updateChecks": {
"label": "Sprawdzaj aktualizacje",
- "description": "Automatycznie sprawdzaj nowe wersje Handy"
+ "description": "Automatycznie sprawdzaj nowe wersje Handy",
+ "lockedDescription": "Wyłączone przez konfigurację systemową (HANDY_DISABLE_UPDATER)"
},
"soundTheme": {
"label": "Motyw dźwiękowy",
diff --git a/src/i18n/locales/pt/translation.json b/src/i18n/locales/pt/translation.json
index 94a7a062..b53f09f4 100644
--- a/src/i18n/locales/pt/translation.json
+++ b/src/i18n/locales/pt/translation.json
@@ -482,7 +482,8 @@
},
"updateChecks": {
"label": "Verificar Atualizações",
- "description": "Verificar automaticamente novas versões do Handy"
+ "description": "Verificar automaticamente novas versões do Handy",
+ "lockedDescription": "Desativado pela configuração do sistema (HANDY_DISABLE_UPDATER)"
},
"soundTheme": {
"label": "Tema de Som",
diff --git a/src/i18n/locales/ru/translation.json b/src/i18n/locales/ru/translation.json
index 358e8ab5..0a2429b3 100644
--- a/src/i18n/locales/ru/translation.json
+++ b/src/i18n/locales/ru/translation.json
@@ -482,7 +482,8 @@
},
"updateChecks": {
"label": "Проверять наличие обновлений",
- "description": "Автоматически проверять наличие новых версий Handy"
+ "description": "Автоматически проверять наличие новых версий Handy",
+ "lockedDescription": "Отключено системной конфигурацией (HANDY_DISABLE_UPDATER)"
},
"soundTheme": {
"label": "Звуковая тема",
diff --git a/src/i18n/locales/sv/translation.json b/src/i18n/locales/sv/translation.json
index 41ff7d0a..a521d43d 100644
--- a/src/i18n/locales/sv/translation.json
+++ b/src/i18n/locales/sv/translation.json
@@ -482,7 +482,8 @@
},
"updateChecks": {
"label": "Sök efter uppdateringar",
- "description": "Sök automatiskt efter nya versioner av Handy"
+ "description": "Sök automatiskt efter nya versioner av Handy",
+ "lockedDescription": "Inaktiverad av systemkonfiguration (HANDY_DISABLE_UPDATER)"
},
"soundTheme": {
"label": "Ljudtema",
diff --git a/src/i18n/locales/tr/translation.json b/src/i18n/locales/tr/translation.json
index 730922b2..235d17cc 100644
--- a/src/i18n/locales/tr/translation.json
+++ b/src/i18n/locales/tr/translation.json
@@ -482,7 +482,8 @@
},
"updateChecks": {
"label": "Güncellemeleri Kontrol Et",
- "description": "Handy için yeni sürümleri otomatik olarak kontrol eder"
+ "description": "Handy için yeni sürümleri otomatik olarak kontrol eder",
+ "lockedDescription": "Sistem yapılandırması tarafından devre dışı bırakıldı (HANDY_DISABLE_UPDATER)"
},
"soundTheme": {
"label": "Ses Teması",
diff --git a/src/i18n/locales/uk/translation.json b/src/i18n/locales/uk/translation.json
index 7e045897..284e5c6c 100644
--- a/src/i18n/locales/uk/translation.json
+++ b/src/i18n/locales/uk/translation.json
@@ -482,7 +482,8 @@
},
"updateChecks": {
"label": "Перевірка оновлень",
- "description": "Автоматично перевіряти наявність нових версій Handy"
+ "description": "Автоматично перевіряти наявність нових версій Handy",
+ "lockedDescription": "Вимкнено системною конфігурацією (HANDY_DISABLE_UPDATER)"
},
"soundTheme": {
"label": "Звукова тема",
diff --git a/src/i18n/locales/vi/translation.json b/src/i18n/locales/vi/translation.json
index 8affb5ac..e5d0b5ed 100644
--- a/src/i18n/locales/vi/translation.json
+++ b/src/i18n/locales/vi/translation.json
@@ -482,7 +482,8 @@
},
"updateChecks": {
"label": "Kiểm tra cập nhật",
- "description": "Tự động kiểm tra phiên bản mới của Handy"
+ "description": "Tự động kiểm tra phiên bản mới của Handy",
+ "lockedDescription": "Đã bị vô hiệu hóa bởi cấu hình hệ thống (HANDY_DISABLE_UPDATER)"
},
"soundTheme": {
"label": "Chủ đề âm thanh",
diff --git a/src/i18n/locales/zh-TW/translation.json b/src/i18n/locales/zh-TW/translation.json
index 3c9c095d..9ba3b176 100644
--- a/src/i18n/locales/zh-TW/translation.json
+++ b/src/i18n/locales/zh-TW/translation.json
@@ -482,7 +482,8 @@
},
"updateChecks": {
"label": "檢查更新",
- "description": "自動檢查 Handy 的新版本"
+ "description": "自動檢查 Handy 的新版本",
+ "lockedDescription": "已被系統設定停用 (HANDY_DISABLE_UPDATER)"
},
"soundTheme": {
"label": "聲音主題",
diff --git a/src/i18n/locales/zh/translation.json b/src/i18n/locales/zh/translation.json
index 6ad66eff..11664e95 100644
--- a/src/i18n/locales/zh/translation.json
+++ b/src/i18n/locales/zh/translation.json
@@ -482,7 +482,8 @@
},
"updateChecks": {
"label": "检查更新",
- "description": "自动检查 Handy 的新版本"
+ "description": "自动检查 Handy 的新版本",
+ "lockedDescription": "已被系统配置禁用 (HANDY_DISABLE_UPDATER)"
},
"soundTheme": {
"label": "声音主题",
diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.ts
index 9e8cb6a8..9ea4ba49 100644
--- a/src/stores/settingsStore.ts
+++ b/src/stores/settingsStore.ts
@@ -20,10 +20,13 @@ interface SettingsStore {
outputDevices: AudioDevice[];
customSounds: { start: boolean; stop: boolean };
postProcessModelOptions: Record<string, string[]>;
+ // null until loadUpdateChecksLocked() resolves
+ updateChecksLocked: boolean | null;
// Actions
initialize: () => Promise<void>;
loadDefaultSettings: () => Promise<void>;
+ loadUpdateChecksLocked: () => Promise<void>;
updateSetting: <K extends keyof Settings>(
key: K,
value: Settings[K],
@@ -199,6 +202,7 @@ export const useSettingsStore = create<SettingsStore>()(
outputDevices: [],
customSounds: { start: false, stop: false },
postProcessModelOptions: {},
+ updateChecksLocked: null,
// Internal setters
setSettings: (settings) => set({ settings }),
@@ -604,9 +608,28 @@ export const useSettingsStore = create<SettingsStore>()(
}
},
+ // Check whether update checks are locked by system configuration
+ // (e.g. HANDY_DISABLE_UPDATER, set by the Nix package)
+ loadUpdateChecksLocked: async () => {
+ try {
+ const locked = await commands.isUpdateChecksLocked();
+ set({ updateChecksLocked: locked });
+ } catch (error) {
+ console.error("Failed to check update checks lock state:", error);
+ // Fail open: an unknown lock state means "not locked", otherwise the
+ // update checker waits for it forever and checks never start.
+ set({ updateChecksLocked: false });
+ }
+ },
+
// Initialize everything
initialize: async () => {
- const { refreshSettings, checkCustomSounds, loadDefaultSettings } = get();
+ const {
+ refreshSettings,
+ checkCustomSounds,
+ loadDefaultSettings,
+ loadUpdateChecksLocked,
+ } = get();
// Note: Audio devices are NOT refreshed here. The frontend (App.tsx)
// is responsible for calling refreshAudioDevices/refreshOutputDevices
@@ -616,6 +639,7 @@ export const useSettingsStore = create<SettingsStore>()(
loadDefaultSettings(),
refreshSettings(),
checkCustomSounds(),
+ loadUpdateChecksLocked(),
]);
// Re-fetch settings when the backend changes them (e.g. language