You've already forked AstralRinth
forked from didirus/AstralRinth
Initial draft of profile metadata format & CLI (#17)
* Initial draft of profile metadata format * Remove records, add Clippy to Nix, fix Clippy error * Work on profile definition * BREAKING: Make global settings consistent with profile settings * Add builder methods & format * Integrate launching with profiles * Add profile loading * Launching via profile, API tweaks, and yak shaving * Incremental update, committing everything due to personal system maintainance * Prepare for review cycle * Remove reminents of experimental work * CLI: allow people to override the non-empty directory check * Fix mistake in previous commit * Handle trailing whitespace and newlines in prompts * Revamp prompt to use dialoguer and support defaults * Make requested changes
This commit is contained in:
@@ -1,89 +1,89 @@
|
||||
#![cfg_attr(
|
||||
all(not(debug_assertions), target_os = "windows"),
|
||||
windows_subsystem = "windows"
|
||||
all(not(debug_assertions), target_os = "windows"),
|
||||
windows_subsystem = "windows"
|
||||
)]
|
||||
|
||||
use tauri::api::shell;
|
||||
use tauri::{
|
||||
CustomMenuItem, Manager, Menu, MenuEntry, MenuItem, Submenu, WindowBuilder, WindowUrl,
|
||||
CustomMenuItem, Manager, Menu, MenuEntry, MenuItem, Submenu, WindowBuilder, WindowUrl,
|
||||
};
|
||||
|
||||
fn main() {
|
||||
let ctx = tauri::generate_context!();
|
||||
let ctx = tauri::generate_context!();
|
||||
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![])
|
||||
.create_window("main", WindowUrl::default(), |win, webview| {
|
||||
let win = win
|
||||
.title("Modrinth")
|
||||
.resizable(true)
|
||||
.decorations(true)
|
||||
.always_on_top(false)
|
||||
.inner_size(800.0, 550.0)
|
||||
.min_inner_size(400.0, 200.0)
|
||||
.skip_taskbar(false)
|
||||
.fullscreen(false);
|
||||
return (win, webview);
|
||||
})
|
||||
.menu(Menu::with_items([
|
||||
#[cfg(target_os = "macos")]
|
||||
MenuEntry::Submenu(Submenu::new(
|
||||
&ctx.package_info().name,
|
||||
Menu::with_items([
|
||||
MenuItem::About(ctx.package_info().name.clone()).into(),
|
||||
MenuItem::Separator.into(),
|
||||
MenuItem::Services.into(),
|
||||
MenuItem::Separator.into(),
|
||||
MenuItem::Hide.into(),
|
||||
MenuItem::HideOthers.into(),
|
||||
MenuItem::ShowAll.into(),
|
||||
MenuItem::Separator.into(),
|
||||
MenuItem::Quit.into(),
|
||||
]),
|
||||
)),
|
||||
MenuEntry::Submenu(Submenu::new(
|
||||
"File",
|
||||
Menu::with_items([MenuItem::CloseWindow.into()]),
|
||||
)),
|
||||
MenuEntry::Submenu(Submenu::new(
|
||||
"Edit",
|
||||
Menu::with_items([
|
||||
MenuItem::Undo.into(),
|
||||
MenuItem::Redo.into(),
|
||||
MenuItem::Separator.into(),
|
||||
MenuItem::Cut.into(),
|
||||
MenuItem::Copy.into(),
|
||||
MenuItem::Paste.into(),
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
MenuItem::Separator.into(),
|
||||
MenuItem::SelectAll.into(),
|
||||
]),
|
||||
)),
|
||||
MenuEntry::Submenu(Submenu::new(
|
||||
"View",
|
||||
Menu::with_items([MenuItem::EnterFullScreen.into()]),
|
||||
)),
|
||||
MenuEntry::Submenu(Submenu::new(
|
||||
"Window",
|
||||
Menu::with_items([MenuItem::Minimize.into(), MenuItem::Zoom.into()]),
|
||||
)),
|
||||
// You should always have a Help menu on macOS because it will automatically
|
||||
// show a menu search field
|
||||
MenuEntry::Submenu(Submenu::new(
|
||||
"Help",
|
||||
Menu::with_items([CustomMenuItem::new("Learn More", "Learn More").into()]),
|
||||
)),
|
||||
]))
|
||||
.on_menu_event(|event| {
|
||||
let event_name = event.menu_item_id();
|
||||
match event_name {
|
||||
"Learn More" => {
|
||||
let url = "https://modrinth.com".to_string();
|
||||
shell::open(&event.window().shell_scope(), url, None).unwrap();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
})
|
||||
.run(ctx)
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![])
|
||||
.create_window("main", WindowUrl::default(), |win, webview| {
|
||||
let win = win
|
||||
.title("Modrinth")
|
||||
.resizable(true)
|
||||
.decorations(true)
|
||||
.always_on_top(false)
|
||||
.inner_size(800.0, 550.0)
|
||||
.min_inner_size(400.0, 200.0)
|
||||
.skip_taskbar(false)
|
||||
.fullscreen(false);
|
||||
return (win, webview);
|
||||
})
|
||||
.menu(Menu::with_items([
|
||||
#[cfg(target_os = "macos")]
|
||||
MenuEntry::Submenu(Submenu::new(
|
||||
&ctx.package_info().name,
|
||||
Menu::with_items([
|
||||
MenuItem::About(ctx.package_info().name.clone()).into(),
|
||||
MenuItem::Separator.into(),
|
||||
MenuItem::Services.into(),
|
||||
MenuItem::Separator.into(),
|
||||
MenuItem::Hide.into(),
|
||||
MenuItem::HideOthers.into(),
|
||||
MenuItem::ShowAll.into(),
|
||||
MenuItem::Separator.into(),
|
||||
MenuItem::Quit.into(),
|
||||
]),
|
||||
)),
|
||||
MenuEntry::Submenu(Submenu::new(
|
||||
"File",
|
||||
Menu::with_items([MenuItem::CloseWindow.into()]),
|
||||
)),
|
||||
MenuEntry::Submenu(Submenu::new(
|
||||
"Edit",
|
||||
Menu::with_items([
|
||||
MenuItem::Undo.into(),
|
||||
MenuItem::Redo.into(),
|
||||
MenuItem::Separator.into(),
|
||||
MenuItem::Cut.into(),
|
||||
MenuItem::Copy.into(),
|
||||
MenuItem::Paste.into(),
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
MenuItem::Separator.into(),
|
||||
MenuItem::SelectAll.into(),
|
||||
]),
|
||||
)),
|
||||
MenuEntry::Submenu(Submenu::new(
|
||||
"View",
|
||||
Menu::with_items([MenuItem::EnterFullScreen.into()]),
|
||||
)),
|
||||
MenuEntry::Submenu(Submenu::new(
|
||||
"Window",
|
||||
Menu::with_items([MenuItem::Minimize.into(), MenuItem::Zoom.into()]),
|
||||
)),
|
||||
// You should always have a Help menu on macOS because it will automatically
|
||||
// show a menu search field
|
||||
MenuEntry::Submenu(Submenu::new(
|
||||
"Help",
|
||||
Menu::with_items([CustomMenuItem::new("Learn More", "Learn More").into()]),
|
||||
)),
|
||||
]))
|
||||
.on_menu_event(|event| {
|
||||
let event_name = event.menu_item_id();
|
||||
match event_name {
|
||||
"Learn More" => {
|
||||
let url = "https://github.com/probablykasper/tauri-template".to_string();
|
||||
shell::open(&event.window().shell_scope(), url, None).unwrap();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
})
|
||||
.run(ctx)
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user