Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

feat(power): add aggressive low-battery tiers — audio-pause at <=20%, full-pause at <=10% (#3544)

Fiza Mukhtara80777bbc94c
diff --git a/crates/screenpipe-capture/src/paired_capture.rs b/crates/screenpipe-capture/src/paired_capture.rs
index ef3198669..2abc1d9d5 100644
--- a/crates/screenpipe-capture/src/paired_capture.rs
+++ b/crates/screenpipe-capture/src/paired_capture.rs
@@ -73,6 +73,10 @@ pub struct CaptureContext<'a> {
pub languages: Vec<screenpipe_core::Language>,
/// When Some, this frame references another frame's elements (dedup).
pub elements_ref_frame_id: Option<i64>,
+ /// When true, skip screenshot acquisition and JPEG encode.
+ /// The accessibility tree walk still runs — metadata row is still written.
+ /// Set by AudioPaused and FullPause power profiles.
+ pub screenshot_disabled: bool,
}
/// Result of a paired capture operation.
@@ -112,17 +116,26 @@ pub async fn paired_capture(
) -> Result<PairedCaptureResult> {
let start = Instant::now();
- // Write JPEG snapshot to disk
- let snapshot_path = ctx
- .snapshot_writer
- .write(&ctx.image, ctx.captured_at, ctx.monitor_id)?;
- let snapshot_path_str = snapshot_path.to_string_lossy().to_string();
-
- debug!(
- "paired_capture: snapshot written in {:?} (trigger={})",
- start.elapsed(),
- ctx.capture_trigger
- );
+ // Write JPEG snapshot to disk — skipped when screenshot_disabled (AudioPaused / FullPause).
+ // The accessibility tree walk still runs so metadata rows keep timestamp,
+ // app_name, window_name, and full_text for search/timeline queries.
+ let snapshot_path_str = if ctx.screenshot_disabled {
+ debug!(
+ "paired_capture: screenshot skipped (screenshot_disabled, trigger={})",
+ ctx.capture_trigger
+ );
+ String::new()
+ } else {
+ let snapshot_path =
+ ctx.snapshot_writer
+ .write(&ctx.image, ctx.captured_at, ctx.monitor_id)?;
+ debug!(
+ "paired_capture: snapshot written in {:?} (trigger={})",
+ start.elapsed(),
+ ctx.capture_trigger
+ );
+ snapshot_path.to_string_lossy().to_string()
+ };
// --- Check if accessibility tree already provides text ---
// When the tree snapshot has text we skip OCR entirely. This avoids
@@ -625,6 +638,7 @@ mod tests {
use_pii_removal: false,
languages: vec![],
elements_ref_frame_id: None,
+ screenshot_disabled: false,
};
let result = paired_capture(&ctx, None).await.unwrap();
@@ -663,6 +677,7 @@ mod tests {
use_pii_removal: false,
languages: vec![],
elements_ref_frame_id: None,
+ screenshot_disabled: false,
};
let snap = TreeSnapshot {
@@ -725,6 +740,7 @@ mod tests {
use_pii_removal: false,
languages: vec![],
elements_ref_frame_id: None,
+ screenshot_disabled: false,
};
// Empty accessibility text should be treated as no text
diff --git a/crates/screenpipe-db/src/write_queue.rs b/crates/screenpipe-db/src/write_queue.rs
index bac58c4e0..f82d7eea5 100644
--- a/crates/screenpipe-db/src/write_queue.rs
+++ b/crates/screenpipe-db/src/write_queue.rs
@@ -846,13 +846,21 @@ async fn execute_single_write(
)"#,
)
.bind(timestamp)
- .bind(snapshot_path.as_str())
+ .bind(if snapshot_path.is_empty() {
+ None
+ } else {
+ Some(snapshot_path.as_str())
+ })
.bind(browser_url.as_deref())
.bind(app_name.as_deref())
.bind(window_name.as_deref())
.bind(focused)
.bind(device_name.as_str())
- .bind(snapshot_path.as_str())
+ .bind(if snapshot_path.is_empty() {
+ None
+ } else {
+ Some(snapshot_path.as_str())
+ })
.bind(capture_trigger.as_deref())
.bind(accessibility_text.as_deref())
.bind(text_source.as_deref())
diff --git a/crates/screenpipe-engine/src/event_driven_capture.rs b/crates/screenpipe-engine/src/event_driven_capture.rs
index 0951246ff..58ac4e547 100644
--- a/crates/screenpipe-engine/src/event_driven_capture.rs
+++ b/crates/screenpipe-engine/src/event_driven_capture.rs
@@ -320,6 +320,7 @@ pub async fn event_driven_capture_loop(
let mut visual_check_enabled = config.visual_check_interval_ms > 0;
let mut visual_check_interval = Duration::from_millis(config.visual_check_interval_ms);
let mut visual_change_threshold = config.visual_change_threshold;
+ let mut screenshot_disabled = false;
let mut state = EventDrivenCapture::new(config);
let mut power_profile_rx = power_profile_rx;
@@ -398,6 +399,7 @@ pub async fn event_driven_capture_loop(
last_db_write,
None, // first capture — no elements ref
&mut walk_budget,
+ false, // screenshot enabled on startup
)
.await
{
@@ -557,6 +559,15 @@ pub async fn event_driven_capture_loop(
continue;
}
+ // Skip all capture when battery is critically low (FullPause profile).
+ // The server stays up so search/timeline queries still work on existing data.
+ if let Some(ref rx) = power_profile_rx {
+ if rx.borrow().capture_paused {
+ tokio::time::sleep(poll_interval).await;
+ continue;
+ }
+ }
+
// After unlock or wake, invalidate persistent SCStream handles so
// the next capture picks up fresh frames instead of stale ones.
// Use spawn_blocking to avoid blocking the tokio thread — the
@@ -608,6 +619,13 @@ pub async fn event_driven_capture_loop(
visual_check_interval = Duration::from_millis(profile.visual_check_interval_ms);
visual_change_threshold = profile.visual_change_threshold;
visual_check_enabled = profile.visual_check_interval_ms > 0;
+ screenshot_disabled = profile.screenshot_disabled;
+ if profile.screenshot_disabled {
+ info!(
+ "power profile {:?}: screenshots disabled for monitor {} — a11y walk continues",
+ profile.name, monitor_id
+ );
+ }
}
}
@@ -839,6 +857,7 @@ pub async fn event_driven_capture_loop(
last_db_write,
elements_ref,
&mut walk_budget,
+ screenshot_disabled,
),
)
.await;
@@ -1191,6 +1210,7 @@ async fn do_capture(
last_db_write: Instant,
elements_ref_frame_id: Option<i64>,
walk_budget: &mut screenpipe_a11y::budget::AppWalkBudget,
+ screenshot_disabled: bool,
) -> Result<CaptureOutput> {
let captured_at = Utc::now();
@@ -1496,6 +1516,7 @@ async fn do_capture(
use_pii_removal: params.use_pii_removal,
languages: params.languages.to_vec(),
elements_ref_frame_id,
+ screenshot_disabled,
};
let result = paired_capture(&ctx, tree_snapshot.as_ref()).await?;
diff --git a/crates/screenpipe-engine/src/power/manager.rs b/crates/screenpipe-engine/src/power/manager.rs
index 18a9ebb33..8c14d3085 100644
--- a/crates/screenpipe-engine/src/power/manager.rs
+++ b/crates/screenpipe-engine/src/power/manager.rs
@@ -119,7 +119,13 @@ pub fn start_power_manager_with_pref(initial_pref: PowerMode) -> Arc<PowerManage
profile.name, power_state.on_ac, power_state.battery_pct
);
// Apply audio VAD threshold from initial profile
+ // audio_disabled uses ratio=1.0 to block all VAD segments.
screenpipe_audio::vad::set_min_speech_ratio(profile.vad_min_speech_ratio);
+ if profile.capture_paused {
+ info!("initial power state: capture paused (battery critically low or OS low-power)");
+ } else if profile.audio_disabled {
+ info!("initial power state: audio disabled (battery <=20%)");
+ }
let _ = handle_ref.profile_tx.send(profile);
loop {
@@ -152,9 +158,31 @@ pub fn start_power_manager_with_pref(initial_pref: PowerMode) -> Arc<PowerManage
);
}
- // Apply audio VAD threshold from profile
+ // Apply audio VAD threshold from profile.
+ // audio_disabled sets ratio=1.0 so no segment passes VAD — effectively
+ // pauses Whisper without needing a separate code path.
screenpipe_audio::vad::set_min_speech_ratio(new_profile.vad_min_speech_ratio);
+ if new_profile.capture_paused && current_name != ProfileName::FullPause {
+ info!(
+ "battery critically low (<=10%) or OS low-power active — \
+ pausing all capture (server stays up for search/timeline)"
+ );
+ } else if new_profile.audio_disabled
+ && !matches!(
+ current_name,
+ ProfileName::AudioPaused | ProfileName::FullPause
+ )
+ {
+ info!(
+ "battery low (<=20%) — pausing audio/Whisper, \
+ vision capture continues"
+ );
+ } else if !new_profile.capture_paused && matches!(current_name, ProfileName::FullPause)
+ {
+ info!("power restored — resuming capture");
+ }
+
let _ = handle_ref.profile_tx.send(new_profile);
}
});
diff --git a/crates/screenpipe-engine/src/power/profile.rs b/crates/screenpipe-engine/src/power/profile.rs
index ca3744168..8529dbe86 100644
--- a/crates/screenpipe-engine/src/power/profile.rs
+++ b/crates/screenpipe-engine/src/power/profile.rs
@@ -31,6 +31,10 @@ pub enum ProfileName {
Performance,
Balanced,
Saver,
+ /// Battery <=20%: vision on, audio/Whisper off.
+ AudioPaused,
+ /// Battery <=10% or OS low-power: full capture pause, server stays up.
+ FullPause,
}
/// Tunable parameters that subsystems read from the active power profile.
@@ -43,7 +47,7 @@ pub struct PowerProfile {
/// Which named profile is active.
pub name: ProfileName,
- // ─── Vision: event-driven capture ───────────────────────────────────
+ // ── Vision: event-driven capture ────────────────────────────────────
/// Minimum time between captures (debounce), in milliseconds.
pub min_capture_interval_ms: u64,
/// Maximum time without a capture before an idle snapshot, in milliseconds.
@@ -55,16 +59,30 @@ pub struct PowerProfile {
/// JPEG quality for snapshots (1–100).
pub jpeg_quality: u8,
- // ─── Vision: adaptive FPS ───────────────────────────────────────────
+ // ── Vision: adaptive FPS ─────────────────────────────────────────────
/// Multiplier applied to adaptive FPS intervals. 1.0 = normal, 2.0 = half speed.
pub fps_interval_multiplier: f64,
- // ─── Audio ──────────────────────────────────────────────────────────
+ // ── Audio ────────────────────────────────────────────────────────────
/// VAD minimum speech ratio — segments below this are skipped entirely.
/// Higher = skip more marginal audio = less Whisper CPU.
pub vad_min_speech_ratio: f32,
-
- // ─── Video encoding ─────────────────────────────────────────────────
+ /// When true, audio capture and Whisper transcription are fully disabled.
+ /// Vision capture continues. Set at <=20% battery.
+ pub audio_disabled: bool,
+ /// When true, screenshot acquisition, JPEG encode, frame comparer, and
+ /// video chunk writes are skipped. The accessibility tree walk continues
+ /// so search/timeline metadata (app_name, window_name, full_text) still works.
+ /// Set at <=20% battery (AudioPaused) and <=10% (FullPause).
+ pub screenshot_disabled: bool,
+
+ // ── Capture pause ────────────────────────────────────────────────────
+ /// When true, all capture (vision + audio) is paused.
+ /// The server stays up so search/timeline queries still work.
+ /// Set at <=10% battery or when OS low-power mode is active.
+ pub capture_paused: bool,
+
+ // ── Video encoding ────────────────────────────────────────────────────
/// Video quality preset override ("low", "balanced", "high", "max").
/// `None` means use the user's configured setting.
pub video_quality_override: Option<String>,
@@ -75,21 +93,16 @@ impl PowerProfile {
pub fn performance() -> Self {
Self {
name: ProfileName::Performance,
-
- // Vision
min_capture_interval_ms: 200,
idle_capture_interval_ms: 30_000,
visual_check_interval_ms: 3_000,
visual_change_threshold: 0.05,
jpeg_quality: 80,
-
- // Adaptive FPS
fps_interval_multiplier: 1.0,
-
- // Audio
vad_min_speech_ratio: 0.02,
-
- // Video
+ audio_disabled: false,
+ screenshot_disabled: false,
+ capture_paused: false,
video_quality_override: None,
}
}
@@ -98,21 +111,16 @@ impl PowerProfile {
pub fn balanced() -> Self {
Self {
name: ProfileName::Balanced,
-
- // Vision: slower capture, higher change threshold
min_capture_interval_ms: 500,
idle_capture_interval_ms: 60_000,
visual_check_interval_ms: 10_000,
visual_change_threshold: 0.10,
jpeg_quality: 60,
-
- // Adaptive FPS: 2x slower
fps_interval_multiplier: 2.0,
-
- // Audio: skip more marginal speech
vad_min_speech_ratio: 0.05,
-
- // Video: force low quality
+ audio_disabled: false,
+ screenshot_disabled: false,
+ capture_paused: false,
video_quality_override: Some("low".to_string()),
}
}
@@ -121,21 +129,57 @@ impl PowerProfile {
pub fn saver() -> Self {
Self {
name: ProfileName::Saver,
-
- // Vision: much slower, higher thresholds
min_capture_interval_ms: 1_000,
idle_capture_interval_ms: 120_000,
visual_check_interval_ms: 30_000,
visual_change_threshold: 0.15,
jpeg_quality: 40,
-
- // Adaptive FPS: 4x slower
fps_interval_multiplier: 4.0,
-
- // Audio: aggressive silence skipping
vad_min_speech_ratio: 0.10,
+ audio_disabled: false,
+ screenshot_disabled: false,
+ capture_paused: false,
+ video_quality_override: Some("low".to_string()),
+ }
+ }
- // Video: force low quality
+ /// Audio paused — used when battery <=20%.
+ /// Vision capture continues at saver settings; Whisper/VAD fully off.
+ pub fn audio_paused() -> Self {
+ Self {
+ name: ProfileName::AudioPaused,
+ min_capture_interval_ms: 1_000,
+ idle_capture_interval_ms: 120_000,
+ visual_check_interval_ms: 30_000,
+ visual_change_threshold: 0.15,
+ jpeg_quality: 40,
+ fps_interval_multiplier: 4.0,
+ // ratio=1.0 means no segment ever passes VAD — effectively off
+ vad_min_speech_ratio: 1.0,
+ audio_disabled: true,
+ screenshot_disabled: true,
+ capture_paused: false,
+ video_quality_override: Some("low".to_string()),
+ }
+ }
+
+ /// Full pause — used when battery <=10% or OS low-power mode is active.
+ /// All capture stops; server stays up for search/timeline queries.
+ pub fn full_pause() -> Self {
+ Self {
+ name: ProfileName::FullPause,
+ // These values don't matter while paused but set conservatively
+ // so if pause is lifted they don't spike resource usage.
+ min_capture_interval_ms: 2_000,
+ idle_capture_interval_ms: 300_000,
+ visual_check_interval_ms: 60_000,
+ visual_change_threshold: 0.20,
+ jpeg_quality: 40,
+ fps_interval_multiplier: 8.0,
+ vad_min_speech_ratio: 1.0,
+ audio_disabled: true,
+ screenshot_disabled: true,
+ capture_paused: true,
video_quality_override: Some("low".to_string()),
}
}
@@ -154,18 +198,22 @@ impl PowerProfile {
return Self::saver();
}
- // OS low-power mode override
- if state.os_low_power {
- return Self::saver();
+ // AC power → full performance, UNLESS OS low-power mode is on.
+ // Users who enable Low Power Mode while plugged in (fan noise /
+ // thermal budget) expect the system to respect that preference.
+ if state.on_ac && !state.os_low_power {
+ return Self::performance();
}
- // AC power → full performance
- if state.on_ac {
- return Self::performance();
+ // OS low-power mode → full pause (battery or AC)
+ if state.os_low_power {
+ return Self::full_pause();
}
- // Battery: choose based on charge level
+ // Battery: tiered based on charge level
match state.battery_pct {
+ Some(pct) if pct <= 10 => Self::full_pause(),
+ Some(pct) if pct <= 20 => Self::audio_paused(),
Some(pct) if pct <= 40 => Self::saver(),
Some(_) => Self::balanced(),
// No battery info but not on AC → balanced to be safe
@@ -214,7 +262,7 @@ mod tests {
fn test_auto_battery_low() {
let state = PowerState {
on_ac: false,
- battery_pct: Some(20),
+ battery_pct: Some(30),
thermal_state: ThermalState::Nominal,
os_low_power: false,
};
@@ -223,19 +271,35 @@ mod tests {
}
#[test]
- fn test_thermal_override() {
+ fn test_auto_battery_20_percent() {
let state = PowerState {
- on_ac: true, // even on AC
- battery_pct: Some(100),
- thermal_state: ThermalState::Serious,
+ on_ac: false,
+ battery_pct: Some(20),
+ thermal_state: ThermalState::Nominal,
os_low_power: false,
};
let profile = PowerProfile::for_state(&state, PowerMode::Auto);
- assert_eq!(profile.name, ProfileName::Saver);
+ assert_eq!(profile.name, ProfileName::AudioPaused);
+ assert!(profile.audio_disabled);
+ assert!(!profile.capture_paused);
}
#[test]
- fn test_os_low_power_override() {
+ fn test_auto_battery_10_percent() {
+ let state = PowerState {
+ on_ac: false,
+ battery_pct: Some(10),
+ thermal_state: ThermalState::Nominal,
+ os_low_power: false,
+ };
+ let profile = PowerProfile::for_state(&state, PowerMode::Auto);
+ assert_eq!(profile.name, ProfileName::FullPause);
+ assert!(profile.audio_disabled);
+ assert!(profile.capture_paused);
+ }
+
+ #[test]
+ fn test_os_low_power_triggers_full_pause() {
let state = PowerState {
on_ac: false,
battery_pct: Some(80), // high battery but OS low power on
@@ -243,19 +307,46 @@ mod tests {
os_low_power: true,
};
let profile = PowerProfile::for_state(&state, PowerMode::Auto);
+ assert_eq!(profile.name, ProfileName::FullPause);
+ assert!(profile.capture_paused);
+ }
+
+ #[test]
+ fn test_ac_power_ignores_low_battery() {
+ // Even at 5% battery, AC power means performance
+ let state = PowerState {
+ on_ac: true,
+ battery_pct: Some(5),
+ thermal_state: ThermalState::Nominal,
+ os_low_power: false,
+ };
+ let profile = PowerProfile::for_state(&state, PowerMode::Auto);
+ assert_eq!(profile.name, ProfileName::Performance);
+ }
+
+ #[test]
+ fn test_thermal_override() {
+ let state = PowerState {
+ on_ac: true,
+ battery_pct: Some(100),
+ thermal_state: ThermalState::Serious,
+ os_low_power: false,
+ };
+ let profile = PowerProfile::for_state(&state, PowerMode::Auto);
assert_eq!(profile.name, ProfileName::Saver);
}
#[test]
- fn test_user_force_performance() {
+ fn test_user_force_performance_overrides_low_battery() {
let state = PowerState {
on_ac: false,
- battery_pct: Some(10), // very low battery
- thermal_state: ThermalState::Fair,
+ battery_pct: Some(5),
+ thermal_state: ThermalState::Nominal,
os_low_power: true,
};
let profile = PowerProfile::for_state(&state, PowerMode::Performance);
assert_eq!(profile.name, ProfileName::Performance);
+ assert!(!profile.capture_paused);
}
#[test]
@@ -271,20 +362,35 @@ mod tests {
}
#[test]
- fn test_no_battery_not_ac() {
+ fn test_ac_with_os_low_power_gets_full_pause() {
+ // Regression: AC + Low Power Mode must NOT return Performance.
+ // Users enabling Low Power Mode while plugged in (thermal / fan noise)
+ // expect the system to respect that preference.
let state = PowerState {
- on_ac: false,
- battery_pct: None,
+ on_ac: true,
+ battery_pct: Some(80),
+ thermal_state: ThermalState::Nominal,
+ os_low_power: true,
+ };
+ let profile = PowerProfile::for_state(&state, PowerMode::Auto);
+ assert_eq!(profile.name, ProfileName::FullPause);
+ assert!(profile.capture_paused);
+ }
+
+ #[test]
+ fn test_ac_without_os_low_power_gets_performance() {
+ let state = PowerState {
+ on_ac: true,
+ battery_pct: Some(80),
thermal_state: ThermalState::Nominal,
os_low_power: false,
};
let profile = PowerProfile::for_state(&state, PowerMode::Auto);
- assert_eq!(profile.name, ProfileName::Balanced);
+ assert_eq!(profile.name, ProfileName::Performance);
}
#[test]
- fn test_boundary_40_percent() {
- // Exactly 40% should be saver
+ fn test_boundary_exactly_40_percent() {
let state = PowerState {
on_ac: false,
battery_pct: Some(40),
@@ -293,15 +399,112 @@ mod tests {
};
let profile = PowerProfile::for_state(&state, PowerMode::Auto);
assert_eq!(profile.name, ProfileName::Saver);
+ }
- // 41% should be balanced
- let state2 = PowerState {
+ #[test]
+ fn test_boundary_exactly_21_percent() {
+ let state = PowerState {
on_ac: false,
- battery_pct: Some(41),
+ battery_pct: Some(21),
thermal_state: ThermalState::Nominal,
os_low_power: false,
};
- let profile2 = PowerProfile::for_state(&state2, PowerMode::Auto);
- assert_eq!(profile2.name, ProfileName::Balanced);
+ let profile = PowerProfile::for_state(&state, PowerMode::Auto);
+ assert_eq!(profile.name, ProfileName::Saver);
+ }
+
+ #[test]
+ fn test_boundary_exactly_20_percent() {
+ let state = PowerState {
+ on_ac: false,
+ battery_pct: Some(20),
+ thermal_state: ThermalState::Nominal,
+ os_low_power: false,
+ };
+ let profile = PowerProfile::for_state(&state, PowerMode::Auto);
+ assert_eq!(profile.name, ProfileName::AudioPaused);
+ }
+
+ #[test]
+ fn test_boundary_exactly_11_percent() {
+ let state = PowerState {
+ on_ac: false,
+ battery_pct: Some(11),
+ thermal_state: ThermalState::Nominal,
+ os_low_power: false,
+ };
+ let profile = PowerProfile::for_state(&state, PowerMode::Auto);
+ assert_eq!(profile.name, ProfileName::AudioPaused);
+ }
+
+ #[test]
+ fn test_boundary_exactly_10_percent() {
+ let state = PowerState {
+ on_ac: false,
+ battery_pct: Some(10),
+ thermal_state: ThermalState::Nominal,
+ os_low_power: false,
+ };
+ let profile = PowerProfile::for_state(&state, PowerMode::Auto);
+ assert_eq!(profile.name, ProfileName::FullPause);
+ }
+
+ #[test]
+ fn test_audio_paused_profile_fields() {
+ let profile = PowerProfile::audio_paused();
+ assert!(profile.audio_disabled);
+ assert!(!profile.capture_paused);
+ assert_eq!(profile.vad_min_speech_ratio, 1.0);
+ }
+
+ #[test]
+ fn test_full_pause_profile_fields() {
+ let profile = PowerProfile::full_pause();
+ assert!(profile.audio_disabled);
+ assert!(profile.capture_paused);
+ }
+
+ #[test]
+ fn test_audio_paused_skips_screenshot_keeps_a11y() {
+ // AudioPaused: no JPEG, no Whisper — but a11y tree walk continues.
+ // This is the key behavior: metadata rows (app_name, window_name,
+ // full_text) still land in the DB for search/timeline.
+ let profile = PowerProfile::audio_paused();
+ assert!(profile.screenshot_disabled, "screenshot must be skipped");
+ assert!(profile.audio_disabled, "audio must be disabled");
+ assert!(!profile.capture_paused, "capture loop must keep running");
+ // vad_min_speech_ratio=1.0 means no segment ever passes VAD
+ assert_eq!(profile.vad_min_speech_ratio, 1.0);
+ }
+
+ #[test]
+ fn test_full_pause_skips_everything() {
+ // FullPause: no screenshot, no audio, capture loop gated off entirely.
+ let profile = PowerProfile::full_pause();
+ assert!(profile.screenshot_disabled);
+ assert!(profile.audio_disabled);
+ assert!(profile.capture_paused, "capture loop must be fully gated");
+ }
+
+ #[test]
+ fn test_saver_still_takes_screenshots() {
+ // Saver is NOT AudioPaused — it still writes snapshot rows,
+ // just at lower quality and longer intervals.
+ let profile = PowerProfile::saver();
+ assert!(!profile.screenshot_disabled);
+ assert!(!profile.audio_disabled);
+ assert!(!profile.capture_paused);
+ }
+
+ #[test]
+ fn test_no_battery_not_ac() {
+ let state = PowerState {
+ on_ac: false,
+ battery_pct: None,
+ thermal_state: ThermalState::Nominal,
+ os_low_power: false,
+ };
+ let profile = PowerProfile::for_state(&state, PowerMode::Auto);
+ assert_eq!(profile.name, ProfileName::Balanced);
}
}