feat(setting): add restart

This commit is contained in:
AkiChase 2024-04-30 20:44:53 +08:00
parent d55457fb9e
commit 95b302c39f
7 changed files with 21 additions and 11 deletions

View File

@ -12,6 +12,7 @@
"dependencies": {
"@tauri-apps/api": ">=2.0.0-beta.8",
"@tauri-apps/plugin-clipboard-manager": "2.1.0-beta.0",
"@tauri-apps/plugin-process": "2.0.0-beta.2",
"@tauri-apps/plugin-store": "2.0.0-beta.2",
"pinia": "^2.1.7",
"vue": "^3.3.4",

View File

@ -18,3 +18,4 @@ serde_json = "1"
anyhow = "1.0"
tokio = { version = "1.36.0", features = ["rt-multi-thread", "net", "macros", "io-util", "time", "sync"] }
tauri-plugin-clipboard-manager = "2.1.0-beta.1"
tauri-plugin-process = "2.0.0-beta.3"

View File

@ -2,7 +2,9 @@
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "Capability for the main window",
"windows": ["main"],
"windows": [
"main"
],
"permissions": [
"event:default",
"window:default",
@ -23,6 +25,8 @@
"store:allow-entries",
"store:allow-delete",
"clipboard-manager:default",
"clipboard-manager:allow-write-text"
"clipboard-manager:allow-write-text",
"process:default",
"process:allow-restart"
]
}
}

View File

@ -76,7 +76,7 @@ impl Device {
return Ok((width, height));
}
}
};
}
Err(anyhow::anyhow!("Failed to get screen size"))
}
}

View File

@ -130,6 +130,7 @@ fn load_default_keyconfig(app: tauri::AppHandle) -> Result<String, String> {
#[tokio::main]
async fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_process::init())
.plugin(tauri_plugin_clipboard_manager::init())
.plugin(tauri_plugin_store::Builder::new().build())
.setup(|app| {

View File

@ -14,7 +14,7 @@ import {
NCard,
NIcon,
} from "naive-ui";
import { relaunch } from "@tauri-apps/plugin-process";
import { onMounted, ref } from "vue";
const localStore = new Store("store.bin");
@ -63,7 +63,8 @@ function delLocalStore(key?: string) {
positiveText: "删除",
negativeText: "取消",
onPositiveClick: () => {
localStore.clear();
// localStore.clear();
relaunch();
},
});
}

View File

@ -1,13 +1,15 @@
<script setup lang="ts">
import { NH4 } from "naive-ui";
</script>
<template>
<div class="setting-page">
脚本设置
</div>
<div class="setting-page">
<NH4 prefix="bar">敬请期待</NH4>
</div>
</template>
<style scoped>
.setting-page {
padding: 10px 25px;
}
</style>