Skip to content

Commit

Permalink
Update window + help menus, enable zoom shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
martpie committed Apr 23, 2024
1 parent 8595237 commit 9ffa495
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions src-tauri/capabilities/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"app:allow-tauri-version",
"log:allow-log",
"webview:deny-print",
"webview:allow-set-webview-zoom",
"menu:allow-new",
"menu:allow-popup",
"notification:default",
Expand Down
20 changes: 15 additions & 5 deletions src-tauri/src/plugins/app_menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use tauri::{
plugin::{Builder, TauriPlugin},
Manager, Runtime,
};
use tauri_plugin_shell::ShellExt;

use crate::libs::error::AnyResult;
use crate::libs::events::IPCEvent;
Expand Down Expand Up @@ -92,7 +93,6 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
// -----------------------------------------------------------------
// View sub-menu
// -----------------------------------------------------------------
// TODO: create events listeners and shortcuts
let view_menu = SubmenuBuilder::new(app_handle, "View")
.item(
&MenuItemBuilder::new("Jump to playing track")
Expand Down Expand Up @@ -123,6 +123,7 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
.build(app_handle)
.unwrap(),
)
.separator()
.build()
.unwrap();

Expand All @@ -131,8 +132,9 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
// -----------------------------------------------------------------
let window_menu: tauri::menu::Submenu<R> = SubmenuBuilder::new(app_handle, "Window")
.item(
&MenuItemBuilder::new("-")
.enabled(false)
&MenuItemBuilder::new("Minimize")
.id("minimize")
.accelerator("CmdOrCtrl+M")
.build(app_handle)
.unwrap(),
)
Expand All @@ -144,8 +146,8 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
// -----------------------------------------------------------------
let help_menu = SubmenuBuilder::new(app_handle, "Help")
.item(
&MenuItemBuilder::new("-")
.enabled(false)
&MenuItemBuilder::new("Report an issue")
.id("report_an_issue")
.build(app_handle)
.unwrap(),
)
Expand Down Expand Up @@ -194,6 +196,14 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
"go_to_settings" => {
win.emit(IPCEvent::GoToSettings.as_ref(), ()).unwrap();
}
"minimize" => {
win.minimize().unwrap();
}
"report_an_issue" => {
win.shell()
.open("https://github.com/martpie/museeks/issues", None)
.unwrap();
}
_ => {}
});
})
Expand Down
3 changes: 2 additions & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"minWidth": 900,
"fullscreen": false,
"resizable": true,
"dragDropEnabled": false
"dragDropEnabled": false,
"zoomHotkeysEnabled": true
}
],
"security": {
Expand Down

0 comments on commit 9ffa495

Please sign in to comment.