Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use tauri::Config;

const IS_DEV: bool = tauri::is_dev();

const WINDOW_NAME: &str = "main";

#[derive(Serialize, Deserialize, Debug)]
struct Clock {
#[serde(default)]
Expand Down Expand Up @@ -161,7 +163,7 @@ pub fn run() {
let mut tbr = tauri::Builder::default();
if IS_DEV {
tbr = tbr.setup(|app| {
let _window = app.get_webview_window("main").unwrap();
let _window = app.get_webview_window(WINDOW_NAME).unwrap();
#[cfg(debug_assertions)]
{
_window.open_devtools();
Expand All @@ -171,8 +173,8 @@ pub fn run() {
} else {
tbr = tbr.plugin(tauri_plugin_single_instance::init(|_app, _args, _cwd| {
let _ = _app
.get_webview_window("main")
.expect("execute only main window")
.get_webview_window(WINDOW_NAME)
.expect(&format!("execute only {} window", WINDOW_NAME))
.set_focus();
}))
}
Expand Down