Commit Graph
2641 Commits
Author SHA1 Message Date
Wez Furlong 9397f2a2db wezterm: allow overriding the default open-uri event
This builds on the new lua event handler plumbing added
in ccea650a93 to co-opt
the default URI opening action:

```lua
wezterm.on("open-uri", function(uri)
  if uri:find("jira") then
    wezterm.log_error("do something with jira")
    wezterm.run_child_process({
      "wezterm",
      "start",
      "--",
      "jira",
      "view",
      extract_task_from_uri(uri)
    })
    -- prevent the default action from opening in a browser
    return false
  else
    -- log but allow the uri to be opened in the browser
    wezterm.log_error("clicken " .. uri)
  end
end)
```

This doesn't allow exactly the sketched out option from
issue #223 to be implemented, but may be close enough
to be useful.

refs: #223
refs: #225
2020-10-07 18:26:16 -07:00
Wez Furlong 882f47f4ad wezterm.glob is now async capable 2020-10-07 09:00:37 -07:00
Wez Furlong 15b6a7c355 wezterm.read_dir is now async capable 2020-10-07 08:55:37 -07:00
Wez Furlong c7f95cac72 wezterm.run_child_process is now async capable 2020-10-07 08:51:54 -07:00
Wez Furlong ccea650a93 add wezterm.on(), wezterm.emit()
* `wezterm.on("event-name", func)`
* `wezterm.emit("event-name", "arg1", "arg2")`

`on` allows registering multiple functions.
`emit` will call each of the registered functions in turn, passing
a copy of the arguments.  If a handler returns false, no additional
handlers are called and `emit` will return false.  Otherwise,
once all the handlers have been called, `emit` will return true.

`emit` is capable of being called by async code.

These functions are available to the config layer, but nothing in
wezterm uses them at this time.

refs: #225
2020-10-07 08:42:06 -07:00
Wez Furlong 4acf1e3935 Upgrade mlua to 0.4, lua to 5.4 2020-10-06 18:34:29 -07:00
Wez Furlong 2d521e8f25 server/tab -> server/pane 2020-10-06 15:45:40 -07:00
Wez Furlong 24b290a5da localtab.rs -> localpane.rs 2020-10-06 13:42:51 -07:00
Wez Furlong ecdc321ab8 ci: update PKGBUILD.template for license file addition
refs: #290
2020-10-06 13:24:35 -07:00
Wez Furlong 461826c8e0 ci: moar freebsd 2020-10-06 09:53:45 -07:00
Wez Furlong 86fd1eb502 ci: tweak freebsd rustup a bit 2020-10-06 09:14:23 -07:00
Wez Furlong e6c9bcb7d8 ci: maybe have cirrus install rust via rustup
Its freebsd image appears to be stale, so try a more recent
version of rust to fix the build.
2020-10-06 08:48:54 -07:00
Wez Furlong 8d1af908bf fixup starting mux on windows
* Taught wezterm-mux-server how to `--daemonize` on windows
* Removed pty based command spawn used to spawn unix domain servers.
  This was present because it was the only way to successfully spawn
  wsl in the past.  What I'm finding today is that it doesn't work
  at all for me, generating an `0xc0000142` Application failed to
  initialize error.  A plain command builder spawn seems to work,
  so that's what we're going with.
* Ensure that we put `.exe` on executable name on windows, otherwise
  the spawn may fail.
* `Path::exists()` always returns false for unix domain sockets on
  Windows, so unconditionally try to remove the socket before binding,
  otherwise the bind will falsely fail, claiming that another process
  is already bound.

The docs for mux will need to be updated to show how to revise them
for the new mux server invocation:

```lua
  unix_domains = {
    {
      name = "wsl",
      serve_command = {"wsl", "wezterm-mux-server", "--daemonize"}
    },
  }
```
2020-10-05 20:29:47 -07:00
Wez Furlong a9a220f43c Fix build on freebsd CI
refs: https://github.com/stjepang/futures-lite/issues/28
2020-10-05 17:19:17 -07:00
Wez Furlong 1045652c67 really fix the windows build 2020-10-05 17:13:50 -07:00
Wez Furlong 0a546d7c12 and another speculative diff to fixup windows build 2020-10-05 13:56:11 -07:00
Wez Furlong 31c1b51316 maybe fixup windows build 2020-10-05 12:59:33 -07:00
Wez Furlong f497391958 gah, cargo fmt 2020-10-05 11:57:27 -07:00
Wez Furlong bf266a326d maybe fixup build for windows 2020-10-05 11:57:08 -07:00
Wez Furlong a0b3932e6d fixup build for macos 2020-10-05 09:11:17 -07:00
Wez Furlong e2e46cb50d remove stale install.sh 2020-10-05 08:52:42 -07:00
Wez Furlong aad493ab2a simplify promise crate
Implement Future and Promise in terms of a bounded channel of size 1.
2020-10-05 08:50:29 -07:00
Wez Furlong 5eb4d32004 upgrade misc deps, notably, async-task 2020-10-05 00:06:01 -07:00
Wez Furlong 3e2b86e15e fully remove daemonize crate 2020-10-04 23:08:50 -07:00
Wez Furlong 3de4851aed fixup tls mux sessions
This adopts smol more broadly, but not yet completely.
2020-10-04 21:47:12 -07:00
Wez Furlong 68ab42f17a remove daemonize option from the gui
This is a mux only option
2020-10-04 14:19:06 -07:00
Wez Furlong 19cea53e35 mux: upgrade rcgen
This version no longer generates invalid CA certificates and
allows TLS connections using the internal PKI to advance
further.  Still need to debug an early disconnect.
2020-10-04 10:05:31 -07:00
Wez Furlong 3dc5994fa8 mux: avoid ffi tricks when cloning ssl stream
This was causing a double free
2020-10-04 10:04:58 -07:00
Wez Furlong e8be716cb3 clean up mux server startup
kindof a lot going on in this commit, unintentionally:

* Need the lua context set to be moved into the config crate
  otherwise configs cannot be parsed by the server and we end
  up with the default configs
* Make the server use smol for async io
* Drop the use of the daemonize crate, which I had forked anyway.
  Just inline our own tighter daemonize module
* Improve daemon spawning synchronization, however, it still needs
  work for windows to avoid blocking forever where we don't do
  daemonizing.
2020-10-04 09:39:28 -07:00
Wez Furlong a4731fd5ab Use smol/async for the mux server unix sockets 2020-10-03 11:15:57 -07:00
Wez Furlong b996fede7f codec: add async read/write methods 2020-10-03 11:15:57 -07:00
Wez Furlong 34c545dbde simplify frontend/gui dispatching
Now that the mux is in its own crate, the paths in the gui side
can be a bit more shallow, and we can remove a trait.
2020-10-03 11:15:57 -07:00
Wez Furlong d40e502fab adjust packaging to include wezterm-mux-server 2020-10-03 11:15:57 -07:00
Wez Furlong e8bf3a22f5 remove dead is-front-end-a-gui helper 2020-10-03 11:15:57 -07:00
Wez Furlong 75dca6e972 move strip-ansi-escapes into its own crate 2020-10-03 11:15:57 -07:00
Wez Furlong faba4d9074 move gui into wezterm crate/binary 2020-10-03 11:15:57 -07:00
Wez Furlong 0c32963f1c Move server to its own wezterm-mux-server binary 2020-10-03 11:15:57 -07:00
Wez Furlong a07004302a move codec into is own crate 2020-10-03 11:15:57 -07:00
Wez Furlong 2af699fe79 move running_under_wsl to config crate 2020-10-03 11:15:57 -07:00
Wez Furlong b93cf5066d move Activity into mux crate 2020-10-03 11:15:57 -07:00
Wez Furlong 025732d00f Add MuxNotification::WindowCreated, use it to spawn gui window
Rather than having each call site add a window to the mux and then
call the front end to spawn a window, make the mux emit a signal
advising of a window spawn, and have the front end subscribe to
that signal.
2020-10-03 11:15:57 -07:00
Wez Furlong a511abb1c2 move mux to its own crate 2020-10-03 11:15:57 -07:00
Wez Furlong 9a48f7f536 move localtab into mux 2020-10-03 11:15:57 -07:00
Wez Furlong 5fc1227fb9 move ratelim to its own crate 2020-10-03 11:15:57 -07:00
Wez Furlong 6893adbc34 break dep from mux -> codec 2020-10-03 11:15:57 -07:00
Wez Furlong b94c4a11f8 mux: remove dep on clientsession/pollable_channel 2020-10-03 11:15:57 -07:00
Wez Furlong 99df89eaa1 fix cargo doctest warning 2020-10-03 11:15:57 -07:00
Wez Furlong ee6864c217 move config into its own crate 2020-10-03 11:15:57 -07:00
Wez Furlong 01445bf5b8 move font configuration enums to config module 2020-10-03 11:15:57 -07:00
Wez Furlong 35f6a3dd9d move FrontEndSelection to config module 2020-10-03 11:15:57 -07:00