wails/v3/examples/badge-custom
Lea Anthony b2be682176
fix(v3): exclude node_modules from build:frontend sources glob (#4983)
* fix(v3): exclude node_modules from build:frontend sources glob

The `sources: "**/*"` glob in the build:frontend task causes go-task
to enumerate and checksum every file in node_modules during up-to-date
checking. With heavy dependencies (e.g. MUI), this means 50-100k+ files
are statted, causing 20-30 minute hangs especially on Windows/NTFS.

Fixes #4939

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs(v3): add changelog entry for #4939 fix

* chore: trigger CI re-run with fixed workflow

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 18:00:20 +11:00
..
build fix(v3): exclude node_modules from build:frontend sources glob (#4983) 2026-02-15 18:00:20 +11:00
frontend [v3] Typed Events, revisited (#4633) 2025-11-11 20:25:57 +11:00
main.go [v3] macOS Dock Service (#4451) 2025-09-24 07:30:02 +00:00
README.md add set custom badge and update docs/examples/readmes 2025-04-26 23:49:07 -07:00
Taskfile.yml Add badge options. Add new example. 2025-04-26 14:40:22 +10:00

Welcome to Your New Wails3 Project!

Now that you have your project set up, it's time to explore the custom badge features that Wails3 offers on Windows.

Exploring Custom Badge Features

Creating the Service with Custom Options (Windows Only)

On Windows, you can customize the badge appearance with various options:

import "github.com/wailsapp/wails/v3/pkg/application"
import "github.com/wailsapp/wails/v3/pkg/services/badge"
import "image/color"

// Create a badge service with custom options
options := badge.Options{
    TextColour:       color.RGBA{255, 255, 255, 255}, // White text
    BackgroundColour: color.RGBA{0, 0, 255, 255},     // Green background
    FontName:         "consolab.ttf",                 // Bold Consolas font
    FontSize:         20,                             // Font size for single character
    SmallFontSize:    14,                             // Font size for multiple characters
}

badgeService := badge.NewWithOptions(options)

// Register the service with the application
app := application.New(application.Options{
    Services: []application.Service{
        application.NewService(badgeService),
    },
})

Badge Operations

Setting a Badge

Set a badge on the application tile/dock icon with the global options applied:

Go

// Set a default badge
badgeService.SetBadge("")

// Set a numeric badge
badgeService.SetBadge("3")

// Set a text badge
badgeService.SetBadge("New")

JS

import {SetBadge} from "../bindings/github.com/wailsapp/wails/v3/pkg/services/badge/service";

// Set a default badge
SetBadge("")

// Set a numeric badge
SetBadge("3")

// Set a text badge
SetBadge("New")

Setting a Custom Badge

Set a badge on the application tile/dock icon with one-off options applied:

Go

// Set a default badge
badgeService.SetCustomBadge("")

// Set a numeric badge
badgeService.SetCustomBadge("3")

// Set a text badge
badgeService.SetCustomBadge("New")

JS

import {SetCustomBadge} from "../bindings/github.com/wailsapp/wails/v3/pkg/services/badge/service";

const options = {
   BackgroundColour: RGBA.createFrom({
         R: 0,
         G: 255,
         B: 255,
         A: 255,
      }),
      FontName: "arialb.ttf", // System font
      FontSize: 16,
      SmallFontSize: 10,
      TextColour: RGBA.createFrom({
         R: 0,
         G: 0,
         B: 0,
         A: 255,
      }),
}

// Set a default badge
SetCustomBadge("", options)

// Set a numeric badge
SetCustomBadge("3", options)

// Set a text badge
SetCustomBadge("New", options)

Removing a Badge

Remove the badge from the application icon:

Go

badgeService.RemoveBadge()

JS

import {RemoveBadge} from "../bindings/github.com/wailsapp/wails/v3/pkg/services/badge/service";

RemoveBadge()