Commit Graph

9283 Commits (facda0c3fb1310c7698fc77ba193165ef38cd58e)

Author SHA1 Message Date
Mitchell Hashimoto facda0c3fb
gtk(x11): update blur region upon syncAppearance (#5443)
Fixes a bug where the blur region offset used to accomodate CSDs are
applied even when CSDs are disabled.
2025-01-30 13:43:48 -08:00
Mitchell Hashimoto 75dec598cc
nix: fix Ghostty homepage in package (#5436) 2025-01-30 13:40:49 -08:00
Leah Amelia Chen 48a1a10330
gtk(x11): update blur region upon syncAppearance
Fixes a bug where the blur region offset used to accomodate CSDs
are applied even when CSDs are disabled.
2025-01-30 20:28:00 +01:00
Jeffrey C. Ollie 6dd9bf0038
nix: fix Ghostty homepage in package 2025-01-30 11:04:44 -06:00
Mitchell Hashimoto adf4066b69
nix: use --system build flag instead of relying on $ZIG_GLOBAL_CACHE_DIR (#5434)
Fixes #5431
2025-01-30 08:48:31 -08:00
Jeffrey C. Ollie 40973417d0
nix: use --system build flag instead of relying on $ZIG_GLOBAL_CACHE_DIR
Fixes #5431
2025-01-30 10:16:45 -06:00
Mitchell Hashimoto a62b26cd2f
next version will be 1.1.0 2025-01-30 07:18:43 -08:00
Mitchell Hashimoto 04d36361b1
ci: separate publish and release workflows (#5425)
Fixes #4218 

This now requires a separate manually triggered `publish` workflow to be
run after the release completes in order to transition the release to
the `published` state.

Practically today this only means that the release will be published to
the macOS auto-updater, but in the future we could add additional steps
such as creating a GH release or some other notifications.

Importantly, this lets us verify the release in the uploaded location
before general users are notified of the update.
2025-01-29 17:21:52 -08:00
Mitchell Hashimoto dbc4edc583
ci: separate publish and release workflows
This now requires a separate manually triggered `publish` workflow to be
run after the release completes in order to transition the release to
the `published` state.

Practically today this only means that the release will be published to
the macOS auto-updater, but in the future we could add additional steps
such as creating a GH release or some other notifications.

Importantly, this lets us verify the release in the uploaded location
before general users are notified of the update.
2025-01-29 16:39:35 -08:00
Mitchell Hashimoto 692168f8dd
dist: remove cdata tags from appcast, we escape it all 2025-01-29 15:08:30 -08:00
Mitchell Hashimoto fefda69ac3
input: performable bindings aren't part of the reverse mapping (#5421)
Fixes #4522

This is a bit of a hammer-meets-nail solution, but it's a simple
solution to the problem. The reverse mapping is used to find the binding
that an action is bound to, and it's used by apprt's to populate the
accelerator label in the UI.

The problem is that accelerators in GTK are handled early in the event
handling process and its difficult to get that event mapping to a
specific surface. Therefore, the "performable" prefix was not working.
On macOS, this issue didn't exist because there exists an OS mechanism
to install an event handler earlier than the menu system.

This commit changes the reverse mapping to only include bindings that
are not performable. This way, the keybind always reaches the surface
and can be handled by `Surface.keyCallback` which processes
`performable`.

The caveat is that performable bindings will not show up in the UI for
menu items. This is documented in this commit now. They still work, its
just a UI issue.
2025-01-29 14:44:52 -08:00
Mitchell Hashimoto c33b82c634
macOS: add link to release notes on appcast (#5184)
Resolves #4730

I opted to link directly to the release notes of the updated version in
the `<description>` body, i.e. in the future it would link directly
v1.0.2's release notes at
https://ghostty.org/docs/install/release-notes/1-0-2. This thereby
implements the second option mentioned in the issue. It wasn't that much
harder than the third option, but if there's any particular reason _not
to_ link directly to a version's changelog page, I'll be more than happy
to modify this PR and implement the third option instead - in any case,
I had opened https://github.com/ghostty-org/website/pull/277 so that
https://ghostty.org/docs/install/release-notes is a valid page.

I also wrapped the current text `<![CDATA[ ... ]]>` just in case, as I
noticed this is a pretty standard practice in other apps that use
`<description>` to embed their release notes when using Sparkle -
[Sparkle's
documentation](https://sparkle-project.org/documentation/publishing/#embedded-release-notes)
says to do this so you can use unescaped HTML.
2025-01-29 14:38:18 -08:00
Mitchell Hashimoto ce2a3773d2
input: performable bindings aren't part of the reverse mapping
Fixes #4522

This is a bit of a hammer-meets-nail solution, but it's a simple
solution to the problem. The reverse mapping is used to find the
binding that an action is bound to, and it's used by apprt's to populate
the accelerator label in the UI.

The problem is that accelerators in GTK are handled early in the event
handling process and its difficult to get that event mapping to a
specific surface. Therefore, the "performable" prefix was not working.
On macOS, this issue didn't exist because there exists an OS mechanism
to install an event handler earlier than the menu system.

This commit changes the reverse mapping to only include bindings that
are not performable. This way, the keybind always reaches the surface
and can be handled by `Surface.keyCallback` which processes
`performable`.

The caveat is that performable bindings will not show up in the UI
for menu items. This is documented in this commit now. They still work,
its just a UI issue.
2025-01-29 14:12:21 -08:00
Mitchell Hashimoto 09ccda4d28
apprt/gtk: set key modifier flag if physical modifier key is pressed (#5420)
Fixes #5191
2025-01-29 13:25:41 -08:00
Mitchell Hashimoto 27b254db8a
apprt/gtk: set key modifier flag if physical modifier key is pressed
Fixes #5191
2025-01-29 13:12:50 -08:00
Mitchell Hashimoto e5364392ee
fix: remove extraneous if check after change to exhaustive switch (#5419)
This came out of cmd+triple-click fix in PR #5373
2025-01-29 11:03:52 -08:00
Lee Marlow 71d0481da8 Remove if check that was left in after change to exhaustive switch
This came out of cmd+triple-click fix in PR #5373
2025-01-29 11:38:35 -07:00
Mitchell Hashimoto 76fd4fa8df
fix: cmd+triple-click select all command output when first line wraps (#5373)
I found this bug was easily reproduced with any command that wrapped to
multiple rows on the first line of its output. The cause is that we stop
searching for rows once we reach the first one where
`row.semantic_prompt = .command`, which means that we reach the bottom
line of wrapped output and stop there.

This PR makes it so that we continue iterating until we reach a row
where `semantic_prompt != .command` and then return the previous one (or
the last one if we run out of rows).

I also updated the test cases to include this.

I considered that this bug would also be avoided if we didn't propagate
the `command` semantic prompt to additional rows on wrapped lines, but I
don't know enough about the shell integration to make a call on that.

Closes #4693
2025-01-29 07:28:17 -08:00
Mitchell Hashimoto d31e6c8b2a
Fix older adwaita tab bars appearing above the title bar (#5410)
When setting up the GTK window with older Adwaita versions, we need to
explicitly create and add a tab bar. The previous code simply prepended
the tab bar into the GtkBox, which resulted in it being the very first
element (ahead of the title bar).

Instead, we grab a reference to the GTK title bar widget and call
`gtk_box_insert_child_after()` to explicitly insert our tab bar into the
hierarchy just after the title bar.
2025-01-29 10:09:54 -05:00
Daniel Fox a80cf3db9c
Fix older adwaita tab bars at top of window 2025-01-28 12:30:57 -08:00
Mitchell Hashimoto 603639ad44
renderer/Metal: improve linear blending correction (#5401)
While I actually do personally prefer the previous style's appearance, I
have a feeling this version will be much more popular, since it
essentially replicates the appearance of non-linear blending but without
any fringing artifacts. Details are explained in the comments and commit
messages.

<details>
<summary>
<h3>Screenshots for comparison</h3>
</summary>

*(open images in separate tabs and make sure they're at 100% scale for
proper comparison)*

|blending|screenshot|
|-|-|

|`native`|![native](https://github.com/user-attachments/assets/295bbab3-60a7-4915-93d9-a938082fa309)|

|`linear`|![linear](https://github.com/user-attachments/assets/a9a5a5ea-cf57-4730-8ac6-3ce1dc29c5f8)|
|`linear-corrected`
(old)|![linear-corrected_old](https://github.com/user-attachments/assets/4fd9510d-b798-4900-8c31-00e3f67fd806)|
|`linear-corrected`
(new)|![linear-corrected_new](https://github.com/user-attachments/assets/a379f307-db8a-4335-aa11-3ac71d01470e)|
</details>
2025-01-28 09:59:56 -05:00
Qwerasd 016a26cf98 cleanup: rename `text-blending` to `alpha-blending`
+ correct docs
2025-01-27 19:37:44 -05:00
Qwerasd 5c8f984ea1 renderer/Metal: improve linear blending correction
More mathematically sound approach, does a much better job of matching
the appearance of non-linear blending. Removed `experimental` from name
because it's not really an experiment anymore.
2025-01-27 19:15:18 -05:00
Qwerasd ac568900a5 fix(renderer/Metal): properly load cursor color 2025-01-26 20:40:19 -05:00
Daniel Patterson 4b8010a6f4 Change ifs to exhaustive switches 2025-01-26 15:22:23 +00:00
Daniel Patterson 645b4b0031 Fix cmd+triple click not selecting full output 2025-01-25 23:37:46 +00:00
Mitchell Hashimoto 71e62f96fa
macos: hide dock globally if the dock conflicts (#5363)
Related to #5361

The fix in 5361 wasn't sufficient since it only applied if our app was
in the foreground. Our quick terminal is a non-activating NSPanel to
allow it to work on any space (fullscreen included). This means that
Ghostty doesn't become the active app when the quick terminal is shown
and another app is in the foreground.

To work around this, we now hide the dock globally when the quick
terminal is shown AND the dock is in a conflicting position. We restore
this state when the quick terminal is hidden, loses focus, or Ghostty is
quit.
2025-01-24 20:30:47 -08:00
Mitchell Hashimoto a58b1998a9
macos: hide dock globally if the dock conflicts
Related to #5361

The fix in 5361 wasn't sufficient since it only applied if our app was
in the foreground. Our quick terminal is a non-activating NSPanel to
allow it to work on any space (fullscreen included). This means that
Ghostty doesn't become the active app when the quick terminal is shown
and another app is in the foreground.

To work around this, we now hide the dock globally when the quick
terminal is shown AND the dock is in a conflicting position. We restore
this state when the quick terminal is hidden, loses focus, or Ghostty is
quit.
2025-01-24 20:18:44 -08:00
Mitchell Hashimoto e2e6770ed1
Docs: improve doc structure for action bindings with args and examples (#5344)
Related to #4446 , as suggested i've made a smaller chunk of updates for
the action binding docs, including arguments and examples. I did this
only for enum types this time.

I've also included the argument type name in the Argument (e.g.
AdjustSelection).

Not sure if we should include the keybindings or not in the example?

I also added a format of some unrelated code change.
2025-01-24 15:45:54 -08:00
Mitchell Hashimoto a88e30179a
cli/list-keybinds: output chorded keybinds (#5357)
Print chorded/sequenced keybinds in `+list-keybinds`.

Recursively traverses the binding sets of sequenced keybinds and builds
a singly-linked list of triggers for each leaf. Also adapted the current
sorting criteria to work for multiple triggers per keybind.

Chorded keybinds are already output when not printing to a tty so that
code path is unchanged.

Closes #4505
2025-01-24 15:34:51 -08:00
Mitchell Hashimoto 3b108945f3
Merge branch 'main' into cleanup-action-binding-docs 2025-01-24 15:33:39 -08:00
Mitchell Hashimoto 136d6e9341
macos: autohide dock if quick terminal would conflict with it (#5361)
Fixes #5328

The dock sits above the level of the quick terminal, and the quick
terminal frame typical includes the dock. Hence, if the dock is visible
and the quick terminal would conflict with it, then part of the terminal
is obscured.

This commit makes the dock autohide if the quick terminal would conflict
with it. The autohide is disabled when the quick terminal is closed.

We can't set our window level above the dock, as this would prevent
things such as input methods from rendering properly in the quick
terminal window.

iTerm2 (the only other macOS terminal I know of that supports a dropdown
mode) frames the terminal around the dock. I think this looks less
aesthetically pleasing and I prefer autohiding the dock instead.

We can introduce a setting to change this behavior if desired later.

Additionally, this commit introduces a mechanism to safely set
app-global presentation options from multiple sources without stepping
on each other.

## Demo



https://github.com/user-attachments/assets/1f5bb945-dca4-49e7-8bcb-95b55524cfb5
2025-01-24 15:03:41 -08:00
Mitchell Hashimoto a5a73f8352
macos: autohide dock if quick terminal would conflict with it
Fixes #5328

The dock sits above the level of the quick terminal, and the quick
terminal frame typical includes the dock. Hence, if the dock is visible
and the quick terminal would conflict with it, then part of the terminal
is obscured.

This commit makes the dock autohide if the quick terminal would conflict
with it. The autohide is disabled when the quick terminal is closed.

We can't set our window level above the dock, as this would prevent
things such as input methods from rendering properly in the quick
terminal window.

iTerm2 (the only other macOS terminal I know of that supports a dropdown
mode) frames the terminal around the dock. I think this looks less
aesthetically pleasing and I prefer autohiding the dock instead.

We can introduce a setting to change this behavior if desired later.

Additionally, this commit introduces a mechanism to safely set
app-global presentation options from multiple sources without stepping
on each other.
2025-01-24 14:51:17 -08:00
Mitchell Hashimoto 4f857fc4e9
Ignore SIGPIPE (#5360)
Fixes #5359

The comments explain what's going on. Longer term we should adjust our
termio/exec to avoid the SIGPIPE but its still possible (i.e. that
thread crashes) to happen so we should be robust to it.
2025-01-24 13:53:45 -08:00
Mitchell Hashimoto f73cae0738
Ignore SIGPIPE
Fixes #5359

The comments explain what's going on. Longer term we should adjust our
termio/exec to avoid the SIGPIPE but its still possible (i.e. that
thread crashes) to happen so we should be robust to it.
2025-01-24 13:48:30 -08:00
Mitchell Hashimoto 47ff4c96e0
build: options to enable/disable terminfo & termcap install (take 2) (#5340)
Fixes #5253

Add -Demit-terminfo and -Demit-termcap build options to enable/disable
installation of source terminfo and termcap files.

Replacement for #5311
2025-01-24 13:28:48 -08:00
Mitchell Hashimoto 75d6ee539a
termio/exec: call waitpid in process exit callback (#5353)
Fixes #4554

When a process exited on its own (we didn't kill it), we were not
calling waitpid. This commit adds a waitpid call in the event loop
process exit notification.

This happened because when an external exit happened we could call
`subprocess.externalExit` which tells our subprocess manager to NOT kill
the process (since its already dead). Unfortunately in this case it
means we also didn't call waitpid.
2025-01-24 12:19:22 -08:00
Mitchell Hashimoto 9ab2e563bb
Update libxev to fix zombie processes on macOS
Fixes #4554

xev.Process.wait is documented as being equivalent to calling `waitpid`,
i.e. including reaping the process. On Linux, it does this automatically
by using pidfd and the `waitid` syscall. On macOS, it wasn't doing this.

This commit updates libxev to include a fix that explicitly calls
`waitpid` for kqueue.
2025-01-24 12:07:01 -08:00
Daniel Patterson 5ad2ec8f71 Add chorded/sequenced keybinds to +list-keybinds output 2025-01-24 19:58:15 +00:00
Mitchell Hashimoto 69dcea5148
termio/exec: if pty fd HUP, end read thread (#5351)
Fixes #4884

When our command exits, it will close the pty slave fd. This will
trigger a HUP on our poll. Previously, we only checked for IN. When a fd
is closed, IN triggers forever which would leave to an infinite loop and
100% CPU.

Now, detect the HUP and exit the read thread.
2025-01-24 09:48:56 -08:00
Mitchell Hashimoto 8475768ad1
termio/exec: if pty fd HUP, end read thread
Fixes #4884

When our command exits, it will close the pty slave fd. This will
trigger a HUP on our poll. Previously, we only checked for IN. When a fd
is closed, IN triggers forever which would leave to an infinite loop and
100% CPU.

Now, detect the HUP and exit the read thread.
2025-01-24 09:39:22 -08:00
Erlend Lind Madsen 0c5ef5578c Docs: remove type from action arguments 2025-01-24 23:13:42 +07:00
Jeffrey C. Ollie 593d70a42f
fix missing check of emit_termcap build option 2025-01-24 10:06:40 -06:00
Jeffrey C. Ollie d1969f74ac
only the cp step needs to depend on the mkdir step 2025-01-24 10:06:39 -06:00
Jeffrey C. Ollie 2f8b0dc899
build: options to enable/disable terminfo & termcap install (take 2)
Fixes #5253

Add -Demit-terminfo and -Demit-termcap build options to enable/disable
installation of source terminfo and termcap files.
2025-01-24 10:06:39 -06:00
Erlend Lind Madsen c4c2d06571 fmt 2025-01-24 15:06:47 +07:00
Erlend Lind Madsen 076bcccde4 Docs: improve doc structure for action bindings with args and examples
minor doc changes
2025-01-24 15:06:45 +07:00
Mitchell Hashimoto fd8cacaa67
Prevent fd leaks to the running shell or command (#5341)
Multiple fixes to prevent file descriptor leaks:

- libxev eventfd now uses CLOEXEC
- linux: cgroup clone now uses CLOEXEC for the cgroup fd
- termio pipe uses pipe2 with CLOEXEC
- pty master always sets CLOEXEC because the child doesn't need it
- termio exec now closes pty slave fd after fork

There still appear to be some fd leaks happening. They seem related to
GTK, they aren't things we're accessig directly. I still want to
investigate them but this at least cleans up the major sources of fd
leakage.
2025-01-23 22:21:33 -08:00
Mitchell Hashimoto 0d6a1d3fdb
Prevent fd leaks to the running shell or command
Multiple fixes to prevent file descriptor leaks:

- libxev eventfd now uses CLOEXEC
- linux: cgroup clone now uses CLOEXEC for the cgroup fd
- termio pipe uses pipe2 with CLOEXEC
- pty master always sets CLOEXEC because the child doesn't need it
- termio exec now closes pty slave fd after fork

There still appear to be some fd leaks happening. They seem related to
GTK, they aren't things we're accessig directly. I still want to
investigate them but this at least cleans up the major sources of fd
leakage.
2025-01-23 22:12:58 -08:00
Mitchell Hashimoto c0eb6985ee
Revert "build: options to enable/disable terminfo & termcap install"
This reverts commit 8f49a227b7.
2025-01-23 19:38:13 -08:00