2021-04-25 18:52:43 +03:00
|
|
|
# `window:toast_notification(title, message, [url, [timeout_milliseconds]])`
|
2021-04-12 08:01:06 +03:00
|
|
|
|
2023-03-21 08:01:24 +03:00
|
|
|
{{since('20210502-154244-3f7122cb')}}
|
2021-04-12 08:01:06 +03:00
|
|
|
|
|
|
|
Generates a desktop "toast notification" with the specified *title* and *message*.
|
|
|
|
|
|
|
|
An optional *url* parameter can be provided; clicking on the notification will
|
|
|
|
open that URL.
|
|
|
|
|
2021-04-25 18:52:43 +03:00
|
|
|
An optional *timeout* parameter can be provided; if so, it specifies how long
|
|
|
|
the notification will remain prominently displayed in milliseconds. To specify
|
|
|
|
a timeout without specifying a url, set the url parameter to `nil`. The timeout
|
|
|
|
you specify may not be respected by the system, particularly in X11/Wayland
|
2022-01-06 22:30:30 +03:00
|
|
|
environments, and Windows will always use a fixed, unspecified, duration.
|
2021-04-25 18:52:43 +03:00
|
|
|
|
|
|
|
The notification will persist on screen until dismissed or clicked, or until its
|
|
|
|
timeout duration elapses.
|
2021-04-12 08:01:06 +03:00
|
|
|
|
|
|
|
This example will display a notification whenever a window has its configuration
|
2021-04-25 18:52:43 +03:00
|
|
|
reloaded. The notification should remain on-screen for approximately 4 seconds
|
|
|
|
(4000 milliseconds), but may remain longer depending on the system.
|
|
|
|
|
|
|
|
It's not an ideal implementation because there may be multiple windows and thus
|
|
|
|
multiple notifications:
|
2021-04-12 08:01:06 +03:00
|
|
|
|
|
|
|
```lua
|
|
|
|
local wezterm = require 'wezterm'
|
|
|
|
|
2022-07-19 17:54:31 +03:00
|
|
|
wezterm.on('window-config-reloaded', function(window, pane)
|
|
|
|
window:toast_notification('wezterm', 'configuration reloaded!', nil, 4000)
|
2021-04-12 08:01:06 +03:00
|
|
|
end)
|
|
|
|
|
|
|
|
return {}
|
|
|
|
```
|