Skip to main content

Settings

Struct Settings 

Source
pub struct Settings {
Show 73 fields pub micro_interval_secs: u64, pub micro_duration_secs: u64, pub long_interval_secs: u64, pub long_duration_secs: u64, pub micro_idle_reset_secs: u64, pub long_idle_reset_secs: u64, pub micro_enabled: bool, pub long_enabled: bool, pub micro_enforceable: bool, pub long_enforceable: bool, pub pause_during_dnd: bool, pub pause_during_camera: bool, pub pause_during_video: bool, pub work_window_enabled: bool, pub work_start_minutes: u32, pub work_end_minutes: u32, pub bedtime_enabled: bool, pub bedtime_start_minutes: u32, pub bedtime_end_minutes: u32, pub bedtime_interval_secs: u64, pub bedtime_duration_secs: u64, pub prebreak_notification_enabled: bool, pub prebreak_notification_seconds: u64, pub overlay_opacity: f32, pub overlay_color: String, pub overlay_custom_rgb: String, pub overlay_high_contrast: bool, pub show_hint: bool, pub monitor_placement: MonitorPlacement, pub strict_mode: bool, pub postpone_enabled: bool, pub postpone_minutes: u32, pub show_current_time: bool, pub clock_format: String, pub micro_manual_finish: bool, pub long_manual_finish: bool, pub autostart_enabled: bool, pub micro_sound: BreakSound, pub long_sound: BreakSound, pub sound_volume: f32, pub app_pause_enabled: bool, pub app_pause_list: Vec<String>, pub break_health_enabled: bool, pub micro_physical_hints: Vec<String>, pub micro_psychological_hints: Vec<String>, pub micro_hint_mix: String, pub long_hints: Vec<String>, pub long_social_hints: Vec<String>, pub long_hint_mix: String, pub sleep_hints: Vec<String>, pub hint_rotate_seconds: u64, pub delay_break_if_typing: bool, pub typing_grace_secs: u64, pub typing_max_deferral_secs: u64, pub pause_countdown_if_typing: bool, pub postpone_escalation_enabled: bool, pub postpone_escalation_step_secs: u64, pub postpone_max_count: u32, pub overlay_font_scale: f32, pub micro_fixed_times: Vec<String>, pub long_fixed_times: Vec<String>, pub micro_schedule_mode: String, pub long_schedule_mode: String, pub hooks_enabled: bool, pub hooks: Vec<Hook>, pub daily_screen_time_enabled: bool, pub daily_screen_time_budget_minutes: u64, pub daily_screen_time_remind_again_minutes: u64, pub tray_countdown_enabled: bool, pub tray_countdown_target: String, pub micro_break_mode: String, pub long_break_mode: String, pub custom_css: String,
}
Expand description

Single source of truth for one profile’s behaviour.

Deserialised from settings.json (one of these per profile in the ProfilesFile array) and sent to the renderer wholesale through get_settings. Field names line up 1:1 with the TypeScript SchedulerSettings type — keep the two in sync; a serde roundtrip parity test is on the backlog to enforce this in CI.

#[serde(default)] on the struct means each field falls back to Default::default() if missing — older settings.json files keep loading as new fields are added. Pre-split fields keep their old JSON keys via #[serde(alias = "...")].

Fields§

§micro_interval_secs: u64§micro_duration_secs: u64§long_interval_secs: u64§long_duration_secs: u64§micro_idle_reset_secs: u64§long_idle_reset_secs: u64§micro_enabled: bool§long_enabled: bool§micro_enforceable: bool§long_enforceable: bool§pause_during_dnd: bool§pause_during_camera: bool§pause_during_video: bool§work_window_enabled: bool§work_start_minutes: u32§work_end_minutes: u32§bedtime_enabled: bool§bedtime_start_minutes: u32§bedtime_end_minutes: u32§bedtime_interval_secs: u64§bedtime_duration_secs: u64§prebreak_notification_enabled: bool§prebreak_notification_seconds: u64§overlay_opacity: f32§overlay_color: String§overlay_custom_rgb: String§overlay_high_contrast: bool§show_hint: bool§monitor_placement: MonitorPlacement§strict_mode: bool§postpone_enabled: bool§postpone_minutes: u32§show_current_time: bool§clock_format: String§micro_manual_finish: bool§long_manual_finish: bool§autostart_enabled: bool§micro_sound: BreakSound§long_sound: BreakSound§sound_volume: f32§app_pause_enabled: bool§app_pause_list: Vec<String>§break_health_enabled: bool§micro_physical_hints: Vec<String>§micro_psychological_hints: Vec<String>§micro_hint_mix: String§long_hints: Vec<String>§long_social_hints: Vec<String>§long_hint_mix: String§sleep_hints: Vec<String>§hint_rotate_seconds: u64§delay_break_if_typing: bool§typing_grace_secs: u64§typing_max_deferral_secs: u64§pause_countdown_if_typing: bool§postpone_escalation_enabled: bool§postpone_escalation_step_secs: u64§postpone_max_count: u32§overlay_font_scale: f32§micro_fixed_times: Vec<String>§long_fixed_times: Vec<String>§micro_schedule_mode: String§long_schedule_mode: String§hooks_enabled: bool§hooks: Vec<Hook>§daily_screen_time_enabled: bool§daily_screen_time_budget_minutes: u64§daily_screen_time_remind_again_minutes: u64§tray_countdown_enabled: bool§tray_countdown_target: String§micro_break_mode: String§long_break_mode: String§custom_css: String

Supporter-only freeform stylesheet, applied to both the settings window and the break overlay via the renderer’s useCustomStylesheet hook (which uses adoptedStyleSheets so we don’t need to weaken the strict style-src 'self' CSP). The supporter gate lives in commands::settings::gate_custom_css, and sanitize_custom_css strips @import / expression( on every read+write.

Implementations§

Source§

impl Settings

Source

pub fn clamp(&mut self)

Clamp every numeric field to a safe range. Called on every load (post-deserialise) and on every write (post-merge) so that a hand-edited or corrupted settings.json can’t make the scheduler misbehave — e.g. micro_interval_secs: 0 would fire a break every tick of the 1Hz loop. Values inside the range are left untouched.

The bounds are deliberately generous (the UI’s min / max attributes are tighter); we only catch the values that produce pathological behaviour.

Trait Implementations§

Source§

impl Clone for Settings

Source§

fn clone(&self) -> Settings

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Settings

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Settings

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Settings

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Settings

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<'de, D, R> CommandArg<'de, R> for D
where D: Deserialize<'de>, R: Runtime,

§

fn from_command(command: CommandItem<'de, R>) -> Result<D, InvokeError>

Derives an instance of Self from the [CommandItem]. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> IpcResponse for T
where T: Serialize,

§

fn body(self) -> Result<InvokeResponseBody, Error>

Resolve the IPC response body.
§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T> ScopeObject for T
where T: Send + Sync + Debug + DeserializeOwned + 'static,

§

type Error = Error

The error type.
§

fn deserialize<R>( _app: &AppHandle<R>, raw: Value, ) -> Result<T, <T as ScopeObject>::Error>
where R: Runtime,

Deserialize the raw scope value.
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> UserEvent for T
where T: Debug + Clone + Send + 'static,