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

3279 Commits

Author SHA1 Message Date
Wez Furlong
381f0e68ef add xcb image for debian, freebsd and arch, maybe
not 100% sure about freebsd and arch

refs: https://github.com/wez/wezterm/issues/524
2021-03-08 22:26:29 -08:00
Wez Furlong
18cb179227 x11: query Xft.dpi from the root window
We should now be using the root window specified default dpi
if the dpi is left unspecified in the wezterm configuration.

refs: #515
2021-03-08 22:19:44 -08:00
Wez Furlong
aceb4933a9 x11: load XCursor.theme based cursors when available
This requires `xcb-util-image-devel` on fedora, not sure about debian
or other systems so far.

refs: #524
2021-03-08 22:00:42 -08:00
Wez Furlong
387579cfb4 use xcb-util's cursor constants 2021-03-08 08:36:31 -08:00
Wez Furlong
3f3de0f544 refactor: move x11 cursor code to its own file 2021-03-08 08:30:29 -08:00
Wez Furlong
5e13b9662a cargo update 2021-03-07 23:18:21 -08:00
Wez Furlong
41a0148c50 x11: fix reporting shift modifiers for SHIFT-Enter, Space, Tab
refs: https://github.com/wez/wezterm/issues/516
2021-03-07 22:13:53 -08:00
Wez Furlong
5f1bb0a1bc "de-bounce" lua event callbacks
During a live resize, we could queue up a lot of `window-resized`
events, which is undesirable.

This commit introduces a simple but effective mechanism to manage this;
a given event can have at most one executing and one pending copy.

So if we get a burst of resize events (eg: during a live window resize)
that might have previously queued hundreds of discrete events, we now
get a more manageable situation with 1 executing and 1 queued.

With this change, a given event can only have 1 executing instance at a
time (with the exception that the open-uri event doesn't go through this
mechanism).

refs: https://github.com/wez/wezterm/issues/291
2021-03-07 18:11:27 -08:00
Wez Furlong
9c19fa1929 Add window-config-reloaded event
refs: #291
2021-03-07 15:06:04 -08:00
Benoit de Chezelles
afe0450201 Add changelog entry for treat_left_ctrlalt_as_altgr 2021-03-07 12:52:03 -08:00
Benoit de Chezelles
abcc73fd22 Extract doc of treat_left_ctrlalt_as_altgr and leave a reference 2021-03-07 12:52:03 -08:00
Benoit de Chezelles
683d8e96e8 windows: Add option to treat left ctrl-alt as altgr
The previous behavior was to always treat ctrl-alt as altgr on Windows,
this has been done to better support altgr through a VNC session,
but this is very unintuitive when you don't need this behavior.

ref: #472
2021-03-07 12:52:03 -08:00
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