Plugin
Title
Replaces the window title prefix
1
/*2
* FiveCord — a Discord client mod3
* Copyright (c) 2025 FiveCord4
* SPDX-License-Identifier: GPL-3.0-or-later5
*/6
7
import { definePluginSettings } from "@api/Settings";8
import { Devs } from "@utils/constants";9
import definePlugin, { OptionType } from "@utils/types";10
import { findByPropsLazy } from "@webpack";11
12
const TitleManager = findByPropsLazy("setPageTitleNotificationCount", "flashPageTitle");13
const rootTitle = { base: null as string | null };14
15
export const settings = definePluginSettings({16
title: {17
type: OptionType.STRING,18
default: "FiveCord",19
description: "Window title prefix",20
onChange: setTitle,21
},22
});23
24
function setTitle(v: string) {25
rootTitle.base = v || null;26
TitleManager.flashPageTitle({ messages: 0 })();27
}28
29
export 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