Desktop: the travewave house look (shared-resources design.html), switchable with Signal vibes

Preferences → Appearance → Style picks Signal vibes (the look so far) or
travewave: house grays, embossed buttons and tiles, a debossed chat-name
panel, 8 px framed lists, button-like scrollbars, Century Gothic for names
and messages. Either way the window is now one rounded frameless tile with
its own title bar (GNOME's button layout) and a menu bar shown by tapping
Alt (Edit → Preferences…, Ctrl+,), tooltips drawn by the page with a
"Show tooltips" preference, and Preferences laid out like VLC's
(categories left, changes apply at once, Close).
This commit is contained in:
2026-11-08 19:36:53 -08:00
parent 6d31a5585e
commit 357a2312ce
15 changed files with 3106 additions and 246 deletions
+59 -5
View File
@@ -1,6 +1,7 @@
// First: in sandbox mode this moves every path the app uses (see sandbox.ts).
import { SANDBOX, seedDemo } from './sandbox'
import { app, BrowserWindow, clipboard, ClipboardItem, dialog, ipcMain, nativeTheme, net, protocol, safeStorage, shell } from 'electron'
import { app, BrowserWindow, clipboard, ClipboardItem, dialog, ipcMain, nativeTheme, net, protocol, safeStorage, screen, shell } from 'electron'
import { execFileSync } from 'node:child_process'
import crypto from 'node:crypto'
import fs from 'node:fs'
import path from 'node:path'
@@ -8,7 +9,7 @@ import os from 'node:os'
import { pathToFileURL } from 'node:url'
import { charCount, groupMembers, isGroup, normalizeNumber, SMS_TEXT_LIMIT } from '@shared/phone'
import type { ChatExport, IconStyle, Credentials, Did, MediaRef, Message, NewContact, OutgoingAttachment, Provider, Settings, SyncStatus, Theme } from '@shared/types'
import type { AppState } from '@shared/api'
import type { AppState, WindowAction, WindowState } from '@shared/api'
import { addToAddressBook, ContactDirectory, listAddressBooks } from './contacts'
import { localDay, MessageDb, type NewMessage } from './db'
import { MediaStore } from './media'
@@ -337,8 +338,42 @@ function applyTheme(): void {
win?.setBackgroundColor(windowBackground())
}
// The window itself stays transparent: the page paints its rounded tile.
function windowBackground(): string {
return nativeTheme.shouldUseDarkColors ? '#121212' : '#ffffff'
return '#00000000'
}
// ---- the window's own frame (design.html#window, #titlebar) ----
// Square corners when maximized, fullscreen or tiled. Wayland doesn't tell
// us about tiling, so a window within 64 px of the screen's full height
// counts as tiled.
function windowState(): WindowState {
if (!win) return { square: false, maximized: false, focused: true }
const maximized = win.isMaximized()
const full = screen.getDisplayMatching(win.getBounds()).bounds
const tiled = full.height - win.getBounds().height <= 64
return { square: maximized || win.isFullScreen() || tiled, maximized, focused: win.isFocused() }
}
function sendWindowState(): void {
if (win && !win.isDestroyed()) win.webContents.send('windowState', windowState())
}
// GNOME's button-layout ("appmenu:minimize,maximize,close"): which side
// the window buttons go on, and in what order.
let buttonLayout: string | undefined
function windowButtons(): string {
if (buttonLayout === undefined) {
try {
buttonLayout = execFileSync('gsettings', ['get', 'org.gnome.desktop.wm.preferences', 'button-layout'], { encoding: 'utf8' })
.trim()
.replace(/^'|'$/g, '')
} catch {
buttonLayout = ''
}
if (!buttonLayout.includes(':')) buttonLayout = 'appmenu:minimize,maximize,close'
}
return buttonLayout
}
const ZOOM_STEP = 0.5
@@ -534,6 +569,20 @@ function registerIpc(): void {
gvSync?.resetBackfill()
}
})
ipcMain.handle('windowState', () => windowState())
ipcMain.handle('windowButtons', () => windowButtons())
ipcMain.handle('windowControl', (_e, action: WindowAction) => {
if (!win) return
if (action === 'zoomIn') setZoom(win.webContents.getZoomLevel() + ZOOM_STEP)
else if (action === 'zoomOut') setZoom(win.webContents.getZoomLevel() - ZOOM_STEP)
else if (action === 'zoomReset') setZoom(0)
else if (action === 'minimize') win.minimize()
else if (action === 'maximize') {
if (win.isMaximized()) win.unmaximize()
else win.maximize()
} else if (action === 'close') win.close()
else app.quit()
})
ipcMain.handle('setIcon', (_e, icon: IconStyle) => {
settings = { ...settings, icon }
saveSettings(settings)
@@ -688,8 +737,11 @@ function createWindow(): void {
minWidth: 760,
minHeight: 480,
title: SANDBOX ? 'bubble (sandbox)' : 'bubble',
backgroundColor: windowBackground(),
autoHideMenuBar: true,
// design.html#window: frameless and see-through; the page paints the
// rounded tile, its own title bar (#titlebar) and menu bar (#menubar).
frame: false,
transparent: true,
backgroundColor: '#00000000',
icon: iconFile(settings.icon),
webPreferences: {
preload: path.join(__dirname, '../preload/index.js'),
@@ -724,6 +776,8 @@ function createWindow(): void {
win.webContents.on('did-finish-load', () => win!.webContents.setZoomLevel(loadZoom()))
// The hidden Google Voice window would otherwise keep 'window-all-closed'
// from firing, leaving a windowless process holding the single-instance lock.
for (const ev of ['maximize', 'unmaximize', 'enter-full-screen', 'leave-full-screen', 'resize', 'focus', 'blur'] as const)
win.on(ev as 'resize', sendWindowState)
win.on('closed', () => {
win = undefined
app.quit()