feat: add taskbar flashing on new notifications (#1209)
Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
@@ -142,6 +142,11 @@ handle(IpcEvents.SELECT_VENCORD_DIR, async (_e, value?: null) => {
|
|||||||
|
|
||||||
handle(IpcEvents.SET_BADGE_COUNT, (_, count: number) => setBadgeCount(count));
|
handle(IpcEvents.SET_BADGE_COUNT, (_, count: number) => setBadgeCount(count));
|
||||||
|
|
||||||
|
handle(IpcEvents.FLASH_FRAME, (_, flag: boolean) => {
|
||||||
|
if (!mainWin || mainWin.isDestroyed() || (flag && mainWin.isFocused())) return;
|
||||||
|
mainWin.flashFrame(flag);
|
||||||
|
});
|
||||||
|
|
||||||
handle(IpcEvents.CLIPBOARD_COPY_IMAGE, async (_, buf: ArrayBuffer, src: string) => {
|
handle(IpcEvents.CLIPBOARD_COPY_IMAGE, async (_, buf: ArrayBuffer, src: string) => {
|
||||||
clipboard.write({
|
clipboard.write({
|
||||||
html: `<img src="${src.replaceAll('"', '\\"')}">`,
|
html: `<img src="${src.replaceAll('"', '\\"')}">`,
|
||||||
|
|||||||
@@ -389,6 +389,10 @@ function createMainWindow() {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
win.on("focus", () => {
|
||||||
|
win.flashFrame(false);
|
||||||
|
});
|
||||||
|
|
||||||
initWindowBoundsListeners(win);
|
initWindowBoundsListeners(win);
|
||||||
if (!isDeckGameMode && (Settings.store.tray ?? true) && process.platform !== "darwin")
|
if (!isDeckGameMode && (Settings.store.tray ?? true) && process.platform !== "darwin")
|
||||||
initTray(win, q => (isQuitting = q));
|
initTray(win, q => (isQuitting = q));
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ export const VesktopNative = {
|
|||||||
close: (key?: string) => invoke<void>(IpcEvents.CLOSE, key),
|
close: (key?: string) => invoke<void>(IpcEvents.CLOSE, key),
|
||||||
minimize: (key?: string) => invoke<void>(IpcEvents.MINIMIZE, key),
|
minimize: (key?: string) => invoke<void>(IpcEvents.MINIMIZE, key),
|
||||||
maximize: (key?: string) => invoke<void>(IpcEvents.MAXIMIZE, key),
|
maximize: (key?: string) => invoke<void>(IpcEvents.MAXIMIZE, key),
|
||||||
|
flashFrame: (flag: boolean) => invoke<void>(IpcEvents.FLASH_FRAME, flag),
|
||||||
setDevtoolsCallbacks: (onOpen: () => void, onClose: () => void) => {
|
setDevtoolsCallbacks: (onOpen: () => void, onClose: () => void) => {
|
||||||
onDevtoolsOpen = onOpen;
|
onDevtoolsOpen = onOpen;
|
||||||
onDevtoolsClose = onClose;
|
onDevtoolsClose = onClose;
|
||||||
|
|||||||
@@ -124,7 +124,15 @@ const SettingsOptions: Record<string, Array<BooleanSetting | SettingsComponent>>
|
|||||||
defaultValue: false
|
defaultValue: false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
Notifications: [NotificationBadgeToggle],
|
Notifications: [
|
||||||
|
NotificationBadgeToggle,
|
||||||
|
{
|
||||||
|
key: "enableTaskbarFlashing",
|
||||||
|
title: "Enable Taskbar Flashing",
|
||||||
|
description: "Flashes the app in your taskbar when you have new notifications.",
|
||||||
|
defaultValue: false
|
||||||
|
}
|
||||||
|
],
|
||||||
Miscellaneous: [
|
Miscellaneous: [
|
||||||
{
|
{
|
||||||
key: "arRPC",
|
key: "arRPC",
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
|
||||||
|
* Copyright (c) 2025 Vendicated and Vesktop contributors
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Settings } from "renderer/settings";
|
||||||
|
|
||||||
|
import { addPatch } from "./shared";
|
||||||
|
|
||||||
|
addPatch({
|
||||||
|
patches: [
|
||||||
|
{
|
||||||
|
find: ".flashFrame(!0)",
|
||||||
|
replacement: {
|
||||||
|
match: /(\i)&&\i\.\i\.taskbarFlash&&\i\.\i\.flashFrame\(!0\)/,
|
||||||
|
replace: "$self.flashFrame()"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
flashFrame() {
|
||||||
|
if (Settings.store.enableTaskbarFlashing) {
|
||||||
|
VesktopNative.win.flashFrame(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -36,6 +36,7 @@ export const enum IpcEvents {
|
|||||||
SPELLCHECK_ADD_TO_DICTIONARY = "VCD_SPELLCHECK_ADD_TO_DICTIONARY",
|
SPELLCHECK_ADD_TO_DICTIONARY = "VCD_SPELLCHECK_ADD_TO_DICTIONARY",
|
||||||
|
|
||||||
SET_BADGE_COUNT = "VCD_SET_BADGE_COUNT",
|
SET_BADGE_COUNT = "VCD_SET_BADGE_COUNT",
|
||||||
|
FLASH_FRAME = "FLASH_FRAME",
|
||||||
|
|
||||||
CAPTURER_GET_LARGE_THUMBNAIL = "VCD_CAPTURER_GET_LARGE_THUMBNAIL",
|
CAPTURER_GET_LARGE_THUMBNAIL = "VCD_CAPTURER_GET_LARGE_THUMBNAIL",
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
@@ -20,6 +20,7 @@ export interface Settings {
|
|||||||
hardwareVideoAcceleration?: boolean;
|
hardwareVideoAcceleration?: boolean;
|
||||||
arRPC?: boolean;
|
arRPC?: boolean;
|
||||||
appBadge?: boolean;
|
appBadge?: boolean;
|
||||||
|
enableTaskbarFlashing?: boolean;
|
||||||
disableMinSize?: boolean;
|
disableMinSize?: boolean;
|
||||||
clickTrayToShowHide?: boolean;
|
clickTrayToShowHide?: boolean;
|
||||||
customTitleBar?: boolean;
|
customTitleBar?: boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user