ChannelTabs: Updates (#439)

This commit is contained in:
Jake 2025-10-04 02:24:12 +01:00 • committed by GitHub
parent 079f462e2e
commit 310848e0cc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 6 deletions

View file

@ -36,7 +36,7 @@ const contextMenuPatch: NavContextMenuPatchCallback = (children, props: { channe
export default definePlugin({
name: "ChannelTabs",
description: "Group your commonly visited channels in tabs, like a browser",
authors: [Devs.TheSun, Devs.TheKodeToad, EquicordDevs.keifufu, Devs.Nickyux, EquicordDevs.DiabeloDEV],
authors: [Devs.TheSun, Devs.TheKodeToad, EquicordDevs.keifufu, Devs.Nickyux, EquicordDevs.DiabeloDEV, EquicordDevs.justjxke],
dependencies: ["ContextMenuAPI"],
contextMenus: {
"channel-mention-context": contextMenuPatch,

View file

@ -198,9 +198,9 @@ export const settings = definePluginSettings({
},
rapidNavigationThreshold: {
type: OptionType.SLIDER,
description: "Time window (in milliseconds) for rapid navigation. Within this time, new channels replace the current tab instead of creating new ones.",
markers: [500, 1000, 1500, 2000, 3000, 5000, 10000],
default: 3000,
description: "Time window (in seconds) for rapid navigation. Within this time, new channels replace the current tab instead of creating new ones.",
markers: [1, 2, 3, 5, 10, 20, 30, 40, 50, 60],
default: 3,
stickToMarkers: false,
},
tabBarPosition: {
@ -349,5 +349,11 @@ export const settings = definePluginSettings({
description: "Show resize handle when hovering over tabs to adjust tab width",
default: true,
restartNeeded: false
},
openNewTabsInCompactMode: {
type: OptionType.BOOLEAN,
description: "Open all newly created tabs in compact mode by default",
default: false,
restartNeeded: false
}
});

View file

@ -115,7 +115,7 @@ let clearGhostTabs = () => {
export function createTab(props: BasicChannelTabsProps | ChannelTabsProps, switchToTab?: boolean, messageId?: string, save = true) {
const id = genId();
openTabs.push({ ...props, id, messageId, compact: "compact" in props ? props.compact : false });
openTabs.push({ ...props, id, messageId, compact: "compact" in props ? props.compact : settings.store.openNewTabsInCompactMode });
if (switchToTab) moveToTab(id);
clearGhostTabs();
update(save);
@ -227,7 +227,7 @@ export function handleChannelSwitch(ch: BasicChannelTabsProps) {
if (settings.store.createNewTabIfNotExists) {
// Apply rapid navigation logic when creating new tabs
const now = Date.now();
const isRapidNavigation = now - lastNavigationTime < settings.store.rapidNavigationThreshold;
const isRapidNavigation = now - lastNavigationTime < settings.store.rapidNavigationThreshold * 1000;
lastNavigationTime = now;
if (isRapidNavigation && settings.store.enableRapidNavigation) {