From 55d19ba2c92995cbefc2eeff849aaa82033da642 Mon Sep 17 00:00:00 2001 From: Salastil Date: Sat, 22 Aug 2026 10:36:55 -0400 Subject: [PATCH] Mark pinned buffers by service rather than account name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pinned rows carried the account's display name as a text prefix, so every entry read "Salastil@irc.libera.chat · #archlinux" - the useful part pushed right and truncated first, in the one list where names are already tightest. They now lead with the service instead: the Discord or Matrix mark, the "#" IRC channels already use, and Sneedchat's own glyph. Same information about where a pinned channel lives, in the space an icon occupies. Rows under an account header keep showing their own kind, since the header above already says which account they belong to. --- src/renderer/src/components/BufferList.tsx | 37 +++++++++++++++------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/src/renderer/src/components/BufferList.tsx b/src/renderer/src/components/BufferList.tsx index 0f6e87b..640635c 100644 --- a/src/renderer/src/components/BufferList.tsx +++ b/src/renderer/src/components/BufferList.tsx @@ -89,7 +89,7 @@ export function BufferList(): JSX.Element { active={b.id === activeBufferId} muted={isEffectivelyMuted(b)} pinned - showAccountPrefix + showServiceIcon accounts={accounts} onSelect={() => void store.selectBuffer(b.id)} onTogglePin={() => togglePin(b.id)} @@ -345,7 +345,9 @@ interface BufferRowProps { muted: boolean pinned: boolean accounts: Account[] - showAccountPrefix?: boolean + /** Pinned rows sit outside their account group, so they carry the service + * mark instead of the buffer-kind glyph to show where they belong. */ + showServiceIcon?: boolean onSelect: () => void onTogglePin: () => void onToggleMute: () => void @@ -359,7 +361,7 @@ function BufferRow({ muted, pinned, accounts, - showAccountPrefix, + showServiceIcon, onSelect, onTogglePin, onToggleMute, @@ -369,6 +371,24 @@ function BufferRow({ const { menu, open, close } = useContextMenu() const account = accounts.find((a) => a.id === buffer.accountId) + // Under an account header the row's own kind is what's worth showing (a + // channel vs a DM vs the server buffer). A pinned row has no header above + // it, so it shows the service instead - the Discord or Matrix mark, or the + // "#" that IRC channels already use - rather than repeating the account + // name as text in front of every entry. + const service = serviceIcon(account?.service ?? '') + const leading = showServiceIcon ? ( + service.svg ? ( + + ) : ( + + ) + ) : buffer.avatarUrl ? ( + + ) : ( + + ) + const entries: MenuEntry[] = [ { label: pinned ? 'Unpin' : 'Pin', icon: 'push_pin', onClick: onTogglePin }, { label: muted ? 'Unmute' : 'Mute', icon: muted ? 'notifications' : 'notifications_off', onClick: onToggleMute }, @@ -388,15 +408,8 @@ function BufferRow({ onContextMenu={open} title={buffer.name} > - {buffer.avatarUrl ? ( - - ) : ( - - )} - - {showAccountPrefix && account ? `${account.displayName} · ` : ''} - {bufferDisplayName(buffer.name)} - + {leading} + {bufferDisplayName(buffer.name)} {muted && } {buffer.unread > 0 && !muted && (