style: cargo fmt (#89)
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
tauri_build::build()
|
tauri_build::build()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use tauri_utils::config::{Config, WindowConfig};
|
|||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
use wry::application::platform::macos::WindowBuilderExtMacOS;
|
use wry::application::platform::macos::WindowBuilderExtMacOS;
|
||||||
|
|
||||||
#[cfg(target_os="macos")]
|
#[cfg(target_os = "macos")]
|
||||||
use wry::{
|
use wry::{
|
||||||
application::{
|
application::{
|
||||||
accelerator::{Accelerator, SysMods},
|
accelerator::{Accelerator, SysMods},
|
||||||
@@ -18,33 +18,29 @@ use wry::{
|
|||||||
webview::WebViewBuilder,
|
webview::WebViewBuilder,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
#[cfg(target_os="windows")]
|
|
||||||
use wry::{
|
use wry::{
|
||||||
application::{
|
application::{
|
||||||
event::{Event, StartCause, WindowEvent},
|
event::{Event, StartCause, WindowEvent},
|
||||||
event_loop::{ControlFlow, EventLoop},
|
event_loop::{ControlFlow, EventLoop},
|
||||||
menu::{MenuType},
|
menu::MenuType,
|
||||||
window::{Fullscreen, Window, WindowBuilder, Icon},
|
window::{Fullscreen, Icon, Window, WindowBuilder},
|
||||||
},
|
},
|
||||||
webview::WebViewBuilder,
|
webview::WebViewBuilder,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
#[cfg(target_os="linux")]
|
|
||||||
use wry::{
|
use wry::{
|
||||||
application::{
|
application::{
|
||||||
event::{Event, StartCause, WindowEvent},
|
event::{Event, StartCause, WindowEvent},
|
||||||
event_loop::{ControlFlow, EventLoop},
|
event_loop::{ControlFlow, EventLoop},
|
||||||
menu::{MenuType},
|
menu::MenuType,
|
||||||
window::{Fullscreen, Window, WindowBuilder},
|
window::{Fullscreen, Window, WindowBuilder},
|
||||||
},
|
},
|
||||||
webview::WebViewBuilder,
|
webview::WebViewBuilder,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
fn main() -> wry::Result<()> {
|
fn main() -> wry::Result<()> {
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
let mut menu_bar_menu = Menu::new();
|
let mut menu_bar_menu = Menu::new();
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
@@ -126,7 +122,6 @@ fn main() -> wry::Result<()> {
|
|||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
let icon = load_icon(std::path::Path::new(icon_path));
|
let icon = load_icon(std::path::Path::new(icon_path));
|
||||||
|
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
let window = common_window
|
let window = common_window
|
||||||
.with_decorations(true)
|
.with_decorations(true)
|
||||||
@@ -136,10 +131,7 @@ fn main() -> wry::Result<()> {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
let window = common_window
|
let window = common_window.with_title("").build(&event_loop).unwrap();
|
||||||
.with_title("")
|
|
||||||
.build(&event_loop)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
let window = common_window
|
let window = common_window
|
||||||
@@ -160,9 +152,9 @@ fn main() -> wry::Result<()> {
|
|||||||
} else {
|
} else {
|
||||||
window.set_fullscreen(Some(Fullscreen::Borderless(None)));
|
window.set_fullscreen(Some(Fullscreen::Borderless(None)));
|
||||||
}
|
}
|
||||||
} else if req.starts_with("open_browser"){
|
} else if req.starts_with("open_browser") {
|
||||||
let href = req.replace("open_browser:", "");
|
let href = req.replace("open_browser:", "");
|
||||||
webbrowser::open(&href).expect("no browser");
|
webbrowser::open(&href).expect("no browser");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -174,8 +166,8 @@ fn main() -> wry::Result<()> {
|
|||||||
.with_back_forward_navigation_gestures(true)
|
.with_back_forward_navigation_gestures(true)
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
||||||
|
#[cfg(feature = "devtools")]
|
||||||
#[cfg(feature = "devtools")] {
|
{
|
||||||
webview.open_devtools();
|
webview.open_devtools();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,13 +207,13 @@ fn get_windows_config() -> Option<WindowConfig> {
|
|||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
fn load_icon(path: &std::path::Path) -> Icon {
|
fn load_icon(path: &std::path::Path) -> Icon {
|
||||||
let (icon_rgba, icon_width, icon_height) = {
|
let (icon_rgba, icon_width, icon_height) = {
|
||||||
// alternatively, you can embed the icon in the binary through `include_bytes!` macro and use `image::load_from_memory`
|
// alternatively, you can embed the icon in the binary through `include_bytes!` macro and use `image::load_from_memory`
|
||||||
let image = image::open(path)
|
let image = image::open(path)
|
||||||
.expect("Failed to open icon path")
|
.expect("Failed to open icon path")
|
||||||
.into_rgba8();
|
.into_rgba8();
|
||||||
let (width, height) = image.dimensions();
|
let (width, height) = image.dimensions();
|
||||||
let rgba = image.into_raw();
|
let rgba = image.into_raw();
|
||||||
(rgba, width, height)
|
(rgba, width, height)
|
||||||
};
|
};
|
||||||
Icon::from_rgba(icon_rgba, icon_width, icon_height).expect("Failed to open icon")
|
Icon::from_rgba(icon_rgba, icon_width, icon_height).expect("Failed to open icon")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user