Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v3] Notifications API #4098

Open
wants to merge 98 commits into
base: v3-alpha
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 87 commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
32839bd
initial notification impl
popaprozac Feb 20, 2025
274511c
update log message
popaprozac Feb 21, 2025
f694ad2
service and minor refactor
popaprozac Feb 22, 2025
cc524d7
update example
popaprozac Feb 22, 2025
87f15ce
refactor
popaprozac Feb 22, 2025
91f1704
cleanup
popaprozac Feb 22, 2025
01fa307
windows impl
popaprozac Feb 23, 2025
c7d54e2
remove app event
popaprozac Feb 23, 2025
7757eae
standalone example
popaprozac Feb 23, 2025
9f39577
add comments
popaprozac Feb 23, 2025
47a0977
add overwrite and remove notification category
popaprozac Feb 23, 2025
6d44068
save notification categories to registry
popaprozac Feb 23, 2025
ab9c460
quick fixes
popaprozac Feb 23, 2025
27e512d
add data option to basic notification
popaprozac Feb 23, 2025
f8647ff
update min macos version
popaprozac Feb 23, 2025
c1230d4
update win impl to match
popaprozac Feb 23, 2025
9eab58f
update comments
popaprozac Feb 23, 2025
cc760a1
test data with toast
popaprozac Feb 23, 2025
978a982
don't add title or body quite yet
popaprozac Feb 23, 2025
bf4222c
update example
popaprozac Feb 24, 2025
c904433
update example
popaprozac Feb 24, 2025
983c25f
rw safety
popaprozac Feb 24, 2025
1e3511c
fix deadlock
popaprozac Feb 24, 2025
3dbf058
update comments
popaprozac Feb 24, 2025
be716fc
fix input id
popaprozac Feb 25, 2025
8da9981
for review
popaprozac Feb 25, 2025
e8ad42a
switch to callback style
popaprozac Feb 25, 2025
8bbe381
Merge branch 'v3-alpha' into notifications_darwin
popaprozac Feb 25, 2025
67adc45
update example
popaprozac Feb 25, 2025
253f672
init linux
popaprozac Feb 25, 2025
135defc
init test linux
popaprozac Feb 25, 2025
7bbc275
fix windows
popaprozac Feb 25, 2025
fa498f1
encode user data on windows
popaprozac Feb 25, 2025
050e4ef
fix default complex action
popaprozac Feb 25, 2025
60c1a86
update example
popaprozac Feb 25, 2025
10ae1f6
export config from app
popaprozac Feb 25, 2025
a4c4ab6
add id to macOS payload
popaprozac Feb 25, 2025
acad85e
update example
popaprozac Feb 25, 2025
60ae0c1
test linux userInfo
popaprozac Feb 26, 2025
47e5b10
add debug
popaprozac Feb 26, 2025
5ad3d73
wrangle variants
popaprozac Feb 26, 2025
e86cf68
linux?
popaprozac Feb 26, 2025
db2cab7
grab icon from app for notifications on windows
popaprozac Feb 26, 2025
e216b3e
set icon
popaprozac Feb 26, 2025
207b162
Merge branch 'notifications_darwin' of github.com:popaprozac/wails in…
popaprozac Feb 26, 2025
3bdb3dd
use app icon
popaprozac Feb 26, 2025
a807c26
better interop with obj-c
popaprozac Feb 27, 2025
ad74972
can you tell i'm not a go programmer?
popaprozac Feb 27, 2025
d9af6de
ignore bindings notification callback
popaprozac Mar 3, 2025
833d8ec
refactor macos
popaprozac Mar 5, 2025
e4ec06a
update example
Mar 14, 2025
1e67e94
rename auth func
popaprozac Mar 15, 2025
1fa6894
//
popaprozac Mar 15, 2025
e46abdc
update example
popaprozac Mar 15, 2025
2cb0dac
set default action id on MATE
popaprozac Mar 15, 2025
6d15f08
Merge branch 'v3-alpha' into notifications_darwin
popaprozac Mar 15, 2025
e810d6a
tidy
popaprozac Mar 15, 2025
e4e24a0
clean
popaprozac Mar 19, 2025
b60ef77
coderabbit impr
popaprozac Mar 19, 2025
ee885fe
fix mem crash
popaprozac Mar 19, 2025
4af058b
more cleanup
popaprozac Mar 20, 2025
58b5c10
Merge branch 'v3-alpha' into notifications_darwin
popaprozac Mar 20, 2025
25256f7
allow only one notification service per app
popaprozac Mar 20, 2025
d98f528
Merge branch 'notifications_darwin' of github.com:popaprozac/wails in…
popaprozac Mar 20, 2025
bd85738
fix err message
popaprozac Mar 20, 2025
c58709c
lock registry access/writes
popaprozac Mar 20, 2025
b1db2bb
add missing error
popaprozac Mar 20, 2025
88f1336
reorg platform impl
popaprozac Mar 20, 2025
94f245f
bug fix
popaprozac Mar 20, 2025
e55bf8d
linux bug fix
popaprozac Mar 20, 2025
9adeef2
fix linux and remove dup code
popaprozac Mar 20, 2025
5dc7bd9
refactor/simplify linux
popaprozac Mar 20, 2025
be1da68
avoid deadlock on win
popaprozac Mar 21, 2025
ef3b7d2
pass service options
popaprozac Mar 22, 2025
81b40d2
ensure exactly one delegate created
popaprozac Mar 22, 2025
f6a5bed
windows err handling
popaprozac Mar 22, 2025
b2b8f14
windows err handling
popaprozac Mar 22, 2025
f870dcc
handle notif content errors
popaprozac Mar 23, 2025
9948cee
monitor dbus connection
popaprozac Mar 23, 2025
ace4f70
fix channel cleanup linux
popaprozac Mar 23, 2025
448c78b
rewrite and simplify linux impl
popaprozac Mar 23, 2025
5ddb27f
move chan creation on macos and handle linux shutdown
popaprozac Mar 23, 2025
a683918
remove deadlock
popaprozac Mar 23, 2025
9a45423
follow dbus spec
popaprozac Mar 24, 2025
7f496c9
fix linux note
popaprozac Mar 24, 2025
1f82166
ensure cat id is set for macOS and other rabbit suggestions
popaprozac Mar 24, 2025
b102279
update example
popaprozac Mar 24, 2025
d25f923
wait on dbus
popaprozac Mar 25, 2025
276c653
update example
popaprozac Mar 25, 2025
7d0f7f4
revert linux wait and update payload on win
popaprozac Mar 25, 2025
af5abda
update example
popaprozac Mar 25, 2025
1db65a8
stage docs
popaprozac Mar 27, 2025
743882a
update docs/changelog
popaprozac Mar 27, 2025
1022f47
fix docs
popaprozac Mar 27, 2025
bd5c82e
fix docs
popaprozac Mar 27, 2025
b313f2c
fix docs
popaprozac Mar 27, 2025
9a41b0c
move icon method, impl interface, check compat, don't panic!
popaprozac Mar 30, 2025
75dbe85
remove comptime check
popaprozac Mar 30, 2025
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
59 changes: 59 additions & 0 deletions v3/examples/notifications/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Welcome to Your New Wails3 Project!

Congratulations on generating your Wails3 application! This README will guide you through the next steps to get your project up and running.

## Getting Started

1. Navigate to your project directory in the terminal.

2. To run your application in development mode, use the following command:

```
wails3 dev
```

This will start your application and enable hot-reloading for both frontend and backend changes.

3. To build your application for production, use:

```
wails3 build
```

This will create a production-ready executable in the `build` directory.

## Exploring Wails3 Features

Now that you have your project set up, it's time to explore the features that Wails3 offers:

1. **Check out the examples**: The best way to learn is by example. Visit the `examples` directory in the `v3/examples` directory to see various sample applications.

2. **Run an example**: To run any of the examples, navigate to the example's directory and use:

```
go run .
```

Note: Some examples may be under development during the alpha phase.

3. **Explore the documentation**: Visit the [Wails3 documentation](https://v3.wails.io/) for in-depth guides and API references.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Double-check documentation URL.

The URL points to the Wails3 documentation which is still in development. Verify that this URL will be valid when the PR is merged.


🌐 Web query:

Is https://v3.wails.io/ a valid and accessible URL for Wails v3 documentation?

💡 Result:

The URL https://v3.wails.io/ does not appear to be valid or referenced in the official Wails v3 documentation. Based on search results, the correct URL for Wails v3 documentation is https://v3alpha.wails.io/, which is actively maintained and referenced in multiple guides and release notes[1][4][7][10][13].

This distinction is important because:

  • All Wails v3 documentation links explicitly use the v3alpha subdomain[1][4][7]
  • The v3alpha prefix reflects the alpha status of the current v3 release[1][6]
  • Official GitHub issues and CLI references specifically use v3alpha URLs[16][17]
  • The main Wails website (wails.io) still references v2 documentation as the primary stable version[5][11]

For developers working with Wails v3, the valid documentation URL is https://v3alpha.wails.io/. This aligns with the project's current pre-release status and matches all official references in March 2025 documentation[1][4][13].

Citations:


Update Documentation URL

The documentation link in v3/examples/notifications/README.md (line 39) currently points to https://v3.wails.io/, which is not valid for Wails v3. Please update it to https://v3alpha.wails.io/ to align with the official, maintained documentation references.


4. **Join the community**: Have questions or want to share your progress? Join the [Wails Discord](https://discord.gg/JDdSxwjhGf) or visit the [Wails discussions on GitHub](https://github.com/wailsapp/wails/discussions).

## Project Structure

Take a moment to familiarize yourself with your project structure:

- `frontend/`: Contains your frontend code (HTML, CSS, JavaScript/TypeScript)
- `main.go`: The entry point of your Go backend
- `app.go`: Define your application structure and methods here
- `wails.json`: Configuration file for your Wails project

## Next Steps

1. Modify the frontend in the `frontend/` directory to create your desired UI.
2. Add backend functionality in `main.go`.
3. Use `wails3 dev` to see your changes in real-time.
4. When ready, build your application with `wails3 build`.

Happy coding with Wails3! If you encounter any issues or have questions, don't hesitate to consult the documentation or reach out to the Wails community.
34 changes: 34 additions & 0 deletions v3/examples/notifications/Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: '3'

includes:
common: ./build/Taskfile.yml
windows: ./build/windows/Taskfile.yml
darwin: ./build/darwin/Taskfile.yml
linux: ./build/linux/Taskfile.yml

vars:
APP_NAME: "Notifications\\ Demo"
BIN_DIR: "bin"
VITE_PORT: '{{.WAILS_VITE_PORT | default 9245}}'

tasks:
build:
summary: Builds the application
cmds:
- task: "{{OS}}:build"

package:
summary: Packages a production build of the application
cmds:
- task: "{{OS}}:package"

run:
summary: Runs the application
cmds:
- task: "{{OS}}:run"

dev:
summary: Runs the application in development mode
cmds:
- wails3 dev -config ./build/config.yml -port {{.VITE_PORT}}

86 changes: 86 additions & 0 deletions v3/examples/notifications/build/Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
version: '3'

tasks:
go:mod:tidy:
summary: Runs `go mod tidy`
internal: true
cmds:
- go mod tidy

install:frontend:deps:
summary: Install frontend dependencies
dir: frontend
sources:
- package.json
- package-lock.json
generates:
- node_modules/*
preconditions:
- sh: npm version
msg: "Looks like npm isn't installed. Npm is part of the Node installer: https://nodejs.org/en/download/"
cmds:
- npm install

build:frontend:
label: build:frontend (PRODUCTION={{.PRODUCTION}})
summary: Build the frontend project
dir: frontend
sources:
- "**/*"
generates:
- dist/**/*
deps:
- task: install:frontend:deps
- task: generate:bindings
vars:
BUILD_FLAGS:
ref: .BUILD_FLAGS
cmds:
- npm run {{.BUILD_COMMAND}} -q
env:
PRODUCTION: '{{.PRODUCTION | default "false"}}'
vars:
BUILD_COMMAND: '{{if eq .PRODUCTION "true"}}build{{else}}build:dev{{end}}'


generate:bindings:
label: generate:bindings (BUILD_FLAGS={{.BUILD_FLAGS}})
summary: Generates bindings for the frontend
deps:
- task: go:mod:tidy
sources:
- "**/*.[jt]s"
- exclude: frontend/**/*
- frontend/bindings/**/* # Rerun when switching between dev/production mode causes changes in output
- "**/*.go"
- go.mod
- go.sum
generates:
- frontend/bindings/**/*
cmds:
- wails3 generate bindings -f '{{.BUILD_FLAGS}}' -clean=true -ts

generate:icons:
summary: Generates Windows `.ico` and Mac `.icns` files from an image
dir: build
sources:
- "appicon.png"
generates:
- "darwin/icons.icns"
- "windows/icon.ico"
cmds:
- wails3 generate icons -input appicon.png -macfilename darwin/icons.icns -windowsfilename windows/icon.ico

dev:frontend:
summary: Runs the frontend in development mode
dir: frontend
deps:
- task: install:frontend:deps
cmds:
- npm run dev -- --port {{.VITE_PORT}} --strictPort

update:build-assets:
summary: Updates the build assets
dir: build
cmds:
- wails3 update build-assets -name "{{.APP_NAME}}" -binaryname "{{.APP_NAME}}" -config config.yml -dir .
Binary file added v3/examples/notifications/build/appicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
62 changes: 62 additions & 0 deletions v3/examples/notifications/build/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# This file contains the configuration for this project.
# When you update `info` or `fileAssociations`, run `wails3 task common:update:build-assets` to update the assets.
# Note that this will overwrite any changes you have made to the assets.
version: '3'

# This information is used to generate the build assets.
info:
companyName: "My Company" # The name of the company
productName: "My Product" # The name of the application
productIdentifier: "com.mycompany.myproduct" # The unique product identifier
description: "A program that does X" # The application description
copyright: "(c) 2025, My Company" # Copyright text
comments: "Some Product Comments" # Comments
version: "v0.0.1" # The application version

# Dev mode configuration
dev_mode:
root_path: .
log_level: warn
debounce: 1000
ignore:
dir:
- .git
- node_modules
- frontend
- bin
file:
- .DS_Store
- .gitignore
- .gitkeep
watched_extension:
- "*.go"
git_ignore: true
executes:
- cmd: wails3 task common:install:frontend:deps
type: once
- cmd: wails3 task common:dev:frontend
type: background
- cmd: go mod tidy
type: blocking
- cmd: wails3 task build
type: blocking
- cmd: wails3 task run
type: primary

# File Associations
# More information at: https://v3.wails.io/noit/done/yet
fileAssociations:
# - ext: wails
# name: Wails
# description: Wails Application File
# iconName: wailsFileIcon
# role: Editor
# - ext: jpg
# name: JPEG
# description: Image File
# iconName: jpegFileIcon
# role: Editor

# Other data
other:
- name: My Other Data
32 changes: 32 additions & 0 deletions v3/examples/notifications/build/darwin/Info.dev.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleName</key>
<string>My Product</string>
<key>CFBundleExecutable</key>
<string>Notifications Demo</string>
<key>CFBundleIdentifier</key>
<string>com.wails.notifications-demo</string>
<key>CFBundleVersion</key>
<string>0.1.0</string>
<key>CFBundleGetInfoString</key>
<string>This is a comment</string>
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<key>CFBundleIconFile</key>
<string>icons</string>
<key>LSMinimumSystemVersion</key>
<string>10.15.0</string>
<key>NSHighResolutionCapable</key>
<string>true</string>
<key>NSHumanReadableCopyright</key>
<string>© now, My Company</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsLocalNetworking</key>
<true/>
</dict>
</dict>
</plist>
27 changes: 27 additions & 0 deletions v3/examples/notifications/build/darwin/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleName</key>
<string>My Product</string>
<key>CFBundleExecutable</key>
<string>Notifications Demo</string>
<key>CFBundleIdentifier</key>
<string>com.wails.notifications-demo</string>
<key>CFBundleVersion</key>
<string>0.1.0</string>
<key>CFBundleGetInfoString</key>
<string>This is a comment</string>
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<key>CFBundleIconFile</key>
<string>icons</string>
<key>LSMinimumSystemVersion</key>
<string>10.15.0</string>
<key>NSHighResolutionCapable</key>
<string>true</string>
<key>NSHumanReadableCopyright</key>
<string>© now, My Company</string>
</dict>
</plist>
80 changes: 80 additions & 0 deletions v3/examples/notifications/build/darwin/Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
version: '3'

includes:
common: ../Taskfile.yml

tasks:
build:
summary: Creates a production build of the application
deps:
- task: common:go:mod:tidy
- task: common:build:frontend
vars:
BUILD_FLAGS:
ref: .BUILD_FLAGS
PRODUCTION:
ref: .PRODUCTION
- task: common:generate:icons
cmds:
- go build {{.BUILD_FLAGS}} -o {{.OUTPUT}}
vars:
BUILD_FLAGS: '{{if eq .PRODUCTION "true"}}-tags production -trimpath -buildvcs=false -ldflags="-w -s"{{else}}-buildvcs=false -gcflags=all="-l"{{end}}'
DEFAULT_OUTPUT: '{{.BIN_DIR}}/{{.APP_NAME}}'
OUTPUT: '{{ .OUTPUT | default .DEFAULT_OUTPUT }}'
env:
GOOS: darwin
CGO_ENABLED: 1
GOARCH: '{{.ARCH | default ARCH}}'
CGO_CFLAGS: "-mmacosx-version-min=10.15"
CGO_LDFLAGS: "-mmacosx-version-min=10.15"
MACOSX_DEPLOYMENT_TARGET: "10.15"
PRODUCTION: '{{.PRODUCTION | default "false"}}'
Comment on lines +25 to +31
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify macOS version compatibility with notifications API

There's a potential version mismatch. The PR objectives state that macOS 11.0 is the minimum required version for notifications, but the build settings target macOS 10.15.


🏁 Script executed:

#!/bin/bash
# Check if notifications API requires macOS 11.0 as stated in PR objectives

echo "Checking if UNNotification API requires macOS 11.0"
find . -type f -name "*.go" | xargs grep -l "UNNotification" | xargs grep -A 5 -B 5 "darwin"

Length of output: 6136


Action Required: Update macOS Deployment Target in Taskfile.yml

The build configuration in v3/examples/notifications/build/darwin/Taskfile.yml (lines 25–31) still specifies a macOS version of 10.15. However, the notifications implementation uses Cgo flags that require a minimum version of macOS 11.0 (e.g., -mmacosx-version-min=11.0 in the CFLAGS and LDFLAGS). Since the PR objectives indicate that macOS 11.0 is the minimum supported version for notifications, please update the build settings in this Taskfile accordingly or provide clarification if an alternative approach is intended.

  • Update the following settings:
    • CGO_CFLAGS from "-mmacosx-version-min=10.15" to at least "-mmacosx-version-min=11.0"
    • CGO_LDFLAGS from "-mmacosx-version-min=10.15" to at least "-mmacosx-version-min=11"


build:universal:
summary: Builds darwin universal binary (arm64 + amd64)
deps:
- task: build
vars:
ARCH: amd64
OUTPUT: "{{.BIN_DIR}}/{{.APP_NAME}}-amd64"
- task: build
vars:
ARCH: arm64
OUTPUT: "{{.BIN_DIR}}/{{.APP_NAME}}-arm64"
cmds:
- lipo -create -output "{{.BIN_DIR}}/{{.APP_NAME}}" "{{.BIN_DIR}}/{{.APP_NAME}}-amd64" "{{.BIN_DIR}}/{{.APP_NAME}}-arm64"
- rm "{{.BIN_DIR}}/{{.APP_NAME}}-amd64" "{{.BIN_DIR}}/{{.APP_NAME}}-arm64"

package:
summary: Packages a production build of the application into a `.app` bundle
deps:
- task: build
vars:
PRODUCTION: "true"
cmds:
- task: create:app:bundle

package:universal:
summary: Packages darwin universal binary (arm64 + amd64)
deps:
- task: build:universal
cmds:
- task: create:app:bundle


create:app:bundle:
summary: Creates an `.app` bundle
cmds:
- mkdir -p {{.BIN_DIR}}/{{.APP_NAME}}.app/Contents/{MacOS,Resources}
- cp build/darwin/icons.icns {{.BIN_DIR}}/{{.APP_NAME}}.app/Contents/Resources
- cp {{.BIN_DIR}}/{{.APP_NAME}} {{.BIN_DIR}}/{{.APP_NAME}}.app/Contents/MacOS
- cp build/darwin/Info.plist {{.BIN_DIR}}/{{.APP_NAME}}.app/Contents

run:
cmds:
- mkdir -p {{.BIN_DIR}}/dev/{{.APP_NAME}}.app/Contents/{MacOS,Resources}
- cp build/darwin/icons.icns {{.BIN_DIR}}/dev/{{.APP_NAME}}.app/Contents/Resources
- cp {{.BIN_DIR}}/{{.APP_NAME}} {{.BIN_DIR}}/dev/{{.APP_NAME}}.app/Contents/MacOS
- cp build/darwin/Info.dev.plist {{.BIN_DIR}}/dev/{{.APP_NAME}}.app/Contents/Info.plist
- codesign --force --deep --sign - {{.BIN_DIR}}/dev/{{.APP_NAME}}.app
- '{{.BIN_DIR}}/dev/{{.APP_NAME}}.app/Contents/MacOS/{{.APP_NAME}}'
Binary file not shown.
Loading