diff --git a/packages/main/src/plugin/index.ts b/packages/main/src/plugin/index.ts index 459eeeabbd4cf..0de9dafdce31c 100644 --- a/packages/main/src/plugin/index.ts +++ b/packages/main/src/plugin/index.ts @@ -570,6 +570,7 @@ export class PluginSystem { true, 'update', undefined, + true, ); }); diff --git a/packages/main/src/plugin/statusbar/statusbar-item.ts b/packages/main/src/plugin/statusbar/statusbar-item.ts index faa8658b39bc3..d39d248e3851f 100644 --- a/packages/main/src/plugin/statusbar/statusbar-item.ts +++ b/packages/main/src/plugin/statusbar/statusbar-item.ts @@ -34,6 +34,7 @@ export class StatusBarItemImpl implements StatusBarItem { private isVisible = false; private _iconClass: string | { active: string; inactive: string } | undefined; private _enabled = true; + private _highlight = false; private _command: string | undefined; // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -48,6 +49,15 @@ export class StatusBarItemImpl implements StatusBarItem { this._id = StatusBarItemImpl.nextId(); } + public get highlight(): boolean { + return this._highlight; + } + + public set highlight(highlight: boolean) { + this._highlight = highlight; + this.update(); + } + public get alignment(): StatusBarAlignment { return this._alignment; } diff --git a/packages/main/src/plugin/statusbar/statusbar-registry.ts b/packages/main/src/plugin/statusbar/statusbar-registry.ts index 0733b62708729..0bb6f3c3d0ee0 100644 --- a/packages/main/src/plugin/statusbar/statusbar-registry.ts +++ b/packages/main/src/plugin/statusbar/statusbar-registry.ts @@ -30,6 +30,7 @@ export interface StatusBarEntry { command?: string; // eslint-disable-next-line @typescript-eslint/no-explicit-any commandArgs?: any[]; + highlight?: boolean; } export interface StatusBarEntryDescriptor { @@ -62,6 +63,7 @@ export class StatusBarRegistry implements IDisposable { command: string | undefined, // eslint-disable-next-line @typescript-eslint/no-explicit-any commandArgs: any[] | undefined, + highlight?: boolean, ) { const existingEntry = this.entries.get(entryId); if (existingEntry && (existingEntry.alignLeft !== alignLeft || existingEntry.priority !== priority)) { @@ -80,6 +82,7 @@ export class StatusBarRegistry implements IDisposable { enabled: enabled, command: command, commandArgs: commandArgs, + highlight: highlight, }; const entryDescriptor: StatusBarEntryDescriptor = { @@ -97,6 +100,7 @@ export class StatusBarRegistry implements IDisposable { entryToUpdate.enabled = enabled; entryToUpdate.command = command; entryToUpdate.commandArgs = commandArgs; + entryToUpdate.highlight = highlight; } this.apiSender.send(STATUS_BAR_UPDATED_EVENT_NAME, undefined); diff --git a/packages/renderer/src/lib/statusbar/StatusBarItem.spec.ts b/packages/renderer/src/lib/statusbar/StatusBarItem.spec.ts index bf74005aad3ad..ffd667bed49cf 100644 --- a/packages/renderer/src/lib/statusbar/StatusBarItem.spec.ts +++ b/packages/renderer/src/lib/statusbar/StatusBarItem.spec.ts @@ -19,6 +19,8 @@ import { test, expect } from 'vitest'; import type { StatusBarEntry } from '../../../../main/src/plugin/statusbar/statusbar-registry'; import { iconClass } from './StatusBarItem'; +import { render, screen } from '@testing-library/svelte'; +import StatusBarItem from './StatusBarItem.svelte'; test('check iconClass with font awesome icons', () => { const statusBarEntry: StatusBarEntry = { @@ -49,3 +51,29 @@ test('check iconClass with font awesome icons and spinning', () => { const icon = iconClass(statusBarEntry); expect(icon).toBe('fas fa-sync animate-spin'); }); + +test('expect dot not rendered', async () => { + const statusBarEntry: StatusBarEntry = { + enabled: true, + activeIconClass: '${podman}', + highlight: false, + }; + + render(StatusBarItem, { entry: statusBarEntry }); + + const dot = screen.queryByRole('status'); + expect(dot).toBeNull(); +}); + +test('expect dot rendered', () => { + const statusBarEntry: StatusBarEntry = { + enabled: true, + activeIconClass: '${podman}', + highlight: true, + }; + + render(StatusBarItem, { entry: statusBarEntry }); + + const dot = screen.getByRole('status'); + expect(dot).toBeDefined(); +}); diff --git a/packages/renderer/src/lib/statusbar/StatusBarItem.svelte b/packages/renderer/src/lib/statusbar/StatusBarItem.svelte index cb1a972049247..4f240a411257f 100644 --- a/packages/renderer/src/lib/statusbar/StatusBarItem.svelte +++ b/packages/renderer/src/lib/statusbar/StatusBarItem.svelte @@ -35,7 +35,7 @@ async function executeCommand(entry: StatusBarEntry) { on:click="{() => { executeCommand(entry); }}" - class="{opacity(entry)} px-1 flex items-center {hoverBackground(entry)} {hoverCursor(entry)}" + class="{opacity(entry)} px-1 flex items-center {hoverBackground(entry)} {hoverCursor(entry)} relative inline-block" title="{tooltipText(entry)}"> {#if iconClass(entry)} @@ -43,4 +43,7 @@ async function executeCommand(entry: StatusBarEntry) { {#if entry.text} {entry.text} {/if} + {#if entry.highlight} + + {/if}