Plugin

Title

Replaces the window title prefix

index.ts
Download

Source

src/plugins/title/index.ts
1/*
2 * FiveCord — a Discord client mod
3 * Copyright (c) 2025 FiveCord
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
7import { definePluginSettings } from "@api/Settings";
8import { Devs } from "@utils/constants";
9import definePlugin, { OptionType } from "@utils/types";
10import { findByPropsLazy } from "@webpack";
11
12const TitleManager = findByPropsLazy("setPageTitleNotificationCount", "flashPageTitle");
13const rootTitle = { base: null as string | null };
14
15export const settings = definePluginSettings({
16 title: {
17 type: OptionType.STRING,
18 default: "FiveCord",
19 description: "Window title prefix",
20 onChange: setTitle,
21 },
22});
23
24function setTitle(v: string) {
25 rootTitle.base = v || null;
26 TitleManager.flashPageTitle({ messages: 0 })();
27}
28
29export default definePlugin({
30 name: "Title",
31 description: "Replaces the window title prefix",
32 authors: [Devs.FiveCord],
33 settings,
34
35 patches: [
36 {
37 find: "setPageTitleNotificationCount:function()",
38 replacement: {
39 match: /(?<==)(?={base:)/,
40 replace: "$self.rootTitle??",
41 },
42 },
43 ],
44
45 start() {
46 setTitle(settings.store.title);
47 },
48
49 rootTitle,
50});
51