diff --git a/config/config.go b/config/config.go index ca2f21b332957a14ce1c977e9497d2c08eb815f9..411f48bddefc931cd27576d1c4c4e5fd6767abc6 100644 --- a/config/config.go +++ b/config/config.go @@ -119,6 +119,7 @@ type Config struct { DisableImages bool `json:"disable_images,omitempty"` HideTips bool `json:"hide_tips,omitempty"` DisableNotifications bool `json:"disable_notifications,omitempty"` + DisableDaemon bool `json:"disable_daemon,omitempty"` EnableSplitPane bool `json:"enable_split_pane,omitempty"` EnableThreaded bool `json:"enable_threaded,omitempty"` EnableDetailedDates bool `json:"enable_detailed_dates,omitempty"` @@ -452,6 +453,7 @@ type secureDiskConfig struct { DisableImages bool `json:"disable_images,omitempty"` HideTips bool `json:"hide_tips,omitempty"` DisableNotifications bool `json:"disable_notifications,omitempty"` + DisableDaemon bool `json:"disable_daemon,omitempty"` EnableSplitPane bool `json:"enable_split_pane,omitempty"` EnableThreaded bool `json:"enable_threaded,omitempty"` EnableDetailedDates bool `json:"enable_detailed_dates,omitempty"` @@ -502,6 +504,7 @@ func SaveConfig(config *Config) error { DisableImages: config.DisableImages, HideTips: config.HideTips, DisableNotifications: config.DisableNotifications, + DisableDaemon: config.DisableDaemon, EnableSplitPane: config.EnableSplitPane, EnableThreaded: config.EnableThreaded, EnableDetailedDates: config.EnableDetailedDates, @@ -610,6 +613,7 @@ func LoadConfig() (*Config, error) { DisableImages bool `json:"disable_images,omitempty"` HideTips bool `json:"hide_tips,omitempty"` DisableNotifications bool `json:"disable_notifications,omitempty"` + DisableDaemon bool `json:"disable_daemon,omitempty"` EnableSplitPane bool `json:"enable_split_pane,omitempty"` EnableThreaded bool `json:"enable_threaded,omitempty"` EnableDetailedDates bool `json:"enable_detailed_dates,omitempty"` @@ -653,6 +657,7 @@ func LoadConfig() (*Config, error) { config.DisableImages = raw.DisableImages config.HideTips = raw.HideTips config.DisableNotifications = raw.DisableNotifications + config.DisableDaemon = raw.DisableDaemon config.EnableSplitPane = raw.EnableSplitPane config.EnableThreaded = raw.EnableThreaded config.EnableDetailedDates = raw.EnableDetailedDates diff --git a/daemonclient/service.go b/daemonclient/service.go index 63d48bab1e4dc8d3a59647298344ab63cc14873b..e9cc84e8ca3787b6b82df32dcc9fb7edb00f9318 100644 --- a/daemonclient/service.go +++ b/daemonclient/service.go @@ -42,8 +42,13 @@ type Service interface { } // NewService connects to the daemon, auto-starting it if needed. -// Falls back to direct mode only if daemon cannot be started. +// Falls back to direct mode only if daemon cannot be started, or if DisableDaemon is set. func NewService(cfg *config.Config) Service { + if cfg.DisableDaemon { + log.Println("service: daemon disabled by config, using direct mode") + return newDirectService(cfg) + } + // Try connecting to existing daemon. if svc := tryConnect(); svc != nil { return svc diff --git a/i18n/locales/ar.json b/i18n/locales/ar.json index 455105de00f320b368ffb0812e028027ac4b3b45..3510c51c06974ed63782ae794515e4d2dc0581f4 100644 --- a/i18n/locales/ar.json +++ b/i18n/locales/ar.json @@ -154,6 +154,7 @@ "disable_images": "تعطيل عرض الصور", "hide_tips": "إخفاء النصائح السياقية", "disable_notifications": "تعطيل الإشعارات", + "disable_daemon": "Background Daemon", "enable_split_pane": "عرض مقسم", "enable_threaded": "عرض المحادثات", "enable_detailed_dates": "تواريخ مفصلة", diff --git a/i18n/locales/de.json b/i18n/locales/de.json index b26196ca9b89a8d787b3e3a3cd50827a3e68faa5..0950d57270c9233656beb094b2cc6e69933de830 100644 --- a/i18n/locales/de.json +++ b/i18n/locales/de.json @@ -150,6 +150,7 @@ "disable_images": "Bildanzeige Deaktivieren", "hide_tips": "Kontextuelle Tipps Ausblenden", "disable_notifications": "Benachrichtigungen Deaktivieren", + "disable_daemon": "Background Daemon", "enable_split_pane": "Geteilte Ansicht", "enable_threaded": "Konversations-Threads", "enable_detailed_dates": "Detaillierte Datumsangaben", diff --git a/i18n/locales/en.json b/i18n/locales/en.json index 770d0100dd207ef2f73b0751e7b2b0d9d415129c..38aef591e4bcea615eaf759284b189c76626e0be 100644 --- a/i18n/locales/en.json +++ b/i18n/locales/en.json @@ -152,6 +152,7 @@ "disable_images": "Disable Image Display", "hide_tips": "Hide Contextual Tips", "disable_notifications": "Disable Notifications", + "disable_daemon": "Background Daemon", "enable_split_pane": "Split Pane View", "enable_threaded": "Threaded Conversation View", "enable_detailed_dates": "Detailed Dates", diff --git a/i18n/locales/es.json b/i18n/locales/es.json index f3247dac9de6735d52808cacd3c7b1f0a7885985..2a24b94448fcddea81bb0076eb88cc41d73f3921 100644 --- a/i18n/locales/es.json +++ b/i18n/locales/es.json @@ -150,6 +150,7 @@ "disable_images": "Deshabilitar Visualización de Imágenes", "hide_tips": "Ocultar Consejos Contextuales", "disable_notifications": "Deshabilitar Notificaciones", + "disable_daemon": "Background Daemon", "enable_split_pane": "Vista dividida", "enable_threaded": "Vista de conversación", "enable_detailed_dates": "Fechas detalladas", diff --git a/i18n/locales/fr.json b/i18n/locales/fr.json index f9ed8a0b4cdb1789f1d8916be91488bf09646032..0a52986812ae086053542c3435deb02c9d5efffb 100644 --- a/i18n/locales/fr.json +++ b/i18n/locales/fr.json @@ -150,6 +150,7 @@ "disable_images": "Désactiver l'Affichage des Images", "hide_tips": "Masquer les Conseils Contextuels", "disable_notifications": "Désactiver les Notifications", + "disable_daemon": "Background Daemon", "enable_split_pane": "Vue divisée", "enable_threaded": "Vue par conversation", "enable_detailed_dates": "Dates détaillées", diff --git a/i18n/locales/ja.json b/i18n/locales/ja.json index ee026e65b941c62acb7db99c2a5e92c11cc14a1b..13c91a70e0b4b0dc1e1d3d61aa723dab0f5ea98c 100644 --- a/i18n/locales/ja.json +++ b/i18n/locales/ja.json @@ -148,6 +148,7 @@ "disable_images": "画像表示を無効化", "hide_tips": "コンテキストヒントを非表示", "disable_notifications": "通知を無効化", + "disable_daemon": "Background Daemon", "enable_split_pane": "分割ビュー", "enable_threaded": "スレッド表示", "enable_detailed_dates": "詳細な日付", diff --git a/i18n/locales/pl.json b/i18n/locales/pl.json index 3746bde87bd7aacea14dee1bc93400c728e1880c..753c54d01ab3f7b021f5a0cb44a67265f6720575 100644 --- a/i18n/locales/pl.json +++ b/i18n/locales/pl.json @@ -154,6 +154,7 @@ "disable_images": "Wyłącz Wyświetlanie Obrazów", "hide_tips": "Ukryj Wskazówki Kontekstowe", "disable_notifications": "Wyłącz Powiadomienia", + "disable_daemon": "Background Daemon", "enable_split_pane": "Widok podzielony", "enable_threaded": "Widok wątków", "enable_detailed_dates": "Szczegółowe daty", diff --git a/i18n/locales/pt.json b/i18n/locales/pt.json index 8d2acad295cfaaa78d79e43707ddc2d5b801ead7..96b832956dfd78f8587ac8d63fcd7a7f6a0d2295 100644 --- a/i18n/locales/pt.json +++ b/i18n/locales/pt.json @@ -150,6 +150,7 @@ "disable_images": "Desativar Exibição de Imagens", "hide_tips": "Ocultar Dicas Contextuais", "disable_notifications": "Desativar Notificações", + "disable_daemon": "Background Daemon", "enable_split_pane": "Vista dividida", "enable_threaded": "Vista de conversação", "enable_detailed_dates": "Datas detalhadas", diff --git a/i18n/locales/ru.json b/i18n/locales/ru.json index 61db8055b4a9621e51609ea1ab9365caa7f20d2f..b7f9be2f6c3b2edc4bcd0b2f6a4d390ff97b6429 100644 --- a/i18n/locales/ru.json +++ b/i18n/locales/ru.json @@ -154,6 +154,7 @@ "disable_images": "Отключить Отображение Изображений", "hide_tips": "Скрыть Контекстные Подсказки", "disable_notifications": "Отключить Уведомления", + "disable_daemon": "Background Daemon", "enable_split_pane": "Разделённый вид", "enable_threaded": "Просмотр беседами", "enable_detailed_dates": "Подробные даты", diff --git a/i18n/locales/uk.json b/i18n/locales/uk.json index 3bc0e45f30c4e3a9dfb61e6469b01afdfbd59448..648e34d7965f0c4229289dc2057701e5202207e7 100644 --- a/i18n/locales/uk.json +++ b/i18n/locales/uk.json @@ -152,6 +152,7 @@ "disable_images": "Вимкнути показ зображень", "hide_tips": "Приховати контекстні підказки", "disable_notifications": "Вимкнути сповіщення", + "disable_daemon": "Background Daemon", "enable_split_pane": "Розділений вигляд", "enable_threaded": "Перегляд розмов", "enable_detailed_dates": "Детальні дати", diff --git a/i18n/locales/zh.json b/i18n/locales/zh.json index 6ba77ee3848fb9ece92f2acf18a1eec8f23e9b55..341b816cb290b9d929a70da095a7d179a7b2643b 100644 --- a/i18n/locales/zh.json +++ b/i18n/locales/zh.json @@ -148,6 +148,7 @@ "disable_images": "禁用图片显示", "hide_tips": "隐藏上下文提示", "disable_notifications": "禁用通知", + "disable_daemon": "Background Daemon", "enable_split_pane": "分屏视图", "enable_threaded": "会话视图", "enable_detailed_dates": "详细日期", diff --git a/tui/settings_general.go b/tui/settings_general.go index 89cfe39782c097c2d60e6789c6ba4e805bc05247..3f4eab4830eb98f45881c57af7cce79b08496c3b 100644 --- a/tui/settings_general.go +++ b/tui/settings_general.go @@ -20,6 +20,7 @@ func (m *Settings) buildGeneralOptions() []generalOption { {"settings_general.disable_images", onOff(m.cfg.DisableImages), "Prevent images from loading automatically in emails."}, {"settings_general.hide_tips", onOff(m.cfg.HideTips), "Hide helpful hints displayed at the bottom of the screen."}, {"settings_general.disable_notifications", onOff(m.cfg.DisableNotifications), "Turn off desktop notifications for new mail."}, + {"settings_general.disable_daemon", onOff(!m.cfg.DisableDaemon), "Run a background daemon for push notifications and sync. Takes effect on restart."}, {"settings_general.enable_split_pane", onOff(m.cfg.EnableSplitPane), "View inbox and email side-by-side."}, {"settings_general.enable_threaded", onOff(m.cfg.EnableThreaded), "Group emails into conversations by reply chain. Per-folder overrides are kept."}, {"settings_general.enable_detailed_dates", onOff(m.cfg.EnableDetailedDates), "Show detailed inbox dates."}, @@ -57,27 +58,31 @@ func (m *Settings) updateGeneral(msg tea.KeyPressMsg) (tea.Model, tea.Cmd) { m.cfg.DisableNotifications = !m.cfg.DisableNotifications _ = config.SaveConfig(m.cfg) saved = true - case 3: // Split Pane View + case 3: // Background Daemon + m.cfg.DisableDaemon = !m.cfg.DisableDaemon + _ = config.SaveConfig(m.cfg) + saved = true + case 4: // Split Pane View m.cfg.EnableSplitPane = !m.cfg.EnableSplitPane _ = config.SaveConfig(m.cfg) saved = true - case 4: // Threaded Conversation View + case 5: // Threaded Conversation View m.cfg.EnableThreaded = !m.cfg.EnableThreaded _ = config.SaveConfig(m.cfg) saved = true - case 5: // Detailed Dates + case 6: // Detailed Dates m.cfg.EnableDetailedDates = !m.cfg.EnableDetailedDates _ = config.SaveConfig(m.cfg) saved = true - case 6: // Spellcheck + case 7: // Spellcheck m.cfg.DisableSpellcheck = !m.cfg.DisableSpellcheck _ = config.SaveConfig(m.cfg) saved = true - case 7: // Spell Suggestions + case 8: // Spell Suggestions m.cfg.DisableSpellSuggestions = !m.cfg.DisableSpellSuggestions _ = config.SaveConfig(m.cfg) saved = true - case 8: // Date Format + case 9: // Date Format switch m.cfg.DateFormat { case config.DateFormatEU: m.cfg.DateFormat = config.DateFormatUS @@ -88,7 +93,7 @@ func (m *Settings) updateGeneral(msg tea.KeyPressMsg) (tea.Model, tea.Cmd) { } _ = config.SaveConfig(m.cfg) saved = true - case 9: // Language + case 10: // Language // Cycle through available languages langs := i18n.LanguageCodes() currentLang := m.cfg.GetLanguage() @@ -109,7 +114,7 @@ func (m *Settings) updateGeneral(msg tea.KeyPressMsg) (tea.Model, tea.Cmd) { func() tea.Msg { return ConfigSavedMsg{} }, func() tea.Msg { return LanguageChangedMsg{} }, ) - case 10: // Edit Signature + case 11: // Edit Signature if msg.String() == keyEnter || msg.String() == keyRight || msg.String() == "l" { return m, func() tea.Msg { return GoToSignatureEditorMsg{} } }