feat: add autostart toggle setting

This commit is contained in:
PandaDEV 2025-01-02 18:41:28 +10:00
parent 6d7874c1ae
commit 3bfd72b638
No known key found for this signature in database
GPG key ID: 13EFF9BAF70EE75C
7 changed files with 11 additions and 16 deletions

View file

@ -7,9 +7,11 @@
<script setup lang="ts">
import { listen } from "@tauri-apps/api/event";
import { app, window } from "@tauri-apps/api";
import { disable, enable } from "@tauri-apps/plugin-autostart";
import { onMounted } from "vue";
const keyboard = useKeyboard();
const { $settings } = useNuxtApp();
onMounted(async () => {
await listen("settings", async () => {
@ -19,6 +21,12 @@ onMounted(async () => {
await window.getCurrentWindow().show();
});
if ((await $settings.getSetting("autostart")) === "true") {
await enable();
} else {
await disable();
}
await listen("main_route", async () => {
await navigateTo("/");
});
@ -54,7 +62,6 @@ onMounted(async () => {
margin: 0;
padding: 0;
box-sizing: border-box;
color: #e5dfd5;
text-decoration: none;
font-family: SFRoundedRegular;
scroll-behavior: smooth;