tonhowtf/omniget · error

esses ajustes so existem no Windows

Error message

esses ajustes so existem no Windows

What it means

A platform guard in apply: the tweaks subsystem only exists on Windows, and the non-Windows cfg block unconditionally returns this error after the rule lookup. It fires whenever apply() is called on macOS/Linux regardless of the rule id or enable flag — the operation is unsupported, not failed.

Solutions

  1. Run the application on Windows to use these tweaks
  2. Check TweaksStatus.supported before offering tweak actions in the UI
  3. Guard the UI so tweak controls are hidden on non-Windows platforms
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src-tauri/omniget-core/src/core/tools/win_tweaks.rs:607 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/e9225af817b6e921. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/win_tweaks.rs:607

            is_admin: false,
            rules,
        }
    }
}

/// Aplica (`enable`) ou reverte uma regra. Guarda o valor anterior em
/// `<app_data>/tools/win_tweaks_backup.json` para o botão "restaurar".
#[allow(unused_mut, unused_variables)]
pub async fn apply(id: &str, enable: bool) -> anyhow::Result<Rule> {
    let mut rule = rules()
        .into_iter()
        .find(|r| r.id == id)
        .ok_or_else(|| anyhow!("regra desconhecida: {}", id))?;
    #[cfg(not(target_os = "windows"))]
    {
        let _ = enable;
        let _ = &mut rule;
        Err(anyhow!("esses ajustes so existem no Windows"))
    }
    #[cfg(target_os = "windows")]
    {
        if rule.requires_admin && !is_admin().await {
            return Err(anyhow!(
                "essa regra precisa do OmniGet aberto como administrador"
            ));
        }
        if let Some(prev) = reg_query(&rule.key, &rule.name).await {
            backup_store(&rule.id, &prev);
        }
        let target = if enable {
            rule.on.clone()
        } else {
            restore_value(&rule)
        };
        reg_set(&rule.key, &rule.name, &target).await?;
        rule.applied = Some(enable);

View on GitHub (pinned to 8600b91f42)