attempt to clean up warnings on build (#1037)

* attempt to clean up warnings on build

* format

* fix linux warning
This commit is contained in:
CJ Pais 2026-03-14 11:42:42 +08:00 committed by GitHub
parent 85a8ed77b5
commit 46fd170d69
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 25 additions and 14 deletions

View file

@ -5,7 +5,7 @@ use crate::settings::{get_settings, write_settings};
use log::warn; use log::warn;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use specta::Type; use specta::Type;
use std::{process::Command, sync::Arc}; use std::sync::Arc;
use tauri::{AppHandle, Manager}; use tauri::{AppHandle, Manager};
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
@ -135,6 +135,7 @@ pub fn get_windows_microphone_permission_status() -> WindowsMicrophonePermission
pub fn open_microphone_privacy_settings() -> Result<(), String> { pub fn open_microphone_privacy_settings() -> Result<(), String> {
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
{ {
use std::process::Command;
Command::new("cmd") Command::new("cmd")
.args(["/C", "start", "", "ms-settings:privacy-microphone"]) .args(["/C", "start", "", "ms-settings:privacy-microphone"])
.spawn() .spawn()

View file

@ -21,6 +21,7 @@ mod tray_i18n;
mod utils; mod utils;
pub use cli::CliArgs; pub use cli::CliArgs;
#[cfg(debug_assertions)]
use specta_typescript::{BigIntExportBehavior, Typescript}; use specta_typescript::{BigIntExportBehavior, Typescript};
use tauri_specta::{collect_commands, Builder}; use tauri_specta::{collect_commands, Builder};
@ -110,6 +111,7 @@ fn show_main_window(app: &AppHandle) {
); );
} }
#[allow(unused_variables)]
fn should_force_show_permissions_window(app: &AppHandle) -> bool { fn should_force_show_permissions_window(app: &AppHandle) -> bool {
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
{ {
@ -401,6 +403,7 @@ pub fn run(cli_args: CliArgs) {
) )
.expect("Failed to export typescript bindings"); .expect("Failed to export typescript bindings");
#[allow(unused_mut)]
let mut builder = tauri::Builder::default() let mut builder = tauri::Builder::default()
.device_event_filter(tauri::DeviceEventFilter::Always) .device_event_filter(tauri::DeviceEventFilter::Always)
.plugin(tauri_plugin_dialog::init()) .plugin(tauri_plugin_dialog::init())
@ -526,12 +529,11 @@ pub fn run(cli_args: CliArgs) {
api.prevent_close(); api.prevent_close();
let _res = window.hide(); let _res = window.hide();
let settings = get_settings(&window.app_handle());
let tray_visible =
settings.show_tray_icon && !window.app_handle().state::<CliArgs>().no_tray;
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
{ {
let settings = get_settings(&window.app_handle());
let tray_visible =
settings.show_tray_icon && !window.app_handle().state::<CliArgs>().no_tray;
if tray_visible { if tray_visible {
// Tray is available: hide the dock icon, app lives in the tray // Tray is available: hide the dock icon, app lives in the tray
let res = window let res = window

View file

@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize};
use specta::Type; use specta::Type;
use std::fs; use std::fs;
use std::path::PathBuf; use std::path::PathBuf;
use tauri::{AppHandle, Emitter, Manager}; use tauri::{AppHandle, Emitter};
use crate::audio_toolkit::save_wav_file; use crate::audio_toolkit::save_wav_file;

View file

@ -218,14 +218,15 @@ fn calculate_overlay_position(app_handle: &AppHandle) -> Option<(f64, f64)> {
/// Creates the recording overlay window and keeps it hidden by default /// Creates the recording overlay window and keeps it hidden by default
#[cfg(not(target_os = "macos"))] #[cfg(not(target_os = "macos"))]
pub fn create_recording_overlay(app_handle: &AppHandle) { pub fn create_recording_overlay(app_handle: &AppHandle) {
let position = calculate_overlay_position(app_handle);
// On Linux (Wayland), monitor detection often fails, but we don't need exact coordinates // On Linux (Wayland), monitor detection often fails, but we don't need exact coordinates
// for Layer Shell as we use anchors. On other platforms, we require a monitor. // for Layer Shell as we use anchors. On other platforms, we require a monitor.
#[cfg(not(target_os = "linux"))] #[cfg(not(target_os = "linux"))]
if position.is_none() { {
debug!("Failed to determine overlay position, not creating overlay window"); let position = calculate_overlay_position(app_handle);
return; if position.is_none() {
debug!("Failed to determine overlay position, not creating overlay window");
return;
}
} }
// Position starts unset — update_overlay_position() sets the correct // Position starts unset — update_overlay_position() sets the correct
@ -254,6 +255,7 @@ pub fn create_recording_overlay(app_handle: &AppHandle) {
builder = builder.data_directory(data_dir.join("webview")); builder = builder.data_directory(data_dir.join("webview"));
} }
#[allow(unused_variables)]
match builder.build() { match builder.build() {
Ok(window) => { Ok(window) => {
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]

View file

@ -19,10 +19,12 @@ use specta::Type;
use tauri::{AppHandle, Emitter, Manager}; use tauri::{AppHandle, Emitter, Manager};
use tauri_plugin_autostart::ManagerExt; use tauri_plugin_autostart::ManagerExt;
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
use crate::settings::APPLE_INTELLIGENCE_DEFAULT_MODEL_ID;
use crate::settings::{ use crate::settings::{
self, get_settings, AutoSubmitKey, ClipboardHandling, KeyboardImplementation, LLMPrompt, self, get_settings, AutoSubmitKey, ClipboardHandling, KeyboardImplementation, LLMPrompt,
OverlayPosition, PasteMethod, ShortcutBinding, SoundTheme, TypingTool, OverlayPosition, PasteMethod, ShortcutBinding, SoundTheme, TypingTool,
APPLE_INTELLIGENCE_DEFAULT_MODEL_ID, APPLE_INTELLIGENCE_PROVIDER_ID, APPLE_INTELLIGENCE_PROVIDER_ID,
}; };
use crate::tray; use crate::tray;

View file

@ -7,7 +7,9 @@ use log::{error, warn};
use tauri::AppHandle; use tauri::AppHandle;
use tauri_plugin_global_shortcut::{GlobalShortcutExt, Shortcut, ShortcutState}; use tauri_plugin_global_shortcut::{GlobalShortcutExt, Shortcut, ShortcutState};
use crate::settings::{self, get_settings, ShortcutBinding}; #[cfg(not(target_os = "linux"))]
use crate::settings::get_settings;
use crate::settings::{self, ShortcutBinding};
use super::handler::handle_shortcut_event; use super::handler::handle_shortcut_event;

View file

@ -1,5 +1,7 @@
use crate::TranscriptionCoordinator; use crate::TranscriptionCoordinator;
use log::{debug, warn}; #[cfg(unix)]
use log::debug;
use log::warn;
use tauri::{AppHandle, Manager}; use tauri::{AppHandle, Manager};
#[cfg(unix)] #[cfg(unix)]