We were previously overwriting PS0 on every PROMPT_COMMAND. We now
append to PS0, but only if it doesn't already contain our hook.
This is also more consistent with the bash-preexec behavior we maintain
for older bash versions.
The previous logic didn't detect the `e` option when it was combined
with other flags (e.g. `-ie`). This change also attempts to improve the
general readability of this code to be a bit more explicit.
bash-preexec implements support for its "precmd" and "preexec" hooks
using a combination of PROMPT_COMMAND and a DEBUG trap. The latter is
unfortunately quick slow (in a relative sense), and the overall system
is a bit more generalized than what we need for our shell integration
(e.g. supporting multiple function hooks, subshells, etc.).
Bash 4.4 introduced the PS0 variable, which is expanded and displayed by
interactive shells after reading a complete command but before executing
it. This is all we need to implement our own shell integration hooks.
In Bash 5.1, PROMPT_COMMAND can be an array variable, each element of
which can contain a command to be executed like a string PROMPT_COMMAND
variable. When adding our hook to PROMPT_COMMAND, we preserve its type
(string or array) to be minimally intrusive. This also matches direnv's
approach.
Bash 5.3 introduced support for function substitution, which is an even
more efficient way to run code from PS0, so we use that when available.
Otherwise, we use the more traditional command substitution approach.
Earlier versions of bash (such as 3.2, which still ships with macOS)
continue to use the bash-preexec path. This gives us two code paths to
maintain, but I think that's preferable to fully maintaining our own
DEBUG trap-based system for older bash versions given that bash-preexec
has proven to work reliably in those environments. We also wouldn't
unlock any other user benefits aside from removing the bash-preexec
script dependency.
See: #3724, #7734
uses the `final` fixed point package set as the source of dependencies
for the ghostty package created by the overlay - allows simpler
overriding of dependencies when using the overlay
no AI used
updates nixpkgs and home-manager
X11 packages are now not in a shared namespace
the ZIG_GLOBAL_CACHE_DIR creation was moved to the configurePhase in the
zig hook
moves nix shell from #devShell.\<system\> to
#devshells.\<system\>.default
tested with `nix run` and `nix flake check` on x86-64_linux
no AI used
According to the [Contributors' Guides for
I18n](https://github.com/ghostty-org/ghostty/blob/main/po/README_CONTRIBUTORS.md):
> This file must stay in sync with the list of translatable strings
present in source code or Blueprints at all times. A CI action would be
run for every PR, which checks if the translation template requires any
updates.
Currently, the CI passes even if the POT file is outdated and has not
been updated for a long time. Add `set -euxo pipefail` to
`check-translations.sh` to ensure the CI fails when contributors do not
update the POT file with their changes.
Before:
```
❯ bash .github/scripts/check-translations.sh; echo "status code: $?"
po/com.mitchellh.ghostty.pot:87: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.YxAlAg28KW
po/com.mitchellh.ghostty.pot:91: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.YxAlAg28KW
po/com.mitchellh.ghostty.pot:95: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.YxAlAg28KW
po/com.mitchellh.ghostty.pot:99: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.YxAlAg28KW
po/com.mitchellh.ghostty.pot:103: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.YxAlAg28KW
po/com.mitchellh.ghostty.pot:110: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.YxAlAg28KW
po/com.mitchellh.ghostty.pot:114: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.YxAlAg28KW
po/com.mitchellh.ghostty.pot:126: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.YxAlAg28KW
po/com.mitchellh.ghostty.pot:297: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.YxAlAg28KW
po/com.mitchellh.ghostty.pot:301: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.YxAlAg28KW
po/com.mitchellh.ghostty.pot:305: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.YxAlAg28KW
msgcmp: found 11 fatal errors
status code: 0
```
After:
```
❯ bash .github/scripts/check-translations.sh; echo "status code: $?"
++ mktemp
+ old_pot=/var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
+ cp po/com.mitchellh.ghostty.pot /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
+ zig build update-translations
+ msgcmp /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR po/com.mitchellh.ghostty.pot --use-untranslated
po/com.mitchellh.ghostty.pot:87: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
po/com.mitchellh.ghostty.pot:91: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
po/com.mitchellh.ghostty.pot:95: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
po/com.mitchellh.ghostty.pot:99: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
po/com.mitchellh.ghostty.pot:103: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
po/com.mitchellh.ghostty.pot:110: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
po/com.mitchellh.ghostty.pot:114: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
po/com.mitchellh.ghostty.pot:126: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
po/com.mitchellh.ghostty.pot:297: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
po/com.mitchellh.ghostty.pot:301: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
po/com.mitchellh.ghostty.pot:305: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
msgcmp: found 11 fatal errors
status code: 1
```
PROMPT_COMMAND array support for introduced in bash 5.1, and it's the
preferred format moving forward. Using the string form is also fine, but
it's easy to be a modern bash citizen here, so let's do so.
Add `set -euxo pipefail` to `check-translations.sh` to ensure the CI
fails when contributors do not update the POT file with their changes.
Currently, the CI passes even if the POT file is outdated and the POT
has not been updated for a long time.
bash-preexec implements support for its "precmd" and "preexec" hooks
using a combination of PROMPT_COMMAND and a DEBUG trap. The latter is
unfortunately quick slow (in a relative sense), and the overall system
is a bit more generalized than what we need for our shell integration
(e.g. supporting multiple function hooks, subshells, etc.).
Bash 4.4 introduced the PS0 variable, which is expanded and displayed by
interactive shells after reading a complete command but before executing
it. This is all we need to implement our own shell integration hooks.
In Bash 5.1, PROMPT_COMMAND can be an array variable, each element of
which can contain a command to be executed like a string PROMPT_COMMAND
variable. When adding our hook to PROMPT_COMMAND, we preserve its type
(string or array) to be minimally intrusive. This also matches direnv's
approach.
Bash 5.3 introduced support for function substitution, which is an even
more efficient way to run code from PS0, so we use that when available.
Otherwise, we use the more traditional command substitution approach.
Earlier versions of bash (such as 3.2, which still ships with macOS)
continue to use the bash-preexec path. This gives us two code paths to
maintain, but I think that's preferable to fully maintaining our own
DEBUG trap-based system for older bash versions given that bash-preexec
has proven to work reliably in those environments. We also wouldn't
unlock any other user benefits aside from removing the bash-preexec
script dependency.
See: #3724, #7734
The previous logic didn't detect the `e` option when it was combined
with other flags (e.g. `-ie`). This change also attempts to improve the
general readability of this code to be a bit more explicit.
This adds the ability to use two fingers on a touchpad to scroll left or
right on a Ghostty window to change tab pages. Uses the same basic
machinery as scrolling up and down the scrollback buffer. Scrolling
pages does not wrap around at the start or end of the tabs.
When we're building an input string that's explicitly meant to be used
as a shell command, quote it using the same logic as Python's
`shlex.quote` function.
This specifically addresses issues we've seen when open(1)'ing Ghostty
with filename arguments that contain spaces.
See #2633, #3030
#### [Core Audio Tap API](https://github.com/insidegui/AudioCap)
There's a new NS permission needed for macos (>14.x) to capture system
audio with the `Core Audio Tap API`. Previously desktop-audio capture
was handled by a different permissions API with GUI & preferences. Both
APIs continue to exist but this newer one has a NS permission we should
include. The "geniuses" have spoken and this API doesn't have public
methods for querying the permissions state. As a strong side-effect of
this "feature", failures due to lack of NS permissions are likely to be
handled poorly by software makers.
---
I've spent [the last 5
days](https://github.com/electron/electron/issues/49607) reviewing
C++/Objective-C Chromium source to hone in on why my DesktopAudioCapture
broke on an electron version update. It is in-fact chromium [started
using](source.chromium.org/chromium/chromium/src/+/ad17e8f8b93d5f34891b06085d373a668918255e)
this new `Core Audio Tap API` and has no fallback to the old API if the
new one fails.
Should be your easiest code-review of the week. Shoutout to the
maintainers/creator, big fan of this Zig based terminal with good shader
support.