Tray notification icon dot

This commit is contained in:
Natsumi
2025-10-30 01:16:17 +11:00
parent 814a66abea
commit 3836b9b4ce
15 changed files with 90 additions and 35 deletions

View File

@@ -23,6 +23,7 @@ export const useUiStore = defineStore('Ui', () => {
const notifiedMenus = ref([]);
const shiftHeld = ref(false);
const trayIconNotify = ref(false);
watch(
() => watchState.isLoggedIn,
@@ -41,6 +42,7 @@ export const useUiStore = defineStore('Ui', () => {
!notifiedMenus.value.includes(index)
) {
notifiedMenus.value.push(index);
updateTrayIconNotify();
}
}
@@ -58,6 +60,22 @@ export const useUiStore = defineStore('Ui', () => {
function removeNotify(index) {
notifiedMenus.value = notifiedMenus.value.filter((i) => i !== index);
updateTrayIconNotify();
}
function updateTrayIconNotify() {
const newState =
notifiedMenus.value.includes('notification') ||
notifiedMenus.value.includes('friendLog');
if (trayIconNotify.value !== newState) {
trayIconNotify.value = newState;
if (LINUX) {
window.electron.setTrayIconNotification(trayIconNotify.value);
return;
}
AppApi.SetTrayIconNotification(trayIconNotify.value);
}
}
return {

View File

@@ -36,6 +36,7 @@ declare global {
};
electron: {
getArch: () => Promise<string>;
setTrayIconNotification: (notify: boolean) => Promise<void>;
openFileDialog: () => Promise<string>;
openDirectoryDialog: () => Promise<string>;
desktopNotification: (
@@ -187,6 +188,7 @@ declare global {
CopyImageToClipboard(path: string): Promise<void>;
FlashWindow(): Promise<void>;
SetUserAgent(): Promise<void>;
SetTrayIconNotification(notify: boolean): Promise<void>;
// Common Functions
GetColourFromUserID(userId: string): Promise<number>;