Skip to content

armgit / WacOS

Public Imported from GitHub
0

A new style desktop shell for Windows 11: menu bar, Dock, Finder, Spotlight, Control Center and Liquid Glass, in native C++.

Rust
2.2 KB
Raw Blame
//! Porte de src\comum\nomes.h e abrircom.h: os nomes dos executáveis e "abrir no app do Mac" (áudio -> Música,
//! vídeo -> QuickTime).

pub const EXE_SHELL: &str = "WacOSShell.exe";
pub const EXE_FINDER: &str = "WacOSFinder.exe";
pub const EXE_SETTINGS: &str = "WacOSSettings.exe";
pub const EXE_MONITOR: &str = "WacOSActivityMonitor.exe";
pub const EXE_TERMINAL: &str = "WacOSTerminal.exe";
pub const EXE_CALCULATOR: &str = "WacOSCalculator.exe";
pub const EXE_NOTES: &str = "WacOSNotes.exe";
pub const EXE_SCREENSHOT: &str = "WacOSScreenshot.exe";
pub const EXE_PREVIEW: &str = "WacOSPreview.exe";
pub const EXE_REMINDERS: &str = "WacOSReminders.exe";
pub const EXE_CALENDAR: &str = "WacOSCalendar.exe";
pub const EXE_TEXTEDIT: &str = "WacOSTextEdit.exe";
pub const EXE_CLOCK: &str = "WacOSClock.exe";
pub const EXE_WEATHER: &str = "WacOSWeather.exe";
pub const EXE_CONTACTS: &str = "WacOSContacts.exe";
pub const EXE_PHOTOS: &str = "WacOSPhotos.exe";
pub const EXE_TIMEMACHINE: &str = "WacOSTimeMachine.exe";
pub const EXE_MUSIC: &str = "WacOSMusic.exe";
pub const EXE_QUICKTIME: &str = "WacOSQuickTime.exe";
pub const EXE_FORCEQUIT: &str = "WacOSForceQuit.exe";
pub const EXE_TITLEBARS: &str = "WacOSTitleBars.exe";
pub const DLL_WINDOW: &str = "WacOSWindow.dll";
pub const DLL_WINDOW32: &str = "WacOSWindow32.dll";
pub const DLL_GANCHO: &str = "WacOSGancho.dll";
pub const DLL_GANCHO32: &str = "WacOSGancho32.dll";

/// O app do Mac para o arquivo (caminho completo do .exe ao lado deste), ou None
pub fn app_mac_para(path: &str) -> Option<String> {
    let p = std::path::Path::new(path);
    let x = p.extension()?.to_string_lossy().to_lowercase();
    let exe = match x.as_str() {
        "mp3" | "m4a" | "flac" | "wav" | "aac" | "ogg" | "wma" | "aif" | "aiff" | "opus" => EXE_MUSIC,
        "mp4" | "mov" | "m4v" | "mkv" | "avi" | "wmv" | "webm" | "mpg" | "mpeg" | "3gp" => EXE_QUICKTIME,
        _ => return None,
    };
    let full = crate::exe_dir().join(exe);
    full.exists().then(|| full.to_string_lossy().into_owned())
}

/// true = abriu no nosso app
pub fn abrir_no_app_mac(path: &str) -> bool {
    match app_mac_para(path) {
        Some(app) => crate::shell_open(&app, Some(&format!("\"{path}\""))),
        None => false,
    }
}