diff --git a/src/plugins/typingIndicator/index.tsx b/src/plugins/typingIndicator/index.tsx index c5cf5a9d..171c560d 100644 --- a/src/plugins/typingIndicator/index.tsx +++ b/src/plugins/typingIndicator/index.tsx @@ -21,7 +21,7 @@ import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; import { findExportedComponentLazy, findStoreLazy } from "@webpack"; -import { ChannelStore, GuildMemberStore, i18n, RelationshipStore, Tooltip, UserStore, useStateFromStores } from "@webpack/common"; +import { ChannelStore, GuildMemberStore, i18n, RelationshipStore, SelectedChannelStore, Tooltip, UserStore, useStateFromStores } from "@webpack/common"; import { buildSeveralUsers } from "../typingTweaks"; @@ -47,7 +47,7 @@ function TypingIndicator({ channelId }: { channelId: string; }) { return oldKeys.length === currentKeys.length && currentKeys.every(key => old[key] != null); } ); - + const currentChannelId: string = useStateFromStores([SelectedChannelStore], () => SelectedChannelStore.getChannelId()); const guildId = ChannelStore.getChannel(channelId).guild_id; if (!settings.store.includeMutedChannels) { @@ -55,6 +55,10 @@ function TypingIndicator({ channelId }: { channelId: string; }) { if (isChannelMuted) return null; } + if (!settings.store.includeCurrentChannel) { + if (currentChannelId === channelId) return null; + } + const myId = UserStore.getCurrentUser()?.id; const typingUsersArray = Object.keys(typingUsers).filter(id => id !== myId && !(RelationshipStore.isBlocked(id) && !settings.store.includeBlockedUsers)); @@ -101,6 +105,11 @@ function TypingIndicator({ channelId }: { channelId: string; }) { } const settings = definePluginSettings({ + includeCurrentChannel: { + type: OptionType.BOOLEAN, + description: "Whether to show the typing indicator for the currently selected channel", + default: true + }, includeMutedChannels: { type: OptionType.BOOLEAN, description: "Whether to show the typing indicator for muted channels.",