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

6121 Commits

Author SHA1 Message Date
Wez Furlong
30e2a1a6d1 add Catppuccin color schemes
refs: https://github.com/catppuccin/wezterm/issues/6
refs: https://github.com/wez/wezterm/pull/2221
2022-07-16 06:55:37 -07:00
Wez Furlong
910879642f retro tab bar: use resolved palette for colors
This allows tab bar colors to be defined in the toml file and
take effect on the fancy tab bar!

an example can be found at: https://github.com/catppuccin/wezterm/blob/main/dist/catppuccin-frappe.toml

refs: https://github.com/catppuccin/wezterm/issues/6
2022-07-16 06:20:26 -07:00
Wez Furlong
bbd2983bbc schemes: prefer name from metadata when loading toml
refs: https://github.com/catppuccin/wezterm/issues/6
2022-07-16 06:14:18 -07:00
Wez Furlong
73993a60b4 macos: Add com.apple.security.automation.apple-events entitlement
This is necessary for applications spawned via wezterm to be able to
generate apple events.

wezterm already had the text for the authorization prompt in its plist,
but because it was code signed with the default set of entitlements,
macOS didn't bother to prompt.

This commit introduces an explicit set of entitlements and uses those
when signing the executable.

I test this by manually codesigning on my laptop and confirmed that I
could run bbedit from inside wezterm.

I can't directly test the CI version of that flow on my laptop as it may
destroy my keychain if I got something wrong.

We'll have to see if the CI generated build works out!

refs: https://github.com/wez/wezterm/issues/2242

h/t to https://github.com/microsoft/vscode/issues/119787 for
clearly documenting what was needed.
2022-07-15 19:33:30 -07:00
Wez Furlong
2450fed071 fix padding to the right of retro tab bar
refs: https://github.com/wez/wezterm/issues/2210
2022-07-15 18:40:43 -07:00
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
3d616ffb3d color scheme: allow exporting schemes that set index colors
refs: https://github.com/catppuccin/wezterm/issues/6
2022-07-15 15:43:35 -07:00
Magnus Groß
60b5be2b34 x11/wayland: always try the portal for appearance
Right now the initial x11 appearance retrieval uses the specific
connection interface, which completely circumvents the already existing
more complete implementation in x_and_wayland.rs.
The latter implementation is strictly better, because it first attempts
getting the appearance from the XDG desktop portal and then falls back
to the X11 interface.

Before this patch there was a very weird issue for folks using the OS
system dark mode with the following config snippet:

```
color_scheme = scheme_for_appearance(wezterm.gui.get_appearance())
```

The color_scheme on startup would be correct, but there would be a very
weird problem where sometimes wezterm ignores the first time that the
portal notifies about an appearance update.

The source of the bug was an inconsistent retrieval of the appearance
setting:
- The Lua API used the XDG desktop portal
- The internal appearance used the X11 specific connection at startup

For example due to this, the internal appearance variable could have
stored "Dark" from the X11 connection, but the actual appearance from
the XDG desktop portal was "Light".
If then the XDG desktop portal changes to "Dark", the
appearance_changed() method would dismiss the update because
self.appearance was already "Dark".

It is only after that, that the internal inconsistency would have been
solved and following appearance changes would succeed and update the
colorscheme correctly.

To fix this problem, we now use the portal directly in both the x11 and
wayland connections,  which is consistent with the Lua
wezterm.gui.get_appearance() API.

refs: #2258
2022-07-15 15:23:47 -07:00
Wez Furlong
80e72fa46e exec domains: pass paneid to fixup method
This way we can ensure that it is set in the environment
in time for the lua callback to see it.

refs: #1776
2022-07-15 06:44:36 -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
53aef1ac6e fix build; last commit passed cargo check but not cargo build!? 2022-07-14 09:49:07 -07:00
Wez Furlong
df6a6667a4 fonts: allow glyph not found warnings to show after config reload
refs: #2188
2022-07-14 09:07:15 -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
49e3fd4c9e fonts: limit missing glyph notification to once per hour
refs: https://github.com/wez/wezterm/issues/2188
2022-07-14 07:26:04 -07:00
Wez Furlong
49ab340a92 debug overlay: remember last log line globally
It can be confusing to see the same log lines when re-opening
the debug overlay, so this commit remembers the last line
in a global to make that feel more natural.

Because that causes the initial `OpenGL Initialized!` log to
show only in the first instance of the overlay, that log line
is now changed to debug level and the overlay will now
explicitly log the version information, along with some
brief usage text:

```
Debug Overlay
wezterm version: 20220714-001416-810512c2
OpenGL version: AMD BEIGE_GOBY (LLVM 14.0.0, DRM 3.46, 5.18.10-200.fc36.x86_64) 4.6 (Compatibility Profile) Mesa 22.1.3
Enter lua statements or expressions and hit Enter.
Press ESC or CTRL-D to exit
```
2022-07-14 06:53:41 -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
222853bdc5 color schemes: move other color scheme format code to color-funcs
I want to add lua funcs for importing schemes; this is a step towards
that.
2022-07-13 21:29:51 -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
8ef70d1e31 windows: avoid recursing and borrowing inner twice
Querying the window can call into windowproc so we need to avoid
it when we hold `inner`.  Adjust the flow so that we can get
the info about the window state purely from an HWND.

refs: #2257
2022-07-13 11:37:04 -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
150732a17d sync-color-schemes: refactor caching and fetching 2022-07-12 10:08:49 -07:00
Wez Furlong
48646ca1d1 sync-color-schemes: refactor 2022-07-12 09:49:01 -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
a1cb7a2a88 dynamic: add validate attribute, validate line_height.
It's now possible to specify a validation function for config
items.

Use that to validate line_height:

```
; ./target/debug/wezterm --config line_height=-1
08:41:10.576  ERROR  wezterm > Error converting lua value from overrides to Config struct: Error processing Config::line_height: Illegal value -1 for line_height; it must be positive and greater than zero!; terminating
```

refs: https://github.com/wez/wezterm/issues/2247
2022-07-12 08:41:42 -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
8e9546fb04 repl: suppress "nil" results
When evaluating an assignment expression like `foo = "bar"` the result
of the expression is nil and we'd print nil on the next line,
which often startles me as I'm used to other languages where the
result of such an expression is the rvalue that was just assigned.

Let's just suppress nil when it is the result of an evaluation
in the repl for a cleaner look.
2022-07-12 07:45:08 -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
98fb67c029 fix termwiz build 2022-07-11 21:20:31 -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
4161e67f60 lua: implicit tostring(userdata) when printing and ToDynamic
I've been holding off from using UserData wrappers around things
because it is awkward to match them up with the To/FromDynamic
conversion.

This commit aims to help with that by implicitly calling the
tostring metamethod (if present) on a userdata both when printing
(so the values look reasonable in the repl) and when mapping a lua
value to a dynamic value.

Provided that the end type is try_from=String this will allow
the userdata value to be assigned as table value.
2022-07-10 21:19:10 -07:00
Wez Furlong
7a5440694d add distro-defaults feature
The intent is that when set, it changes defaults to something
more suitable for distributions.

I've also added a readme for distro maintainers.

refs: https://github.com/wez/wezterm/issues/1795
2022-07-10 16:34:43 -07:00
Davide Cavalca
2dbdfbf124 color-types: add missing license file 2022-07-10 15:48:42 -07:00
Wez Furlong
5939bacf14 Import terminal.sexy themes 2022-07-10 14:33:31 -07:00