Prevent right-click menu from showing up

This commit is contained in:
Skyler Lehmkuhl 2025-01-10 18:48:15 -05:00
parent e22bafdeeb
commit 4b3c89d919
2 changed files with 19 additions and 0 deletions

View File

@ -2,6 +2,7 @@ use tauri_plugin_log::{Target, TargetKind};
use log::{trace, info, debug, warn, error}; use log::{trace, info, debug, warn, error};
use tracing_subscriber::EnvFilter; use tracing_subscriber::EnvFilter;
use chrono::Local; use chrono::Local;
use tauri::Manager;
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/ // Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
@ -62,6 +63,15 @@ pub fn run() {
.plugin(tauri_plugin_fs::init()) .plugin(tauri_plugin_fs::init())
.plugin(tauri_plugin_shell::init()) .plugin(tauri_plugin_shell::init())
.invoke_handler(tauri::generate_handler![greet, trace, debug, info, warn, error]) .invoke_handler(tauri::generate_handler![greet, trace, debug, info, warn, error])
.setup(|app| {
#[cfg(debug_assertions)] // only include this code on debug builds
{
let window = app.get_webview_window("main").unwrap();
window.open_devtools();
window.close_devtools();
}
Ok(())
})
.run(tauri::generate_context!()) .run(tauri::generate_context!())
.expect("error while running tauri application"); .expect("error while running tauri application");
tracing_subscriber::fmt().with_env_filter(EnvFilter::new(format!("{}=trace", pkg_name))).init(); tracing_subscriber::fmt().with_env_filter(EnvFilter::new(format!("{}=trace", pkg_name))).init();

View File

@ -4118,6 +4118,15 @@ window.addEventListener("click", function (event) {
} }
}); });
window.addEventListener("contextmenu", async (e) => {
e.preventDefault()
// const menu = await Menu.new({
// items: [
// ],
// });
// menu.popup({ x: event.clientX, y: event.clientY });
})
window.addEventListener("keydown", (e) => { window.addEventListener("keydown", (e) => {
// let shortcuts = {} // let shortcuts = {}
// for (let shortcut of config.shortcuts) { // for (let shortcut of config.shortcuts) {