mirror of
https://github.com/tiennm99/claude-code-usage-bubble.git
synced 2026-10-13 14:16:05 +00:00
feat: configurable auto-update check frequency
Adds a "Settings > Auto-update check" submenu with Disabled / Hourly / Daily / Weekly. Hourly is the default; existing settings files pick it up automatically via serde default. Manual "Check for updates" is unchanged and still fires when auto is disabled. The 24-hour hardcoded interval is replaced by reading Settings.update_check_interval_secs in both the startup scheduler and the post-check rearm path. None means auto is disabled and no timer is armed. Adds five new i18n keys across all eight locales.
This commit is contained in:
1 parent
5fc9d18c67
commit
2ca5052915
12 files changed
+152
-18
No files matched your search
@@ -14,6 +14,11 @@ pub const POLL_5_MIN: u32 = 5 * 60_000;
|
||||
pub const POLL_15_MIN: u32 = 15 * 60_000;
|
||||
pub const POLL_1_HOUR: u32 = 60 * 60_000;
|
||||
|
||||
// Update-check intervals (seconds). `None` means auto-check is disabled.
|
||||
pub const UPDATE_CHECK_HOURLY_SECS: u64 = 60 * 60;
|
||||
pub const UPDATE_CHECK_DAILY_SECS: u64 = 24 * 60 * 60;
|
||||
pub const UPDATE_CHECK_WEEKLY_SECS: u64 = 7 * 24 * 60 * 60;
|
||||
|
||||
fn default_show_claude() -> bool {
|
||||
true
|
||||
}
|
||||
@@ -29,6 +34,9 @@ fn default_bubble_size() -> i32 {
|
||||
fn default_poll_interval_ms() -> u32 {
|
||||
POLL_5_MIN
|
||||
}
|
||||
fn default_update_check_interval_secs() -> Option<u64> {
|
||||
Some(UPDATE_CHECK_HOURLY_SECS)
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
||||
pub struct BubblePositions {
|
||||
@@ -77,6 +85,8 @@ pub struct Settings {
|
||||
pub language: Option<String>,
|
||||
#[serde(default)]
|
||||
pub last_update_check_unix: Option<u64>,
|
||||
#[serde(default = "default_update_check_interval_secs")]
|
||||
pub update_check_interval_secs: Option<u64>,
|
||||
#[serde(default = "default_widget_visible")]
|
||||
pub widget_visible: bool,
|
||||
}
|
||||
@@ -91,6 +101,7 @@ impl Default for Settings {
|
||||
poll_interval_ms: default_poll_interval_ms(),
|
||||
language: None,
|
||||
last_update_check_unix: None,
|
||||
update_check_interval_secs: default_update_check_interval_secs(),
|
||||
widget_visible: default_widget_visible(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user