mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-21 23:05:46 +00:00
fix(tauri): exit app on close and grant ipc permissions & update changelog
This commit is contained in:
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [0.1.1] - Beta Hotfix
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- **App Termination Bug**: Fixed an issue where the application would hang in the background when the close button was clicked due to default Tauri tray icon handling. The `exit_app` event is now correctly triggered.
|
||||||
|
|
||||||
## [0.1.0] - Initial Release
|
## [0.1.0] - Initial Release
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -23,6 +23,10 @@
|
|||||||
"fs:allow-mkdir",
|
"fs:allow-mkdir",
|
||||||
"fs:scope-download-recursive",
|
"fs:scope-download-recursive",
|
||||||
"fs:scope-home-recursive",
|
"fs:scope-home-recursive",
|
||||||
"core:window:allow-set-title"
|
"core:window:allow-set-title",
|
||||||
|
"core:window:allow-close",
|
||||||
|
"core:window:allow-hide",
|
||||||
|
"core:window:allow-show",
|
||||||
|
"core:app:allow-exit"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,11 @@ fn greet(name: &str) -> String {
|
|||||||
format!("Hello, {}!", name)
|
format!("Hello, {}!", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
fn exit_app(app_handle: tauri::AppHandle) {
|
||||||
|
app_handle.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
pub fn run() {
|
pub fn run() {
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
.plugin(tauri_plugin_shell::init())
|
.plugin(tauri_plugin_shell::init())
|
||||||
@@ -54,7 +59,7 @@ pub fn run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
"quit" => {
|
"quit" => {
|
||||||
app.exit(0);
|
std::process::exit(0);
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
})
|
})
|
||||||
@@ -102,7 +107,7 @@ pub fn run() {
|
|||||||
let _ = window.emit("window:close-requested", ());
|
let _ = window.emit("window:close-requested", ());
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.invoke_handler(tauri::generate_handler![greet])
|
.invoke_handler(tauri::generate_handler![greet, exit_app])
|
||||||
.run(tauri::generate_context!())
|
.run(tauri::generate_context!())
|
||||||
.expect("error while running Psysonic");
|
.expect("error while running Psysonic");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import React, { useEffect, useState, useCallback } from 'react';
|
import React, { useEffect, useState, useCallback } from 'react';
|
||||||
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
|
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
|
||||||
import { listen } from '@tauri-apps/api/event';
|
import { listen } from '@tauri-apps/api/event';
|
||||||
|
import { invoke } from '@tauri-apps/api/core';
|
||||||
import { getCurrentWindow } from '@tauri-apps/api/window';
|
import { getCurrentWindow } from '@tauri-apps/api/window';
|
||||||
import Sidebar from './components/Sidebar';
|
import Sidebar from './components/Sidebar';
|
||||||
import PlayerBar from './components/PlayerBar';
|
import PlayerBar from './components/PlayerBar';
|
||||||
@@ -207,6 +208,9 @@ function TauriEventBridge() {
|
|||||||
if (minimizeToTray) {
|
if (minimizeToTray) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
await win.hide();
|
await win.hide();
|
||||||
|
} else {
|
||||||
|
// If not minimizing to tray, we want to exit the app completely
|
||||||
|
await invoke('exit_app');
|
||||||
}
|
}
|
||||||
}).then(u => unlisten.push(u));
|
}).then(u => unlisten.push(u));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user