10137 Commits

Author SHA1 Message Date
Jon Parise
5b4976f6ef elvish: fix platform:hostname function call syntax 2025-04-08 10:54:26 -04:00
Jon Parise
b213c157f0 elvish: use kitty-shell-cwd:// to report pwd
OSC 7's standard body is a percent-encoded file:// URL. There isn't an
easy way for us to percent-encode the path ($pwd) component here without
implementing a custom function.

Instead, switch to the kitty-shell-cwd:// scheme, which Kitty introduced
to ease this implementation challenge in shell scripts. It accepts the
path string verbatim, without an encoding.

In Ghostty, we accept both the file:// and kitty-shell-cwd:// schemes,
and we attempt to URI-decode them both, so in practice this is more
about the "correctness" of this protocol than a functional change. It's
also possible we might decide to treat these schemes differently in the
runtime, like Kitty does.
2025-04-08 10:38:57 -04:00
Mitchell Hashimoto
17ba0252e8 Update iTerm2 colorschemes (#7007)
Upstream revision:
4c57d8c11d
2025-04-07 20:31:54 -07:00
Mitchell Hashimoto
dc0b9a703d fix(kittygfx): accept commands with no control data (#7023)
This sort of command is treated as valid by Kitty so we should too. In
fact, it occurs with the example `send-png` script provided in the docs
for the protocol.
2025-04-07 20:31:41 -07:00
taylrfnt
6d36eeef3c add the verbosity
Co-authored-by: Kat <65649991+00-kat@users.noreply.github.com>
2025-04-07 21:41:29 -05:00
taylrfnt
8a446b7776 remove the verbosity
Co-authored-by: Kat <65649991+00-kat@users.noreply.github.com>
2025-04-07 21:41:09 -05:00
taylrfnt
279a6b6f58 fix typos & make it read more naturally 2025-04-07 21:27:01 -05:00
taylrfnt
9440dbba1a add notes abotu minimum config 2025-04-07 21:25:26 -05:00
taylrfnt
a6123c0447 fix trailing whitespace 2025-04-07 20:41:48 -05:00
taylrfnt
92959bc09c fix typo
Co-authored-by: Kat <65649991+00-kat@users.noreply.github.com>
2025-04-07 20:39:22 -05:00
taylrfnt
b3c61d90f3 add note about commits 2025-04-07 20:37:57 -05:00
Jon Parise
f1472362af Use built-in functions for elvish (#7025)
Currently the elvish shell integration uses the `hostname` command, this
may not exist on all systems and is somewhat redundant to rely on when
elvish has an
[`platform:hostname`](https://elv.sh/ref/platform.html#platform:hostname)
function that can be used and will work across platform regardless of
command availability. On top of this instead of directly calling the
`pwd` function we can simply use the built-in
[`$pwd`](https://elv.sh/ref/builtin.html#$pwd) variable that elvish
gives us. This should prevent the shell integration from breaking due to
external function availability.
2025-04-07 18:09:09 -04:00
taylrfnt
d3b7fe3473 make following into these for better readability 2025-04-07 15:28:31 -05:00
taylrfnt
ddb85ca1b1 better discussion & issue callout in the important note
Co-authored-by: Kat <65649991+00-kat@users.noreply.github.com>
2025-04-07 15:25:54 -05:00
taylrfnt
c7635d5f41 remove the please
Co-authored-by: Kat <65649991+00-kat@users.noreply.github.com>
2025-04-07 15:19:38 -05:00
Hanna
a8f760c6d2 fix: undo accidental replace 2025-04-07 16:10:50 -04:00
Hanna
77f5fe2560 fix: parenthesis are unneeded around builtins 2025-04-07 16:09:43 -04:00
Hanna
9808c13796 refactor: use builtin hostname function 2025-04-07 16:02:53 -04:00
Jon Parise
e73970533a shell-integration: Fix condition for sudo (#7021)
A missing ";" meant the check for $TERMINFO was never executed.
2025-04-07 15:53:50 -04:00
Qwerasd
b64f49a0d7 fix(kittygfx): accept commands with no control data
This sort of command is treated as valid by Kitty so we should too. In
fact, it occurs with the example `send-png` script provided in the docs
for the protocol.
2025-04-07 13:31:51 -06:00
Fabian Boehm
df174a74f8 shell-integration: Fix condition for sudo
A missing ";" meant the check for $TERMINFO was never executed.
2025-04-07 21:20:21 +02:00
Mitchell Hashimoto
3878e46707 Fix macOS shortcut binding for close_window action (#7020)
Fixes #7003
2025-04-07 10:04:26 -07:00
Bryan Lee
9144f4db58 Fix macOS shortcut binding for close_window action 2025-04-08 00:44:53 +08:00
taylrfnt
9643e9c7a6 introduce issue triage template 2025-04-06 19:29:58 -05:00
mitchellh
f6ec39a5d8 deps: Update iTerm2 color schemes 2025-04-06 00:13:30 +00:00
Mitchell Hashimoto
6f7977fef1 macos: replay control+key events that go to doCommand (#7001)
Fixes #7000

Related to #6909, the same mechanism, but it turns out some control+keys
are also handled in this same way (namely control+esc leads to "cancel"
by default, which is not what we want).
2025-04-04 22:28:20 -04:00
Mitchell Hashimoto
fe0536aaaf macos: replay control+key events that go to doCommand
Fixes #7000

Related to #6909, the same mechanism, but it turns out some control+keys
are also handled in this same way (namely control+esc leads to "cancel"
by default, which is not what we want).
2025-04-04 22:09:04 -04:00
Mitchell Hashimoto
c0eaa4b158 macos: left mouse click while not focused doesn't encode to pty (#6998)
Fixes #2595

This fixes an issue where a left mouse click on a terminal while not
focused would subsequently be encoded to the pty as a mouse event. This
is atypical for macOS applications in general and wasn't something we
wanted to do.

We do, however, want to ensure our terminal gains focus when clicked
without focus. Specifically, a split. This matches iTerm2 behavior and
is rather nice. We had this behavior before but our logic to make this
work before caused the issue this commit is fixing.

I also tested this with command+click which is a common macOS shortcut
to emit a mouse event without raising the focus of the target window. In
this case, we will properly focus the split but will not encode the
mouse event to the pty. I think we actually do a _better job_ here tha
iTerm2 (but, subjective) because we do encode the pty event properly if
the split is focused whereas iTerm2 never does.
2025-04-04 19:31:22 -04:00
Mitchell Hashimoto
f228933955 macos: left mouse click while not focused doesn't encode to pty
Fixes #2595

This fixes an issue where a left mouse click on a terminal while not
focused would subsequently be encoded to the pty as a mouse event. This
is atypical for macOS applications in general and wasn't something we
wanted to do.

We do, however, want to ensure our terminal gains focus when clicked
without focus. Specifically, a split. This matches iTerm2 behavior and
is rather nice. We had this behavior before but our logic to make this
work before caused the issue this commit is fixing.

I also tested this with command+click which is a common macOS shortcut
to emit a mouse event without raising the focus of the target window. In
this case, we will properly focus the split but will not encode the
mouse event to the pty. I think we actually do a _better job_ here tha
iTerm2 (but, subjective) because we do encode the pty event properly if
the split is focused whereas iTerm2 never does.
2025-04-04 19:17:03 -04:00
Mitchell Hashimoto
60da3cf6a0 shell-integration: switch to $GHOSTTY_SHELL_FEATURES (#6871)
This change consolidates all three opt-out shell integration environment
variables into a single opt-in $GHOSTTY_SHELL_FEATURES variable. Its
value is a comma-delimited list of the enabled shell feature names (e.g.
"cursor,title").

$GHOSTTY_SHELL_FEATURES is set at runtime and automatically added to the
shell environment. Its value is based on the shell-integration-features
configuration option.

$GHOSTTY_SHELL_FEATURES is only set when at least one shell feature is
enabled. It won't be set when 'shell-integration-features = false'.

$GHOSTTY_SHELL_FEATURES lists only the enabled shell feature names. We
could have alternatively gone in the opposite direction and listed the
disabled features, letting the scripts assume each feature is on by
default like we did before, but I think this explicit approach is a
little safer and easier to reason about / debug.

It also doesn't support the "no-" negation prefix used by the config
system (e.g. "cursor,no-title"). This simplifies the implementation
requirements of our (multiple) shell integration scripts, and because
$GHOSTTY_SHELL_FEATURES is derived from shell-integration-features, the
user-facing configuration interface retains that expressiveness.

$GHOSTTY_SHELL_FEATURES is intended to primarily be an internal concern:
an interface between the runtime and our shell integration scripts. It
could be used by people with particular use cases who want to manually
source those scripts, but that isn't the intended audience.

... and because the previous $GHOSTTY_SHELL_INTEGRATION_NO_* variables
were also meant to be an internal concern, this change does not include
backwards compatibility support for those names.

One last advantage of a using a single $GHOSTTY_SHELL_FEATURES variable
is that it can be easily forwarded to e.g. ssh sessions or other shell
environments.

See: #5070
2025-04-04 17:05:37 -04:00
Mitchell Hashimoto
17a19e4837 docs: use Command instead of super for macOS (#6987)
Command is the name Apple uses for this key and that's printed on the
keyboard 😉
2025-04-03 21:31:05 -04:00
Mitchell Hashimoto
970fcdf671 libghostty: Action CValue should be untagged extern union (#6992)
Fixes #6962

I believe this is an upstream bug
(https://github.com/ziglang/zig/issues/23454), where Zig is allowing
extern unions to be tagged when created via type reification. This
results in a CValue that has an extra trailing byte (the tag).

This wasn't causing any noticeable issues for Ghostty for some reason
but others using our pattern were seeing issues. And I did confirm that
our CValue was indeed tagged and was the wrong byte size. I assume Swift
was just ignoring it because it was extra data. I don't know, but we
should fix this in general for libghostty.
2025-04-03 21:14:01 -04:00
Mitchell Hashimoto
e19b5a150a libghostty: Action CValue should be untagged extern union
Fixes #6962

I believe this is an upstream bug
(https://github.com/ziglang/zig/issues/23454), where Zig is allowing
extern unions to be tagged when created via type reification. This
results in a CValue that has an extra trailing byte (the tag).

This wasn't causing any noticeable issues for Ghostty for some reason
but others using our pattern were seeing issues. And I did confirm that
our CValue was indeed tagged and was the wrong byte size. I assume Swift
was just ignoring it because it was extra data. I don't know, but we
should fix this in general for libghostty.
2025-04-03 20:57:31 -04:00
Simon Olofsson
af0004eb52 docs: use Command instead of super for macOS
Command is the name Apple uses for this key and that's printed on the keyboard 😉
2025-04-03 11:03:48 +02:00
Leah Amelia Chen
6f1b22aca5 gtk(x11): fix blur regions when using >200% scaling (#6978)
See #6957

We were not considering GTK's internal scale factor that converts
between "surface coordinates" and actual device coordinates, and that
worked fine until the scale factor reached 2x (200%).

Since the code is now dependent on the scale factor (which could change
at any given moment), we also listen to scale factor changes and then
unconditionally call `winproto.syncAppearance`. Even though it's
somewhat overkill, I don't expect people to change their scale factor
dramatically all the time anyway...
2025-04-02 17:38:27 +02:00
Leah Amelia Chen
969839acf3 gtk(x11): fix blur regions when using >200% scaling
See #6957

We were not considering GTK's internal scale factor that converts between
"surface coordinates" and actual device coordinates, and that worked fine
until the scale factor reached 2x (200%).

Since the code is now dependent on the scale factor (which could change
at any given moment), we also listen to scale factor changes and then
unconditionally call `winproto.syncAppearance`. Even though it's somewhat
overkill, I don't expect people to change their scale factor dramatically
all the time anyway...
2025-04-02 17:21:28 +02:00
Jeffrey C. Ollie
1067cd3d8a core: update libvaxis and zf for transitive zigimg dependency (#6947) 2025-03-28 14:55:28 -05:00
Jeffrey C. Ollie
9f57a03926 core: update libvaxis and zf for transitive zigimg dependency 2025-03-28 14:31:57 -05:00
Mitchell Hashimoto
0afb922375 macos: reset the last command key state when keyDown event (#6933)
Fixes a regression from #6909
See #6887

In certain scenarios, the last command key state would linger around (I
could only see this happen with global keybinds for unknown reasons
yet). This state is only meant to have an effect within the cycle of a
single keybind and only so we can ensure an event reaches keyDown so it
should be reset if keyDown is ever sent (since, by definition at that
point, keyDown has been reached).

I'm still not happy that this is necessary and I suspect there is a
better root cause to resolve, but I'd rather get this fix in now and
figure out the root cause later.
2025-03-27 07:50:33 -07:00
Mitchell Hashimoto
99843cf54d macos: reset the last command key state when keyDown event
Fixes a regression from #6909
See #6887

In certain scenarios, the last command key state would linger around (I
could only see this happen with global keybinds for unknown reasons
yet). This state is only meant to have an effect within the cycle of a
single keybind and only so we can ensure an event reaches keyDown so it should
be reset if keyDown is ever sent (since, by definition at that point,
keyDown has been reached).

I'm still not happy that this is necessary and I suspect there is a
better root cause to resolve, but I'd rather get this fix in now and
figure out the root cause later.
2025-03-27 07:22:05 -07:00
Jeffrey C. Ollie
1c3693c383 version bump for development (#6928) 2025-03-26 23:46:59 -05:00
Jeffrey C. Ollie
27978ef4d0 version bump for development 2025-03-26 23:29:15 -05:00
Leah Amelia Chen
494279419a gtk: use up-to-date maximized & fullscreen state in syncAppearance (#6924)
DerivedConfig's maximize and fullscreen should only ever be used during
window creation and nowhere else.
2025-03-26 20:33:55 +01:00
Leah Amelia Chen
ae3e92a3fb gtk: use up-to-date maximized & fullscreen state in syncAppearance
DerivedConfig's maximize and fullscreen should only ever be used during
window creation and nowhere else.
2025-03-26 20:15:18 +01:00
Jeffrey C. Ollie
ed4260b3c2 fix: escape characters in shell escape test (#6925)
Fix the escape.

Sorry again for the inconveniences. Let's check if the test is now green
2025-03-26 14:14:38 -05:00
Ian den Hartog
18cc119ced fix: escape characters in shell escape test 2025-03-26 19:52:36 +01:00
Jeffrey C. Ollie
613857cf7e fix: add ( and ) to escape characters when dropping files in gtk (#6922)
Currently when dropping files in gtk with file names that include ( or )
will generate a bash error.

With this change ( and ) will be escaped.
2025-03-26 13:38:10 -05:00
Ian den Hartog
447a889559 fix: add ( and ) to escape characters when dropping files in gtk 2025-03-26 19:30:07 +01:00
Mitchell Hashimoto
837cdf0556 Metal: fix crunchy constrained glyphs (#6914)
Fixes problem pointed out in discussion #6895, as well as adjusting the
constraint logic to account for the offset, since I noticed it was
wrong; the constraint logic now accounts for the x offset, so that the
glyph does not exceed the right edge of the constraint width when the
offset is added, and the offset is zeroed if the glyph is resized down
to fit the constraint width.

|**Before**|**After**|
|-|-|
|<img width="84" alt="image"
src="https://github.com/user-attachments/assets/9561ca40-cfa0-4aed-b192-ee15042d8cbb"
/>|<img width="82" alt="image"
src="https://github.com/user-attachments/assets/9a77ac61-f46d-41de-a859-2b394024f7bc"
/>|

<sup>Zoom in to images for detail if you can't see the
crunchiness.</sup>

> [!NOTE]
> It may be an issue that that glyph is rendered with the constrained
text mode in the first place - Kitty doesn't seem to apply constraint
logic to it, and it seems a little over-eager to do so on our part. This
is something to look in to.
2025-03-26 11:20:14 -07:00
Qwerasd
e96f94d8d7 fix(Metal): improve constraint width logic to account for x offset 2025-03-25 21:14:38 -06:00