wails icon indicating copy to clipboard operation
wails copied to clipboard

[V3] App icon badge

Open popaprozac opened this issue 9 months ago • 1 comments
trafficstars

Is your feature request related to a problem? Please describe.

Tauri and Electron allow setting a badge on the app icon.

Tauri https://tauri.app/reference/javascript/api/namespacewindow/#setbadgecount https://tauri.app/reference/javascript/api/namespacewindow/#setbadgelabel

Electron https://www.electronjs.org/docs/latest/api/dock#docksetbadgetext-macos

Describe the solution you'd like

Expose an app.SetBadge(value string) method or similar to set an app badge on the dock icon.

Describe alternatives you've considered

Import and use DarwinKit

Example of my current usage (badgeservice_darwin.go):

package main

import "github.com/progrium/darwinkit/macos/appkit"

type BadgeService struct{}

func (g *BadgeService) SetBadge(value string) {
	app := appkit.Application_SharedApplication()
	dockTile := app.DockTile()

	if value == "" {
		dockTile.SetBadgeLabel("")
	} else {
		dockTile.SetBadgeLabel(value)
	}
}

Additional context

I am currently focused on macOS development so I haven't looked at Windows/Linux solutions yet (researching). Relying on DarwinKit for this increases the app size to >35MB build and >25MB app.

popaprozac avatar Jan 30 '25 01:01 popaprozac