Vibecoded CI/CD
This commit is contained in:
38
frontend/src-tauri/src/lib.rs
Normal file
38
frontend/src-tauri/src/lib.rs
Normal file
@@ -0,0 +1,38 @@
|
||||
/* Mathew as a window.
|
||||
|
||||
The shell is thin on purpose. Everything the app *is* — the open book, the
|
||||
editor, the five interface languages — is the Nuxt bundle it loads, written
|
||||
out by `npm run desktop:generate` and read from disk by the system webview
|
||||
(see src-tauri/README.md). The wiki reaches its own API by itself: no Rust
|
||||
command stands between the two, so an article is fetched the same way in the
|
||||
window as in a browser.
|
||||
|
||||
Two things are the shell's own:
|
||||
|
||||
- `opener`, the door a link goes out by. The wiki asks for it by name
|
||||
(app/utils/desktop.ts); `capabilities/default.json` is what answers.
|
||||
- one window per launch. Pressing the icon again brings the window that is
|
||||
already open to the front instead of stacking a second copy of the wiki
|
||||
behind it. */
|
||||
|
||||
#[cfg(desktop)]
|
||||
use tauri::Manager;
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
let mut builder = tauri::Builder::default().plugin(tauri_plugin_opener::init());
|
||||
|
||||
#[cfg(desktop)]
|
||||
{
|
||||
builder = builder.plugin(tauri_plugin_single_instance::init(|app, _argv, _cwd| {
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
let _ = window.unminimize();
|
||||
let _ = window.set_focus();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
builder
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running Mathew");
|
||||
}
|
||||
7
frontend/src-tauri/src/main.rs
Normal file
7
frontend/src-tauri/src/main.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
// An app window has no terminal to answer from: keep one from opening behind
|
||||
// it on Windows, where a release build would otherwise start a console.
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
fn main() {
|
||||
mathew_desktop_lib::run()
|
||||
}
|
||||
Reference in New Issue
Block a user