2023-04-05 05:31:44 +02:00
|
|
|
import "./hideGarbage.css";
|
2023-04-05 20:01:31 +02:00
|
|
|
import { isFirstRun, localStorage } from "./utils";
|
2023-04-05 05:31:44 +02:00
|
|
|
|
2023-04-05 05:19:48 +02:00
|
|
|
// Make clicking Notifications focus the window
|
|
|
|
const originalSetOnClick = Object.getOwnPropertyDescriptor(Notification.prototype, "onclick")!.set!;
|
|
|
|
Object.defineProperty(Notification.prototype, "onclick", {
|
|
|
|
set(onClick) {
|
2023-04-05 16:56:33 +02:00
|
|
|
originalSetOnClick.call(this, function (this: unknown) {
|
2023-04-05 05:19:48 +02:00
|
|
|
onClick.apply(this, arguments);
|
|
|
|
VencordDesktop.win.focus();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
configurable: true
|
|
|
|
});
|
2023-04-05 16:51:19 +02:00
|
|
|
|
2023-04-05 16:56:33 +02:00
|
|
|
// Enable Desktop Notifications by default
|
2023-04-05 16:51:19 +02:00
|
|
|
if (isFirstRun) {
|
2023-04-05 20:01:31 +02:00
|
|
|
// Hide "Download Discord Desktop now!!!!" banner
|
|
|
|
localStorage.setItem("hideNag", "true");
|
|
|
|
|
2023-04-05 16:51:19 +02:00
|
|
|
Vencord.Webpack.waitFor("setDesktopType", m => {
|
|
|
|
m.setDesktopType("all");
|
|
|
|
});
|
|
|
|
}
|