Created
May 3, 2026 07:28
-
-
Save ivan/81f511ff1617ed6a4ac1c8f7cd73165e to your computer and use it in GitHub Desktop.
Signal-Desktop patch: In the window title, include the name of the person for the focused chat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| From e608507fd776858211e7f28bc3e891c1aa81bdc4 Mon Sep 17 00:00:00 2001 | |
| From: Ivan Kozik <ivan@ludios.org> | |
| Date: Sun, 3 May 2026 02:43:55 +0000 | |
| Subject: [PATCH] In the window title, include the name of the person for the | |
| focused chat | |
| Slop-provider: ChatGPT-5.5-Thinking | |
| --- | |
| ts/ConversationController.preload.ts | 4 ++-- | |
| ts/state/initializeRedux.preload.ts | 14 ++++++++++++++ | |
| ts/windows/main/phase1-ipc.preload.ts | 23 ++++++++++++++++++++++- | |
| 3 files changed, 38 insertions(+), 3 deletions(-) | |
| diff --git a/ts/ConversationController.preload.ts b/ts/ConversationController.preload.ts | |
| index 1471c0654..f20397eab 100644 | |
| --- a/ts/ConversationController.preload.ts | |
| +++ b/ts/ConversationController.preload.ts | |
| @@ -424,12 +424,12 @@ export class ConversationController { | |
| unreadStats.unreadCount + unreadStats.readChatsMarkedUnreadCount; | |
| window.IPC.setBadge(total); | |
| window.IPC.updateTrayIcon(total); | |
| - window.document.title = `${window.getTitle()} (${total})`; | |
| + window.document.title = `(${total}) ${window.getTitle()}`; | |
| } else if (unreadStats.readChatsMarkedUnreadCount > 0) { | |
| const total = unreadStats.readChatsMarkedUnreadCount; | |
| window.IPC.setBadge(total); | |
| window.IPC.updateTrayIcon(total); | |
| - window.document.title = `${window.getTitle()} (${total})`; | |
| + window.document.title = `(${total}) ${window.getTitle()}`; | |
| } else { | |
| window.IPC.setBadge(0); | |
| window.IPC.updateTrayIcon(0); | |
| diff --git a/ts/state/initializeRedux.preload.ts b/ts/state/initializeRedux.preload.ts | |
| index 50fa25073..2b881e158 100644 | |
| --- a/ts/state/initializeRedux.preload.ts | |
| +++ b/ts/state/initializeRedux.preload.ts | |
| @@ -47,6 +47,20 @@ export function initializeRedux(data: ReduxInitData): void { | |
| const store = createStore(initialState); | |
| window.reduxStore = store; | |
| + let lastWindowTitle: string | undefined; | |
| + const updateWindowTitle = () => { | |
| + const nextWindowTitle = window.getTitle(); | |
| + if (nextWindowTitle === lastWindowTitle) { | |
| + return; | |
| + } | |
| + | |
| + lastWindowTitle = nextWindowTitle; | |
| + window.Whisper.events.emit('updateUnreadCount'); | |
| + }; | |
| + | |
| + updateWindowTitle(); | |
| + store.subscribe(updateWindowTitle); | |
| + | |
| // Binding these actions to our redux store and exposing them allows us to update | |
| // redux when things change in the rest of the app. | |
| window.reduxActions = { | |
| diff --git a/ts/windows/main/phase1-ipc.preload.ts b/ts/windows/main/phase1-ipc.preload.ts | |
| index 5b3c2c74a..81a82ee68 100644 | |
| --- a/ts/windows/main/phase1-ipc.preload.ts | |
| +++ b/ts/windows/main/phase1-ipc.preload.ts | |
| @@ -10,6 +10,7 @@ import type { IPCType } from '../../window.d.ts'; | |
| import { parseIntWithFallback } from '../../util/parseIntWithFallback.std.ts'; | |
| import { getSignalConnections } from '../../util/getSignalConnections.preload.ts'; | |
| import { ThemeType } from '../../types/Util.std.ts'; | |
| +import { NavTab } from '../../types/Nav.std.ts'; | |
| import { Environment } from '../../environment.std.ts'; | |
| import { SignalContext } from '../context.preload.ts'; | |
| import { createLogger } from '../../logging/log.std.ts'; | |
| @@ -60,7 +61,27 @@ window.Whisper = { | |
| }; | |
| window.ConversationController = new ConversationController(); | |
| window.platform = process.platform; | |
| -window.getTitle = () => title; | |
| +window.getTitle = () => { | |
| + const selectedLocation = window.reduxStore?.getState().nav.selectedLocation; | |
| + if (selectedLocation?.tab !== NavTab.Chats) { | |
| + return title; | |
| + } | |
| + | |
| + const selectedConversationId = selectedLocation.details.conversationId; | |
| + if (!selectedConversationId) { | |
| + return title; | |
| + } | |
| + | |
| + const conversationTitle = window.reduxStore | |
| + .getState() | |
| + .conversations.conversationLookup[selectedConversationId]?.title?.trim(); | |
| + | |
| + if (!conversationTitle) { | |
| + return title; | |
| + } | |
| + | |
| + return `${conversationTitle} - ${title}`; | |
| +}; | |
| window.getAppInstance = () => config.appInstance; | |
| window.getVersion = () => config.version; | |
| window.getBuildCreation = () => parseIntWithFallback(config.buildCreation, 0); | |
| -- | |
| 2.51.0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment