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

3267 Commits

Author SHA1 Message Date
Wez Furlong
fae9b35368 fixup macos build
refs: https://github.com/wez/wezterm/issues/291
2021-03-07 12:49:31 -08:00
Wez Furlong
ba5d50ba9e add window-resized event
This is to support <https://github.com/wez/wezterm/issues/291>.

The window resized event happens asynchronously wrt. processing
a window resize, triggering at the end of the normal window
resize handling.

This commit introduces the notion of whether we are in full screen
mode or not in the underlying event callback, which is useful to
gate the desired feature, which is: when in full screen mode,
increase the padding for the window to center its content.

While poking around at this, I noticed that we weren't passing
the per-window config down to the code that computes the quad
locations for the window.

This commit also changes the font size increase/decrease behavior
so that in full screen mode it doesn't try to resize the window.

```lua
local wezterm = require 'wezterm';

wezterm.on("window-resized", function(window, pane)
  local window_dims = window:get_dimensions();
  local pane_dims = pane:get_dimensions();
  local overrides = window:get_config_overrides() or {}

  if not window_dims.is_full_screen then
    if not overrides.window_padding then
      -- not changing anything
      return;
    end
    overrides.window_padding = nil;
  else
    -- Use only the middle 33%
    local third = math.floor(window_dims.pixel_width / 3)
    local new_padding = {
      left = third,
      right = third,
      top = 0,
      bottom = 0
    };
    if overrides.window_padding and new_padding.left == overrides.window_padding.left then
      -- padding is same, avoid triggering further changes
      return
    end
    overrides.window_padding = new_padding

  end
  window:set_config_overrides(overrides)
end);

return {
}
```
2021-03-07 11:54:15 -08:00
Wez Furlong
ffa106d729 docs: move this changelog entry to the right place! 2021-03-07 10:12:27 -08:00
Wez Furlong
8fd515d6fa fix typo in battery state value 2021-03-07 00:22:27 -08:00
Wez Furlong
ec12eed180 docs: migrate misc.md to individual config pages 2021-03-07 00:10:28 -08:00
Wez Furlong
336f209ede Revert and gate shaping changes
I'm calling it a temporary defeat on the shaping changes;
this commit effectively reverts the series of changes made
to support slicing up ligatures like `->` when the cursor
moves through them.

They've introduced so many issues and I've spent hours
that haven't resulted in a complete solution, so I've
disabled those changes by putting them behind a boolean
option.

I'll revisit them after I've cut the next release.

refs: https://github.com/wez/wezterm/issues/478
2021-03-06 23:49:37 -08:00
Wez Furlong
4b7f774bc5 Bundle PowerlineExtraSymbols as a fallback font 2021-03-06 19:12:35 -08:00
Wez Furlong
90eb69f68a docs: add wezterm.battery_info docs with an example
refs: https://github.com/wez/wezterm/issues/500
2021-03-06 16:42:31 -08:00
Wez Furlong
e992ac7ad0 lua: add wezterm.battery_info() function
Queries the system battery information and returns an array of
battery information.

Each element is a lua table with the following entries:

* state_of_charge: expressed as percents
* vendor: the battery manufacturer
* model: the battery model
* serial: the battery serial number
* time_to_full: how long until the battery is full
* time_to_empty: how long until the battery is empty
* state: "Charging", "Discharging", "Empty", "Full", "Unknown"

I haven't run this on a system with a battery yet, so I'm holding
off from showing an example until I've got a work one.

refs: https://github.com/wez/wezterm/issues/500
2021-03-06 14:25:36 -08:00
Wez Furlong
98cb3a8191 adjust some errors -> warnings
These don't indicate that something is wrong with wezterm, so don't
appear to be so alarming.
2021-03-06 13:58:55 -08:00
Wez Furlong
dcb6fec28f don't kill pane when closing copy or search mode overlays
I recently introduced this bug when tidying up reaping overlay panes.
2021-03-06 13:46:30 -08:00
Wez Furlong
30144ef964 more guesswork to compensate for shaping weirdness 2021-03-06 13:38:38 -08:00
Wez Furlong
ac3ac43c2b warn instead of panic if there's already something assigned
I saw this trigger and couldn't repro; I want to understand it
better when it next occurs.
2021-03-06 12:56:36 -08:00
Wez Furlong
014acf1a4a add docs for window decoration stuff 2021-03-06 11:32:15 -08:00
Wez Furlong
9cfa93bf8b tidy up some of the texture atlas invalidation
There was a bit of redundancy with things that happen
inside some of these calls, so centralize and clarify it.
2021-03-06 10:25:39 -08:00
Wez Furlong
f0527f646c simplify shape preprocessing
Manual test scenario:

```
wezterm -n --config adjust_window_size_when_changing_font_size=false --config 'exit_behavior="Hold"' start -- sh -c "echo '(...)'"
```

then CTRL +/- to change font size; the first cell of the `...` was
previously random garbage, now is more consistent.

refs: https://github.com/wez/wezterm/issues/478
2021-03-06 10:19:59 -08:00
Wez Furlong
a3429d189b fixup build on windows 2021-03-04 23:23:09 -08:00
Wez Furlong
a736492497 fixup build on x11/wayland 2021-03-04 23:16:18 -08:00
Wez Furlong
cfed798e79 window: allow window layer to hold per-window config
This is to allow for eg: hotkey to change window decorations
(https://wezfurlong.org/wezterm/config/lua/window/set_config_overrides.html)

So far only macos actually keeps a per-window config.
Hopefully this still compiles for windows and x11.
2021-03-04 23:05:44 -08:00
Wez Furlong
a5bc89e6d3 docs: update build/run from source instructions 2021-03-04 21:56:49 -08:00
Wez Furlong
1178639a22 windows: implement decoration setting, change to bitfield
Can now set `window_decorations = "TITLE|RESIZE"` or variations
on those flags.  `NONE` is a shortcut for no flags.
2021-03-04 09:40:38 -08:00
Wez Furlong
945b6b726f windows: allow disabling titlebar, fixup dragging 2021-03-04 08:37:29 -08:00
Wez Furlong
1ca9fb3555 x11: allow disabling the titlebar
I've kept resizing in there because it doesn't appear to render
a border in mutter and seems useful.

I think I'll probably change WindowDecorations to bitflags so
that the user can control this, but first need to verify what
windows supports for this.
2021-03-04 08:02:13 -08:00
Wez Furlong
3356a3a149 don't trigger status bar update after each paint or mouse move
mouse move events in the tab bar, and paint events, could cause
the title bar state to be recomputed.

Make sure that we don't trigger the status event to trigger for those.

refs: https://github.com/wez/wezterm/issues/500
2021-03-03 23:53:09 -08:00
Wez Furlong
7e1d16e671 Add SUPER+Drag to drag the window 2021-03-03 23:45:02 -08:00
Wez Furlong
5a5d08080c gui: allow dragging the window by non-tab areas in tab bar
I've only tested this on macos, but it should be cross platform,
with the caveat that Wayland doesn't let a window position itself,
so this won't work there.
2021-03-03 23:29:18 -08:00
Wez Furlong
4834a29791 macos: support disabling the titlebar
This isn't fully baked yet, so I'm not documenting it yet.
2021-03-03 22:47:31 -08:00
Wez Furlong
783f445c57 allow changing status_update_interval dynamically
We were using the value that was active when the window was created,
and never updating it.

This commit sweeps the interval check into the existing periodic
window maintenance routine.

refs: https://github.com/wez/wezterm/issues/500
2021-03-03 19:58:46 -08:00
Wez Furlong
b614719ff3 docs: mention freebsd along with other platforms 2021-03-03 08:48:41 -08:00
Wez Furlong
62917c63b6 docs: add installation info for FreeBSD 2021-03-03 08:45:58 -08:00
Wez Furlong
144a39bf9f docs: add FAQ about powershell cursor key problems
refs: https://github.com/wez/wezterm/issues/510
refs: https://github.com/PowerShell/PowerShell/issues/12268
2021-03-03 08:26:30 -08:00
Wez Furlong
76c7ef56df term: RIS must clear the scrollback
closes: #511
2021-03-03 07:44:57 -08:00
Wez Furlong
d6daeb0399 cargo update primarily to pick up open 1.5.1 2021-03-03 07:28:35 -08:00
Wez Furlong
c305abdcd7 trigger the status event when the title is updated, too
This makes it quicker to respond to things like eg: the cwd
in the pane changing.

refs: https://github.com/wez/wezterm/issues/500
2021-03-02 22:36:39 -08:00
Wez Furlong
9ac230876c Add status_update_interval option for status updates
The status event is triggered at window creation, and
then every `status_update_interval` milliseconds.

refs: https://github.com/wez/wezterm/issues/500
2021-03-02 20:44:08 -08:00
Wez Furlong
ff8bda29e3 lua: add wezterm.strftime
refs: https://github.com/wez/wezterm/issues/500
2021-03-02 09:52:54 -08:00
Wez Furlong
99a0b044a0 experimental: add right-status concept and event
The API isn't finalized; this is proof of concept for putting something
in the area to the right of the new tab button.

The info will be right aligned to the tab area.

```lua
local wezterm = require 'wezterm';

wezterm.on("update-right-status", function(window, pane)
  -- demonstrates shelling out to get some external status.
  -- wezterm will parse escape sequences output by the
  -- child process and include them in the status area, too.
  local success, date, stderr = wezterm.run_child_process({"date"})

  -- Make it italic and underlined
  window:set_right_status(wezterm.format({
    {Attribute={Underline="Single"}},
    {Attribute={Italic=true}},
    {Text="Hello "..date},
  }));
end)

return {
}
```

refs: https://github.com/wez/wezterm/issues/500
2021-03-02 09:52:54 -08:00
Wez Furlong
565a4c69d5 lua: add wezterm.format function
The intent is to use this to compose text for a configurable tab bar.

refs: https://github.com/wez/wezterm/issues/500
2021-03-02 09:52:54 -08:00
Wez Furlong
62e14efcb3 lua: add log_info and log_warn 2021-03-02 09:52:54 -08:00
Wez Furlong
f6f8b5906b issue template: mention collectin the keyboard layout too 2021-03-02 09:13:41 -08:00
Wez Furlong
01f5df6729 term: ignore ShiftIn/ShiftOut
rather than logging an error.

closes: #509
2021-03-02 09:07:20 -08:00
Wez Furlong
48f5fccb86 block glyphs: fix quad rendering
The line drawing routine takes inclusive start/end coordinates,
so if we're feeding the start/end from Range (which is exclusive),
then we need to reduce by 1.

refs: https://github.com/wez/wezterm/issues/433#issuecomment-787640338
2021-03-01 09:52:25 -08:00
Wez Furlong
e90e067619 cargo update 2021-03-01 09:02:05 -08:00
Wez Furlong
1415e9ce4d ci: fixup build on macos where --target is in use 2021-02-28 18:51:09 -08:00
Wez Furlong
d56c5178da shaping: add test for FiraCode
Adds a test and seemingly a fix for https://github.com/wez/wezterm/issues/478#issuecomment-787520977

Fira Code is OFL-1.1 licensed like the other fonts we include,
however, I'm not distributing Fira Code with wezterm.
2021-02-28 13:35:00 -08:00
Wez Furlong
f7c26d1866 egl: log error if make_current fails
I see this trigger in debug builds only.  Not sure why yet.
2021-02-28 12:32:58 -08:00
Wez Furlong
522d4ad814 make exit_behavior = "CloseOnCleanExit" the default
It seems generally useful and non-intrusive, so do that.
2021-02-28 12:01:07 -08:00
Wez Furlong
b4b92a68f7 block glyphs: handle very small sizes better!
refs: #433
2021-02-28 10:06:00 -08:00
Wez Furlong
0597684ebd Render custom block glyphs
As explained in the docs included in this commit, ideally this
wouldn't be needed, but due to a long-standing hinting bug in
freetype <https://gitlab.freedesktop.org/freetype/freetype/-/issues/761>
it seems most expedient to just render our own block glyphs,
so that's what this does!

refs: #433
2021-02-28 09:43:26 -08:00
Wez Furlong
a3b25324b2 build fixes for macos, windows 2021-02-28 07:39:49 -08:00