v0.4.0: bubble for Android 0.4.0 — an inverted (lighter) icon, chosen in Settings on both

The original icon is a little dark: resources/icon-inverted.png and
ic_launcher_inverted.png are its negative (alpha kept).

- Desktop: Settings → Appearance → Icon (Dark / Inverted), saved on click;
  sets the window icon and rewrites the launcher's installed copy
- Android: Settings → Icon; two launcher activity-aliases, one enabled
This commit is contained in:
2026-11-06 17:20:56 -08:00
parent 94188a42c7
commit e1bceb06a3
14 changed files with 127 additions and 12 deletions
+15 -2
View File
@@ -35,12 +35,25 @@
android:name="me.teafry.voipmessages.MainActivity"
android:exported="true"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize|stateHidden">
android:windowSoftInputMode="adjustResize|stateHidden" />
<!-- The launcher entry, one per icon: Settings → Icon enables one and
disables the other (Icons.java). -->
<activity-alias android:name="me.teafry.voipmessages.LauncherDark"
android:targetActivity="me.teafry.voipmessages.MainActivity"
android:icon="@drawable/ic_launcher" android:exported="true" android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</activity-alias>
<activity-alias android:name="me.teafry.voipmessages.LauncherInverted"
android:targetActivity="me.teafry.voipmessages.MainActivity"
android:icon="@drawable/ic_launcher_inverted" android:exported="true" android:enabled="false">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity android:name="me.teafry.voipmessages.ChatActivity" android:exported="false"
android:windowSoftInputMode="adjustResize" />
<activity android:name="me.teafry.voipmessages.NewChatActivity" android:exported="false"
@@ -0,0 +1,34 @@
package me.teafry.voipmessages;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.PackageManager;
/**
* The launcher icon: the dark original or its negative (lighter), like the
* desktop's Settings → Appearance → Icon. Each is its own launcher entry
* (activity-alias); the choice is which one is enabled, so the launcher
* itself remembers it.
*/
final class Icons {
private Icons() {}
private static ComponentName dark(Context c) {
return new ComponentName(c, "me.teafry.voipmessages.LauncherDark");
}
private static ComponentName inverted(Context c) {
return new ComponentName(c, "me.teafry.voipmessages.LauncherInverted");
}
static boolean isInverted(Context c) {
return c.getPackageManager().getComponentEnabledSetting(inverted(c)) == PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
}
static void setInverted(Context c, boolean on) {
PackageManager pm = c.getPackageManager();
// The new entry first, so there's never a moment with no icon at all.
pm.setComponentEnabledSetting(on ? inverted(c) : dark(c), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
pm.setComponentEnabledSetting(on ? dark(c) : inverted(c), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
}
}
@@ -81,6 +81,18 @@ public final class SettingsActivity extends BaseActivity {
notify.setOnCheckedChangeListener((v, on) -> Config.prefs(c).edit().putBoolean("notifications", on).apply());
box.addView(notify);
section("Icon");
boolean inv = Icons.isInverted(c);
row("Launcher icon", inv ? "Inverted (lighter)" : "Dark", v -> {
new AlertDialog.Builder(c).setTitle("Launcher icon")
.setSingleChoiceItems(new String[] {"Dark", "Inverted (lighter)"}, inv ? 1 : 0, (d, i) -> {
if ((i == 1) != inv) Icons.setInverted(c, i == 1);
d.dismiss();
changed();
}).show();
});
note("The home screen can take a few seconds to show the new one.");
section("Accounts");
Config cfg = Config.get(c);
kv("voip.ms", cfg.voipUser == null ? "Not set up" : Sync.voipError != null ? "⚠ " + Sync.voipError : cfg.voipUser);
Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

+2 -2
View File
@@ -26,8 +26,8 @@ import sys
import zipfile
from pathlib import Path
VERSION_NAME = "0.3.0"
VERSION_CODE = 3
VERSION_NAME = "0.4.0"
VERSION_CODE = 4
PACKAGE = "me.teafry.voipmessages"
DEV_PACKAGE = PACKAGE + ".dev"
+2 -1
View File
@@ -1,7 +1,7 @@
{
"name": "voipms-desktop",
"productName": "bubble",
"version": "0.3.0",
"version": "0.4.0",
"description": "Signal-style desktop SMS client for voip.ms",
"author": "trav <trav@teafry.me>",
"private": true,
@@ -52,6 +52,7 @@
"files": [
"out/**",
"resources/icon.png",
"resources/icon-inverted.png",
"package.json"
],
"extraResources": [
Binary file not shown.
+1 -1
View File
@@ -1 +1 @@
{"version_name": "0.3.0", "version_code": 3, "package": "me.teafry.voipmessages"}
{"version_name": "0.4.0", "version_code": 4, "package": "me.teafry.voipmessages"}
Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

+32 -2
View File
@@ -7,7 +7,7 @@ import path from 'node:path'
import os from 'node:os'
import { pathToFileURL } from 'node:url'
import { charCount, groupMembers, isGroup, normalizeNumber, SMS_TEXT_LIMIT } from '@shared/phone'
import type { ChatExport, Credentials, Did, MediaRef, Message, NewContact, OutgoingAttachment, Provider, Settings, SyncStatus, Theme } from '@shared/types'
import type { ChatExport, IconStyle, Credentials, Did, MediaRef, Message, NewContact, OutgoingAttachment, Provider, Settings, SyncStatus, Theme } from '@shared/types'
import type { AppState } from '@shared/api'
import { addToAddressBook, ContactDirectory, listAddressBooks } from './contacts'
import { localDay, MessageDb, type NewMessage } from './db'
@@ -275,6 +275,30 @@ async function readMedia(id: number, index: number): Promise<{ mime: string; dat
return { mime: ref.mime ?? guessMime(ref.file) ?? 'application/octet-stream', data: new Uint8Array(fs.readFileSync(media.filePath(ref.file))) }
}
// ---- icon: the dark original or its negative (Settings → Appearance) ----
const iconFile = (style: IconStyle | undefined): string =>
path.join(__dirname, '../../resources', style === 'inverted' ? 'icon-inverted.png' : 'icon.png')
// The window's icon, and the launcher's (the copy scripts/install-desktop.sh
// put in ~/.local/share/icons), so the dash and Alt+Tab match too.
function applyIcon(): void {
const file = iconFile(settings.icon)
win?.setIcon(file)
if (SANDBOX || !app.isPackaged) return
const installed = path.join(os.homedir(), '.local/share/icons/hicolor/512x512/apps/voipms-desktop.png')
try {
if (!fs.existsSync(installed)) return
const want = fs.readFileSync(file)
if (Buffer.compare(want, fs.readFileSync(installed)) === 0) return
fs.writeFileSync(installed, want)
// GNOME caches icons by name: nudge it to look again.
const now = new Date()
fs.utimesSync(path.join(os.homedir(), '.local/share/icons/hicolor'), now, now)
} catch (e) {
console.warn('[icon] could not update the launcher icon:', (e as Error).message)
}
}
// ---- theme + zoom ----
function applyTheme(): void {
nativeTheme.themeSource = settings.theme
@@ -476,6 +500,11 @@ function registerIpc(): void {
gvSync?.resetBackfill()
}
})
ipcMain.handle('setIcon', (_e, icon: IconStyle) => {
settings = { ...settings, icon }
saveSettings(settings)
applyIcon()
})
// Theme takes effect (and is saved) immediately, without the dialog's Save.
ipcMain.handle('setTheme', (_e, theme: Theme) => {
settings = { ...settings, theme }
@@ -596,7 +625,7 @@ function createWindow(): void {
title: SANDBOX ? 'bubble (sandbox)' : 'bubble',
backgroundColor: windowBackground(),
autoHideMenuBar: true,
icon: path.join(__dirname, '../../resources/icon.png'),
icon: iconFile(settings.icon),
webPreferences: {
preload: path.join(__dirname, '../preload/index.js'),
contextIsolation: true,
@@ -662,6 +691,7 @@ app.whenReady().then(async () => {
protocol.handle('mms-media', serveMedia)
registerIpc()
createWindow()
applyIcon()
// The sandbox stays away from the real address book.
if (!SANDBOX) void contacts.load()
+1
View File
@@ -13,6 +13,7 @@ const api: Api = {
saveSetup: (creds, settings) => ipcRenderer.invoke('saveSetup', creds, settings),
updateSettings: (settings) => ipcRenderer.invoke('updateSettings', settings),
setTheme: (theme) => ipcRenderer.invoke('setTheme', theme),
setIcon: (icon) => ipcRenderer.invoke('setIcon', icon),
signOut: () => ipcRenderer.invoke('signOut'),
connectGoogleVoice: () => ipcRenderer.invoke('connectGoogleVoice'),
connectGoogleVoiceCookies: (text) => ipcRenderer.invoke('connectGoogleVoiceCookies', text),
+23 -3
View File
@@ -1,7 +1,7 @@
import { useEffect, useState } from 'react'
import type { AppState, RabbitStatus } from '@shared/api'
import { formatNumber } from '@shared/phone'
import type { AddressBook, GvStatus, Settings, SyncStatus, Theme } from '@shared/types'
import type { AddressBook, GvStatus, IconStyle, Settings, SyncStatus, Theme } from '@shared/types'
import { CloseIcon } from './Icons'
interface Props {
@@ -16,8 +16,9 @@ export function SettingsDialog({ state, sync, onClose, onChanged }: Props) {
const [note, setNote] = useState<string>()
// voip.ms numbers; Google Voice has its own section.
const smsDids = state.dids.filter((d) => d.smsEnabled && d.provider !== 'gvoice')
// Theme is saved on click, so it never makes the dialog dirty.
const dirty = JSON.stringify({ ...s, theme: undefined }) !== JSON.stringify({ ...state.settings, theme: undefined })
// Theme and icon are saved on click, so they never make the dialog dirty.
const clicked = { theme: undefined, icon: undefined }
const dirty = JSON.stringify({ ...s, ...clicked }) !== JSON.stringify({ ...state.settings, ...clicked })
useEffect(() => {
const onKey = (e: KeyboardEvent): void => {
@@ -67,6 +68,25 @@ export function SettingsDialog({ state, sync, onClose, onChanged }: Props) {
))}
</div>
</div>
<div className="field">
Icon
<div className="segmented" role="radiogroup" aria-label="Icon">
{(['dark', 'inverted'] as IconStyle[]).map((t) => (
<button
key={t}
role="radio"
aria-checked={(s.icon ?? 'dark') === t}
className={(s.icon ?? 'dark') === t ? 'on' : ''}
onClick={() => {
setS({ ...s, icon: t })
void window.api.setIcon(t).then(onChanged)
}}
>
{t === 'dark' ? 'Dark' : 'Inverted'}
</button>
))}
</div>
</div>
<label className="field">
Show new messages in the notification list
<input type="checkbox" checked={s.notifications} onChange={(e) => setS({ ...s, notifications: e.target.checked })} />
+2 -1
View File
@@ -1,5 +1,5 @@
// The typed bridge exposed to the renderer as window.api.
import type { AddressBook, ChatExport, ContactInfo, NewContact, Conversation, Credentials, Did, Message, OutgoingAttachment, SearchHit, Settings, SyncStatus, Theme } from './types'
import type { IconStyle, AddressBook, ChatExport, ContactInfo, NewContact, Conversation, Credentials, Did, Message, OutgoingAttachment, SearchHit, Settings, SyncStatus, Theme } from './types'
export interface AppState {
configured: boolean
@@ -23,6 +23,7 @@ export interface Api {
saveSetup(creds: Credentials, settings: Settings): Promise<void>
updateSettings(settings: Settings): Promise<void>
setTheme(theme: Theme): Promise<void>
setIcon(icon: IconStyle): Promise<void>
signOut(): Promise<void>
connectGoogleVoice(): Promise<void>
connectGoogleVoiceCookies(text: string): Promise<void>
+3
View File
@@ -4,6 +4,8 @@ export type Direction = 'in' | 'out'
export type MessageStatus = 'delivered' | 'pending' | 'failed'
export type MessageKind = 'sms' | 'mms'
export type Theme = 'system' | 'light' | 'dark'
// The app icon: the original dark photo, or its negative (lighter).
export type IconStyle = 'dark' | 'inverted'
// One MMS attachment. `url` is where voip.ms serves it; `file` is our cached
// copy (a name inside <dataDir>/media), filled in once downloaded or sent.
@@ -127,6 +129,7 @@ export interface Settings {
defaultDid?: string
backfillFloor: string // YYYY-MM-DD, stop backfill here
theme: Theme
icon?: IconStyle // absent = dark
notifications: boolean // new messages go to the notification list
contactBook?: string // where "Add to contacts" puts them; default: GNOME Contacts' default
}