* fixes

* prettier

* more bugs

* changes

* more fixes

* prettier, fmt, clippy

* fix regressed error

* println, console.log

* fix imports

---------

Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
Co-authored-by: Jai A <jaiagr+gpg@pm.me>
This commit is contained in:
Wyatt Verchere
2023-08-04 20:33:50 -07:00
committed by GitHub
parent 6a76811bed
commit a35dd67b77
27 changed files with 357 additions and 100 deletions

View File

@@ -1,3 +1,4 @@
use serde::{Deserialize, Serialize};
use theseus::{handler, prelude::CommandPayload, State};
use crate::api::Result;
@@ -6,6 +7,7 @@ use std::{env, process::Command};
pub fn init<R: tauri::Runtime>() -> tauri::plugin::TauriPlugin<R> {
tauri::plugin::Builder::new("utils")
.invoke_handler(tauri::generate_handler![
get_os,
should_disable_mouseover,
show_in_folder,
progress_bars_list,
@@ -18,6 +20,24 @@ pub fn init<R: tauri::Runtime>() -> tauri::plugin::TauriPlugin<R> {
.build()
}
/// Gets OS
#[tauri::command]
pub fn get_os() -> OS {
#[cfg(target_os = "windows")]
let os = OS::Windows;
#[cfg(target_os = "linux")]
let os = OS::Linux;
#[cfg(target_os = "macos")]
let os = OS::MacOS;
os
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum OS {
Windows,
Linux,
MacOS,
}
// Lists active progress bars
// Create a new HashMap with the same keys
// Values provided should not be used directly, as they are not guaranteed to be up-to-date