1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-24 07:46:59 +03:00
Commit Graph

1215 Commits

Author SHA1 Message Date
Wez Furlong
e277183cb9 overlays: handle resize better
We need to actually tell them that the pane has been resized
so now we do.
2022-07-15 16:32:26 -07:00
Wez Furlong
122ac8a13c docs: fix typos
closes: #2266
2022-07-15 06:39:14 -07:00
Wez Furlong
8484248010 add wezterm.color.save_scheme for exporting color schemes 2022-07-14 23:22:02 -07:00
Wez Furlong
181401a2ca add lua functions for importing color scheme files 2022-07-14 23:03:18 -07:00
Wez Furlong
e566885e7f colors: move wezterm.get_builtin_color_schemes to wezterm.colors.get_builtin_schemes 2022-07-14 21:52:49 -07:00
Wez Furlong
548adf484b add wezterm.color.get_default_colors 2022-07-14 21:41:39 -07:00
Wez Furlong
dba7932e3e add wezterm.gui.get_appearance to retrieve dark mode
This simplifies the "change scheme based on dark mode" example
a lot.  This was previously impossible to do because we didn't
have a lua module associated with the gui until recently, so
the only way to reference a gui-related object was via an
event callback.

refs: https://github.com/wez/wezterm/issues/2258
2022-07-14 16:46:18 -07:00
Wez Furlong
f9ab69950a color schemes: add version metadata
Record the version in which we first saw a color scheme.
For schemes from iterm2-color-schemes, we just assume that
we've had them forever as it isn't easy to reverse engineer
that metadata.

Everything else is tagged as 'nightly builds only' and I'll update
that to match the version number in the next release.

Newly discovered items will be added with 'nightly builds only'
from this point onwards.
2022-07-14 08:45:29 -07:00
Wez Furlong
0ce5ddbb13 color schemes: remove : splitting for prefix extraction
Originally I had names like `base 16:foo` but wanted `foo` to
sort with `f` rather than `b`, so this prefix extraction
handled that.

I later changed the names to be `foo (base 16)` so we don't
need this.

This moves the `X::Erosion` scheme to sort under `x` where it
feels more natural.

Ensure that scheme_data.rs has a deterministic sort order that
matches the json data.
2022-07-14 07:40:50 -07:00
Wez Furlong
810512c2c5 colors: refine importer
Adjust importer to read directly from the source .itermcolors
files in the upstream repo.  Extract some author information
from the comments in those files.

All data is now fetched (and cached!) via relatively minimal
http requests rather than requiring a git repo locally.

Also search for .yml files in base16 repos; found another
couple of schemes this way.

The toml files under assets/colors are no longer read by
anything in the repo. I plan to remove them, but since the
docs reference them as examples, I will first ensure that
there are docs and tooling that explains how to write and
share your own scheme files.
2022-07-14 00:14:16 -07:00
Wez Furlong
a1c8b4a9b3 x11/wayland: subscribe to xdg desktop portal for settings changes
We use this to detect changes in dark mode

refs: https://github.com/wez/wezterm/issues/2258
2022-07-13 18:56:21 -07:00
Wez Furlong
5f8ed00faf docs: fix link discussing subpixel hinting 2022-07-13 17:04:26 -07:00
Wez Furlong
8dcfbc6718 x11/wayland: use xdg desktop portal settings interface to get dark mode
There are some other settings in there that could also help with
things like the cursor theme on Wayland.

Note that we don't currently subscribe to the settings changed
signal: that can be done in a follow up.

refs: https://github.com/wez/wezterm/issues/2258
refs: https://github.com/wez/wezterm/issues/1742
2022-07-13 08:55:43 -07:00
Muhammed Zakir
fede46f6b7 Fix shortcut for "move between panes": shift was missing 2022-07-12 22:42:35 -07:00
Wez Furlong
c6ca88f40b docs: show how to find just the dark color schemes 2022-07-12 21:35:05 -07:00
Wez Furlong
7c5c633668 docs: clarify order of extracted colors 2022-07-12 17:13:46 -07:00
Wez Furlong
1a5fdb41da docs: changelog for https://github.com/wez/wezterm/issues/2234 2022-07-12 17:08:06 -07:00
Funami580
cfa95db0cc lua: add pane:is_alt_screen_active() 2022-07-12 17:06:16 -07:00
Wez Furlong
d4d33369f2 color schemes: import all official base16 schemes 2022-07-12 11:51:19 -07:00
Wez Furlong
179ec9faaf wezterm.mux.set_active_workspace now updates the gui
Attach the mux events to the frontend workspace reconciliation function
so that the window is updated to match the new workspace.

Ensure that we correctly clear out any overlay panes as part of the
switch: we need to remove them from the mux so that the mux will
correctly identify that the mux is empty when the main panes from
the workspace are closed.  The problem case was that the debug overlay
state was forgotten by the gui when activating the new workspace, but
we didn't tell the mux to kill it off, so subsequently CTRL-D'ing
the windows closed the windows but left the wezterm process running with
no head.

refs: #2248
2022-07-12 09:15:38 -07:00
Wez Furlong
79d2f8197b quickselect: select bottom-most match
We don't really know which of the on-screen matches the user was
looking at when they selected the text, but assume that the one
nearest the bottom of the viewport is the one they want to select,
rather than the one closest to the top.

refs: https://github.com/wez/wezterm/issues/2250
2022-07-12 08:17:14 -07:00
Wez Furlong
cc4364ca40 docs: add wezterm.color.from_hsla link to color object docs 2022-07-12 07:54:53 -07:00
Wez Furlong
aa697c72ba color: refactor docs, add a couple more methods
Moved the gradient function into the color module, but kept an alias
under the old name.

Gradients now return color objects.

Converting colors to string now uses rgba format when alpha is not 100%.
2022-07-12 07:45:08 -07:00
Wez Furlong
c8ca2054f6 lua: add wezterm.color.extract_colors_from_image
This function can be used to extra distinct colors from
an image to be fed into eg: color scheme generation.
2022-07-11 17:46:36 -07:00
Wez Furlong
870ffdf59a ensure that we spawn open calls on a background thread
Otherwise we can block the gui waiting for eg: a freshly opened firefox to
terminate.

See also comment worrying about this in
75066cb522.
That fear was realized but now resolved!

refs: https://github.com/wez/wezterm/issues/2245
2022-07-11 08:03:37 -07:00
Wez Furlong
cfd9c0b364 colors: add RYB based complement
Now you can complement_ryb yellow to arrive at a purple color,
just like you were taught in art class.
2022-07-11 00:18:39 -07:00
Wez Furlong
463ca2fa29 add wezterm.color module for working with colors
wezterm.color.parse() returns a color object that can be assigned in the
wezterm color config, and that can be used to adjust hue, saturation and
lightness, as well as calculate harmonizing colors (complements, triads,
squares) from the RGB/HSL color wheel.
2022-07-10 23:41:18 -07:00
Wez Furlong
5939bacf14 Import terminal.sexy themes 2022-07-10 14:33:31 -07:00
Wez Furlong
e866e9390a colorschemes: expand to include Gogh color schemes
This commit expands the toml file definition to include
metadata for the origin url, author and name.

A new sync utility fills out that metadata when it pulls from the iterm2
color schemes repo.

The utility also pulls down the scheme data json maintained by
the Gogh project: https://gogh-co.github.io/Gogh/ and converts
it to wezterm's format.

About 50% of Gogh overlaps with iterm2; we take the iterm2 versions
of those schemes by default because the iterm2 data has more info
about things like cursor and selection colors.

The sync utility is responsible for compiling the de-duplicated
set of scheme data into a form that is used by wezterm and its
docs.
2022-07-10 13:32:17 -07:00
Wez Furlong
4a4787ff41 add wezterm.json_parse and wezterm.json_encode 2022-07-10 09:30:54 -07:00
Wez Furlong
c8cb99a512 vtparse: increase MAX_OSC to load dynamic color scripts 2022-07-10 08:36:38 -07:00
Wez Furlong
93255ac2d9 docs: remove color scheme screenshots 2022-07-09 22:42:08 -07:00
Wez Furlong
d5060ec3c1 docs: use asciinema's web player for screenshots
I've wanted to avoid checking in all the screenshot pics as the png
files change every time I run the generation script, and it bloats
the repo over time.

This commit changes the doc generation step to use the asciinema
web player with the equivalent contents.

Really, it's only a smallish step to go from this to just emitting
the html directly in the doc pages, but I think I might use
the player for some examples in the future.

I think this is still a fine step for now in any case.

While comparing this with the existing screenshots, I noticed the
the Alabaster screen shot png has the wrong color for its rightmost
column: there's an issue in wezterm in parsing the dynamic color
escapes that causes it to pick up the wrong color.

Loading the scheme by name has the correct color and matches
how it is shown as of this commit.
2022-07-09 18:59:44 -07:00
Wez Furlong
8bad7dee58 wezterm.format: accept "ResetAttributes" to reset attributes 2022-07-09 16:19:30 -07:00
Wez Furlong
af5938d414 gui: fix padding color when there are splits
refs: https://github.com/wez/wezterm/issues/2210
2022-07-09 14:53:21 -07:00
Wez Furlong
39e727db58 tab bar: invalidate on resize to avoid gaps on the RHS 2022-07-09 10:45:43 -07:00
Wez Furlong
268ff59a9f docs: fixup changelog for https://github.com/wez/wezterm/issues/1620
I copied and pasted the wrong issue into 5913783d1e
2022-07-09 10:32:34 -07:00
Wez Furlong
5913783d1e wayland: fix transparent gap under tab bar
Not sure why this only really showed up with Wayland, because the
issue was that the computed tab bar height ended up being 1 or 2
pixels shorter than the area we had allotted.

This commit resolves it by forcing the height to match, and
then aligning the content to the bottom of that region to avoid
having an undesirable line under the tab.

refs: #1256
2022-07-09 10:29:46 -07:00
Wez Furlong
e2b748a0d4 wayland: initial support for zwp_text_input_v3 / IME
refs: #1772
2022-07-09 09:44:08 -07:00
Wez Furlong
520a8e306f invalid tab bar on scaling changes
refs: #2208
2022-07-09 07:17:03 -07:00
Wez Furlong
dd27e790c8 docs: add wezterm.gui.screens() to changelog 2022-07-09 06:54:55 -07:00
Wez Furlong
29b7524b9d docs: wrap some text 2022-07-08 23:37:28 -07:00
Wez Furlong
95229d3334 add docs for ExecDomain
refs: https://github.com/wez/wezterm/issues/1776
2022-07-08 23:25:42 -07:00
Wez Furlong
b103cc3ebb docs: fix typo and copy pasta 2022-07-08 22:12:16 -07:00
Wez Furlong
c97e8e564e fonts: allow setting assume_emoji_presentation per font
This allows the user to specify what happens if they have an emoji
font that doesn't match our built-in heuristics.
2022-07-08 21:14:16 -07:00
Wez Furlong
f9cfde3b98 docs: changelog for https://github.com/wez/wezterm/pull/2233 2022-07-08 20:51:56 -07:00
Wez Furlong
93c5a9b3fb docs: note about wezterm.format in launcher menu labels 2022-07-08 20:26:01 -07:00
Wez Furlong
d78cc6edb8 new: exec_domains
An ExecDomain is a variation on WslDomain with the key difference
being that you can control how to map the command that would be
executed.

The idea is that the user can define eg: a domain for a docker
container, or a domain that chooses to run every command in its
own cgroup.

The example below shows a really crappy implementation as a
demonstration:

```
local wezterm = require 'wezterm'

return {
  exec_domains = {
    -- Commands executed in the woot domain have "WOOT" echoed
    -- first and are then run via bash.
    -- `cmd` is a SpawnCommand
    wezterm.exec_domain("woot", function(cmd)
      if cmd.args then
        cmd.args = {
          "bash",
          "-c",
          "echo WOOT && " .. wezterm.shell_join_args(cmd.args)
        }
      end
      -- you must return the SpawnCommand that will be run
      return cmd
    end),
  },
  default_domain = "woot",
}
```

This commit unfortunately does more than should go into a single
commit, but I'm a bit too lazy to wrangle splitting it up.

* Reverts the nil/null stuff from #2177 and makes the
  `ExtendSelectionToMouseCursor` parameter mandatory to dodge
  a whole load of urgh around nil in table values. That is
  necessary because SpawnCommand uses optional fields and the
  userdata proxy was making that a PITA.
* Adds some shell quoting helper functions
* Adds ExecDomain itself, which is really just a way to
  to run a callback to fixup the command that will be run.
  That command is converted to a SpawnCommand for the callback
  to process in lua and return an adjusted version of it,
  then converted back to a command builder for execution.

refs: https://github.com/wez/wezterm/issues/1776
2022-07-07 16:38:14 -07:00
Wez Furlong
6485fae873 docs: window:maximize(), window:restore() and gui-startup 2022-07-07 06:35:15 -07:00
Wez Furlong
dbc2c85361 add window:toggle_fullscreen()
You can start a window in full screen mode using something like:

```lua
local wezterm = require 'wezterm'

local mux = wezterm.mux

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

return {
}
```

refs: #177
refs: #284
2022-07-06 23:57:32 -07:00