1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-23 23:21:08 +03:00
Commit Graph

21 Commits

Author SHA1 Message Date
Wez Furlong
533e52c589 lua: make gui_window() reconcile workspace
reconciling causes gui windows to be created and allows for stuff like
this, that would otherwise fail because the gui window hadn't been
created yet.

```lua
local wezterm = require 'wezterm'

local mux = wezterm.mux

wezterm.on("gui-startup", function()
  local tab, pane, window = mux.spawn_window{}
  window:gui_window():set_inner_size(1200, 1200)
end)

return {
}
```
2022-07-06 18:52:14 -07:00
Wez Furlong
8f45cb8dfa lua: add MuxWindow::gui_window() method
This is the inverse of Window::mux_window().
2022-07-06 15:52:31 -07:00
Wez Furlong
f7848cf96d lua: reduce a bit of boilerplate around registering wezterm.submodule 2022-07-06 15:26:21 -07:00
Wez Furlong
6334e3bc44 rename wezterm.window to wezterm.gui
This better reflects what it operates on
2022-07-06 13:52:19 -07:00
Wez Furlong
5caa59577e lua: add screens.active 2022-07-06 13:17:31 -07:00
Wez Furlong
a6cf13e1e2 lua: add wezterm.window.screens()
Currently implemented on X11 only, this function returns information
about the geometry of the screen(s).

This is taken from the same source of information we use for the
`--position` CLI argument to `wezterm start`.

```
> wezterm.window.screens()
{
    "by_name": {
        "DisplayPort-1": {
            "height": 2160,
            "name": "DisplayPort-1",
            "width": 3840,
            "x": 0,
            "y": 0,
        },
    },
    "main": {
        "height": 2160,
        "name": "DisplayPort-1",
        "width": 3840,
        "x": 0,
        "y": 0,
    },
    "origin_x": 0,
    "origin_y": 0,
    "virtual_height": 2160,
    "virtual_width": 3840,
}
```
2022-07-06 08:35:05 -07:00
Wez Furlong
f1c53495e7 lua: add window:mux_window() and pane:mux_window() methods
These allow converting the gui versions of these objects
to the mux versions.

refs: https://github.com/wez/wezterm/issues/225
2022-06-27 20:28:26 -07:00
Wez Furlong
2e9fe87e34 lua: expand mux api
Allow iterating all windows at the mux layer.
windows allow iterating tabs.
Tabs allow iterating panes.

Versions of iteration that report additional information (like index,
active and positioning) are also added.

Panes can now reference their containing tab and window objects.
Tabs can now reference their containing window object.

refs: https://github.com/wez/wezterm/issues/1598 (sort of)
refs: https://github.com/wez/wezterm/issues/225
2022-06-27 13:19:03 -07:00
Wez Furlong
a282d07776 mux: add titles to mux window and tab objects
Previously, the mux layer had no internal understanding of titles other
than the Pane::get_title method to return state from a pane.

Users have asked for ways to explicitly set titles on windows and tabs,
so this commit is a step towards that.

The mux window and tab objects now store a title string.

The terminal layer now emits Alert::WindowTitleChanged when the window
title is changed via eg: OSC 0 or OSC 2.

The mux layer will respond to Alert::WindowTitleChanged by resolving the
window that corresponds to the source pane and amending its title.

The MuxWindow and MuxTab objects now provide accessor methods for the
title.

TabInformation (as used by format-tab-title and format-window-title) now
exposes the underlying window_id as well as tab_title and window_title.

The tab title can be changed via the lua MuxTab type, but there is not
currently an escape sequence associated with this.

The defaults for format-tab-title and format-window-title don't
currently consider these new title strings.

refs: https://github.com/wez/wezterm/issues/1598
2022-06-27 12:01:40 -07:00
Wez Furlong
5bcb0de442 lua: add wezterm.GLOBAL 2022-06-18 21:31:53 -07:00
Wez Furlong
fa02f6d5f0 cargo fmt 2022-06-18 07:17:16 -07:00
Wez Furlong
2aebf56c3e lua api: refine gui-startup example, add some more mux functions
The example now shows how to set up multiple workspaces

refs: #674
2022-06-18 07:14:07 -07:00
Wez Furlong
5fb60de62a lua: add MuxPane:send_text MuxPane:send_paste 2022-06-17 22:54:13 -07:00
Wez Furlong
00e5b9aae6 move wezterm.mux.split_pane(pane, {}) to pane:split{}
refs: #1949
refs: #674
2022-06-17 19:23:38 -07:00
Wez Furlong
4c03df884b docs: gui-startup, mux-startup and wezterm.mux
refs: #1949
refs: #674
2022-06-17 16:57:52 -07:00
Wez Furlong
824dc66610 lua mux: add window spawning and pane splitting
refs: #225
2022-06-17 11:56:57 -07:00
Wez Furlong
3170f9a13c lua mux: add a couple of window methods 2022-06-17 09:27:28 -07:00
Wez Furlong
e8bb0e03ee add wezterm.mux lua module
The intent is to expose Mux related functions to lua, so `wezterm.mux`
will be that module table.

In order to test this out in the debug overlay, I realized that the
overlay was running functions in a different thread and didn't have
access to the mux, so this commit also tweaks the debug overlay repl to
execute the input in the main thread.

The result is that it is now possible to do
`wezterm.mux.active_workspace()` in the debug overlay to print the
active workspace name.

More functions will follow.

refs: https://github.com/wez/wezterm/issues/225
2022-06-17 07:46:25 -07:00
Wez Furlong
75066cb522 deps: update
Main thing to note here is that the open crate has deprecated
open::that_in_background, but made open::that non-blocking.

I think this is OK, but I'm a little cagey about what will
happen with this on Windows.  We may need to spawn our own
thread for this if things go awry.
2022-06-12 20:17:48 -07:00
Wez Furlong
07128bd0de fixup win32 build 2022-05-19 09:23:32 -07:00
Wez Furlong
2f14d640e8 config: split out lua functions into their own crates
This shaves off some build time and allows more parallism in the build.
2022-05-19 06:48:09 -07:00