Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/desktop/trayIcons/backgroundAppsSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Gio from '@girs/gio-2.0';
import GLib from '@girs/glib-2.0';
import Shell from '@girs/shell-18';

import type { TrayItem, TrayItemStatus } from './trayState.ts';
import { TRAY_ICON_FALLBACK_NAME, type TrayItem, type TrayItemStatus } from './trayState.ts';
import { logger } from '~/core/logger.ts';

const DBUS_NAME = 'org.freedesktop.background.Monitor';
Expand Down Expand Up @@ -126,7 +126,7 @@ export class BackgroundAppsSource {
return {
id: `bg:${appId}`,
get icon() {
return app.get_icon() || 'application-x-executable-symbolic';
return app.get_icon() || TRAY_ICON_FALLBACK_NAME;
},
get tooltip() {
return message || '';
Expand Down
4 changes: 2 additions & 2 deletions src/desktop/trayIcons/sniHost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import GLib from '@girs/glib-2.0';
import GdkPixbuf from '@girs/gdkpixbuf-2.0';
import St from '@girs/st-18';

import type { TrayItem, TrayItemStatus } from './trayState.ts';
import { TRAY_ICON_FALLBACK_NAME, type TrayItem, type TrayItemStatus } from './trayState.ts';
import type { SniWatcher } from './sniWatcher.ts';
import { sniIdentityMatchesAppId } from './appIdentity.ts';
import { isSymbolicSniArgb } from './sniIconState.ts';
Expand Down Expand Up @@ -231,7 +231,7 @@ export class SniHost {
}

logger.debug(`SNI icon ${itemId} reason=${reason} source=fallback`, { prefix: LOG_PREFIX });
return 'image-missing-symbolic';
return TRAY_ICON_FALLBACK_NAME;
}

refreshIcons(reason = 'theme-change'): void {
Expand Down
4 changes: 2 additions & 2 deletions src/desktop/trayIcons/trayIconItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import * as PopupMenu from '@girs/gnome-shell/ui/popupMenu';
import { PopupAnimation } from '@girs/gnome-shell/ui/boxpointer';
import { logger } from '~/core/logger.ts';

import type { TrayItem } from './trayState.ts';
import { TRAY_ICON_FALLBACK_NAME, type TrayItem } from './trayState.ts';
import { DBusMenuClient } from './dbusMenu.ts';

const BADGE_SIZE = 6;
Expand Down Expand Up @@ -108,7 +108,7 @@ export const TrayIconItem = GObject.registerClass(

this._iconWidget = new St.Icon({
icon_size: iconSize,
fallback_icon_name: 'image-missing-symbolic',
fallback_icon_name: TRAY_ICON_FALLBACK_NAME,
reactive: false,
});
box.add_child(this._iconWidget);
Expand Down
2 changes: 2 additions & 0 deletions src/desktop/trayIcons/trayState.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type Gio from '@girs/gio-2.0';
import type GdkPixbuf from '@girs/gdkpixbuf-2.0';

export const TRAY_ICON_FALLBACK_NAME = 'application-x-executable-symbolic';

export type TrayItemStatus = 'Passive' | 'Active' | 'NeedsAttention';

export type TrayMenuItem = { label: string; action: () => void };
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/desktop/trayIcons/trayState.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ import {
applyScroll,
addAttention,
clearAttention,
TRAY_ICON_FALLBACK_NAME,
} from '~/desktop/trayIcons/trayState.ts';
import type { TrayItem } from '~/desktop/trayIcons/trayState.ts';

test('Tray Icons use the generic executable icon as their shared fallback', () => {
assert.strictEqual(TRAY_ICON_FALLBACK_NAME, 'application-x-executable-symbolic');
});

test('createTrayState returns collapsed=true, offset=0, empty attention set', () => {
const state = createTrayState();
assert.strictEqual(state.collapsed, true);
Expand Down