Open keturiosakys opened 9 months ago
Note that you can very simply trigger a toast notification from your shell:
$ printf "\e]777;notify;%s;%s\e\\" "title" "body"
and you could make a shell alias for this to make it quick and easy to throw on the end of a shell pipeline.
I don't think this belongs in wezterm cli
which is a subcommand focused on speaking the wezterm mux protocol.
However, there is precedent for helper subcommands that make it convenient to emit escape sequences of this sort (eg: https://wezfurlong.org/wezterm/cli/set-working-directory.html) so it could be potentially added there.
Tried that. Does not seem to work on MacOS, does it ?
@xmailla yup it doenst work on MacOS (at least not on Sequoia 15.0)
Yes, it doesn't work on MacOS. I am on Sequoia 15.1 Beta. Any update on this?
This doesn't appear to work with Windows either.
Hey, guys I think I found a solution. I'm not sure if this is a workaround or actually the solution: Below is my wezterm config
-- Pull in the wezterm API
local wezterm = require("wezterm")
local act = wezterm.action
wezterm.on("window-config-reloaded", function(window, pane)
window:toast_notification("wezterm", "configuration reloaded!", nil, 4000)
end)
-- This will hold the default configuration
local config = wezterm.config_builder()
-- Set the font
config.font = wezterm.font("JetBrainsMono Nerd Font", { weight = "Bold", stretch = "Normal", style = "Normal" }) -- (AKA: JetBrainsMono NF)
config.font_size = 20.0
config.enable_tab_bar = false
config.window_decorations = "RESIZE"
config.window_background_opacity = 0.8
config.macos_window_background_blur = 10
config.color_scheme = "Catppuccin Mocha"
config.notification_handling = "AlwaysShow"
return config
So you can see the specific API for notification, so here I am notifiying it for when I reload the config. Below is a screenshot of the notification:
Here is the link to the documentation where I found out about this. Hope it helps.
P.S: I know that author is asking for the CLI, but since it is rust based, we can just build another rs file using the existing API and build a subcommand for the wezterm cli
command.
Hey, guys I think I found a solution. I'm not sure if this is a workaround or actually the solution: Below is my wezterm config
-- Pull in the wezterm API local wezterm = require("wezterm") local act = wezterm.action wezterm.on("window-config-reloaded", function(window, pane) window:toast_notification("wezterm", "configuration reloaded!", nil, 4000) end) -- This will hold the default configuration local config = wezterm.config_builder() -- Set the font config.font = wezterm.font("JetBrainsMono Nerd Font", { weight = "Bold", stretch = "Normal", style = "Normal" }) -- (AKA: JetBrainsMono NF) config.font_size = 20.0 config.enable_tab_bar = false config.window_decorations = "RESIZE" config.window_background_opacity = 0.8 config.macos_window_background_blur = 10 config.color_scheme = "Catppuccin Mocha" config.notification_handling = "AlwaysShow" return config
So you can see the specific API for notification, so here I am notifiying it for when I reload the config. Below is a screenshot of the notification:
Here is the link to the documentation where I found out about this. Hope it helps.
P.S: I know that author is asking for the CLI, but since it is rust based, we can just build another rs file using the existing API and build a subcommand for the
wezterm cli
command.
Thank you this made it work for me! ps: I had to turn on Notifications first as they were off by default and even then banners did not show up and stayed hidden in the notifications bar for some reason so I set all WezTerm notifications to alerts.
Is your feature request related to a problem? Please describe. Often times I'll run a longer-build in one tab and while it finishes switch to a different workspace (where a tab itself might not be visible). I would love to be notified after a command has been succesful or failed.
Describe the solution you'd like A stupid-simple
wezterm cli notify <STRING>
subcommand that sends a notification to my macOS notifications (or other OSes)Here's what my ideal workflow would look like:
Describe alternatives you've considered I am aware of
terminal-notifier
and other tools like such, however, since WezTerm already has an interface in Lua for sending toasties, figured it would be nice if CLI was able to adopt it natively as well.