Enable Desktop Notifications on first run
This commit is contained in:
parent
d9f2b15e84
commit
9d144a11be
4 changed files with 18 additions and 0 deletions
2
src/globals.d.ts
vendored
2
src/globals.d.ts
vendored
|
@ -1,5 +1,7 @@
|
|||
declare global {
|
||||
export var VencordDesktop: typeof import("./preload/VencordDesktop").VencordDesktop;
|
||||
// TODO
|
||||
export var Vencord: any;
|
||||
}
|
||||
|
||||
export { };
|
||||
|
|
1
src/renderer/constants.ts
Normal file
1
src/renderer/constants.ts
Normal file
|
@ -0,0 +1 @@
|
|||
export const localStorage = window.localStorage;
|
|
@ -1,4 +1,5 @@
|
|||
import "./hideGarbage.css";
|
||||
import { isFirstRun } from "./utilts";
|
||||
|
||||
// Make clicking Notifications focus the window
|
||||
const originalSetOnClick = Object.getOwnPropertyDescriptor(Notification.prototype, "onclick")!.set!;
|
||||
|
@ -11,3 +12,9 @@ Object.defineProperty(Notification.prototype, "onclick", {
|
|||
},
|
||||
configurable: true
|
||||
});
|
||||
|
||||
if (isFirstRun) {
|
||||
Vencord.Webpack.waitFor("setDesktopType", m => {
|
||||
m.setDesktopType("all");
|
||||
});
|
||||
}
|
||||
|
|
8
src/renderer/utilts.ts
Normal file
8
src/renderer/utilts.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
export const localStorage = window.localStorage;
|
||||
|
||||
export const isFirstRun = (() => {
|
||||
const key = "VCD_FIRST_RUN";
|
||||
if (localStorage.getItem(key) !== null) return false;
|
||||
localStorage.setItem(key, "false");
|
||||
return true;
|
||||
})();
|
Loading…
Reference in a new issue