8590 Commits

Author SHA1 Message Date
Leigh Oliver
8129ce4244 fix(gtk): fix issue detecting preferred color scheme 2025-01-01 13:55:22 -05:00
Bryan Lee
bd3c4ad4e8 Add pin order assertion in Pin.pageIterator 2025-01-01 13:55:22 -05:00
Bryan Lee
995bc54639 Ensure correct coordinate ordering in selection file write
When writing selected text to file, use `topLeft` and `bottomRight` instead of
`start` and `end` to ensure correct coordinate ordering. This fixes an issue
where selection files could be empty when selecting text in reverse order.

- Use `terminal.Selection.topLeft()` for start coordinate
- Use `terminal.Selection.bottomRight()` for end coordinate
2025-01-01 13:55:22 -05:00
Caleb Norton
2584468276 macos: correctly save terminal fullscreen style 2025-01-01 13:55:22 -05:00
Tristan Partin
2ba929acac apprt/gtk: fix the combination of gtk-titlebar=false and gtk-tabs-location=hidden
Fixes: #3178
Signed-off-by: Tristan Partin <tristan@partin.io>
2025-01-01 13:55:22 -05:00
Mitchell Hashimoto
6432ba5f3b config: edit opens AppSupport over XDG on macOS, prefers non-empty paths
Fixes #3953
Fixes #3284

This fixes two issues. In fixing one issue, the other became apparent so
I fixed both in this one commit.

The first issue is that on macOS, the `open` command should take the
`-t` flag to open text files in a text editor. To do this, the `os.open`
function now takes a type hint that is used to better do the right
thing.

Second, the order of the paths that we attempt to open when editing a
config on macOS is wrong. Our priority when loading configs is well documented:
https://ghostty.org/docs/config#macos-specific-path-(macos-only). But
open_config does the opposite. This makes it too easy for people to have
configs that are being overridden without them realizing it.

This commit changes the order of the paths to match the documented
order. If neither path exists, we prefer AppSupport.
2025-01-01 13:55:22 -05:00
Tim Culverhouse
50b3edfb73 surface: handle hyperlinks more reliably
We refresh the link hover state in two (generic) cases

1. When the modifiers change
2. When the cursor changes position

Each of these have additional state qualifiers. Modify the qualifiers
such that we refresh links under the following scenarios:

1. Modifiers change
  - Control is pressed (this is handled in the renderer)
  - Mouse reporting is off
    OR
    Mouse reporting is on AND shift is pressed AND we are NOT reporting
    shift to the terminal

2. Cursor changes position
  - Control is pressed (this is handled in the renderer)
  - We previously were over a link
  - The position changed (or we had no previous position)
  - Mouse reporting is off
    OR
    Mouse reporting is on AND shift is pressed AND we are NOT reporting
    shift to the terminal

This fixes a few issues with the previous implementation:

1. If mouse reporting was on and you were over a link, pressing ctrl
   would enable link hover state. If you moved your mouse, you would
   exit that state. The logic in the keyCallback and the
   cursorPosCallback was not the same. Now, they both check for the same
   set of conditions
2. If mouse reporting was off, you could hold control and move the mouse
   to discover links. If mouse reporting was on, holding control + shift
   would not allow you to discover links. You had to be hovering one
   when you pressed the modifiers. Previously, we only refreshed links
   if we *weren't* reporting the mouse event. Now, we refresh links even
   even if we report a mouse event (ie a mouse motion event with the
   shift modifier pressed *will* hover links and also report events)
2025-01-01 13:55:22 -05:00
Tristan Partin
63949d97cb apprt/gtk: move some static CSS to the style.css file
Signed-off-by: Tristan Partin <tristan@partin.io>
2025-01-01 13:55:22 -05:00
Jon Parise
1ad48ee8a0 bash: improved 'sudo' command wrapper
The previous approach to wrapping `sudo` had a few shortcomings:

1. We were (re)defining our 'sudo' function wrapper in the "precmd"
   path. It only needs to be defined once in the shell session.
2. If there was an existing 'sudo' alias, the function definition would
   conflict and result in a syntax error.

Fix (1) by hoisting the 'sudo' function into global scope. I also
considered only defining our wrapper if an executable `sudo` binary
could be found (e.g. `-x $(builtin command -v sudo)`, but let's keep the
existing behavior for now. This allows for a `sudo` command to be
installed later in the shell session and still be wrapped.

Address (2) by defining the wrapper function using `function sudo`
(instead of `sudo()`) syntax. An explicit function definition won't
clash with an existing 'sudo' alias, although the alias will continue to
take precedence (i.e. our wrapper won't be called). If the alias is
defined _after_ our 'sudo' function is defined, our function will call
the aliased command.

This ordering is relevant because it can result in different behaviors
depending on when a user defines their aliases relative to sourcing the
shell integration script. Our recommendation remains that users either
use automatic shell injection or manually source the shell integration
script _before_ other things in their `.bashrc`, so that aligns with the
expected behavior of the 'sudo' wrapper with regard to aliases. Given
that, I don't think we need any more explicit user-facing documentation
on this beyond the script-level comments.
2025-01-01 13:55:22 -05:00
Iain H
3af13f3b89 Be more idiomatic in tests when comparing to booleans 2025-01-01 13:55:22 -05:00
Iain H
8bb9e5a753 Add unit tests 2025-01-01 13:55:22 -05:00
Iain H
a5414cb65a Correct the comptime GTK atLeast() function
The comptime path of the GTK `atLeast()` version function fails to take
the preceeding portion of the version into account. For example version
5.1.0 is incorrectly marked as less than 4.16.7 due to the minor version
(1) being less than the minor we are comparing against (16).

For example, building against GTK 4.17.1:
Before: version.atLeast(4,16,2) -> false
After:  version.atLeast(4,16,2) -> true
2025-01-01 13:55:22 -05:00
Jeffrey C. Ollie
de0fa9af24 gtk: correct comptime adwaita.versionAtLeast() comparison 2025-01-01 13:55:22 -05:00
Damien Mehala
1697853245 fix: quick terminal CPU spikes
Fixes #3998
2025-01-01 13:55:22 -05:00
Jon Parise
46a232d209 bash: remove "request for experts" comment
We now have a multiple folks who have pitched in to improve this script.
2025-01-01 13:55:22 -05:00
Bryan Lee
129fd4d871 macos: add generated Nvim files to app bundle 2025-01-01 13:55:22 -05:00
Arvin Verain
14f67b3f9d gtk: Install 1024x1024 icon 2025-01-01 13:55:22 -05:00
Tristan Partin
9eceee5446 apprt/gtk: make window-decoration=false with gtk-titlebar=true look better
Before this change, there seemed to be some artifacting in the window
corners due to the window border no longer outlining the content
properly. By detecting the situation, we can turn the window border
radius off.

Signed-off-by: Tristan Partin <tristan@partin.io>
2025-01-01 13:55:22 -05:00
Mitchell Hashimoto
27ffe4bd8f macos: Help menu goes to website docs 2025-01-01 13:55:22 -05:00
XiaoYan Li
9c47b8a6fd Add back quotes for variables in the zsh shell integration to improve compatibility
https://github.com/ghostty-org/ghostty/pull/3332#issuecomment-2564526118
According to this comment, using variables without quoting may not work with `setopt SH_WORD_SPLIT`.

We don't need to quote variables in `[[ ]]` because it works differently.
2025-01-01 13:55:22 -05:00
Caleb Norton
7680460ab5 macos: restore 0 blur-radius when reloading config 2025-01-01 13:55:22 -05:00
Tristan Partin
f2a02c229f apprt/gtk: fix website link in about window 2025-01-01 13:55:22 -05:00
Mitchell Hashimoto
e14cbdf8f9 Allow startup without $HOME writable
Fixes #3202

Two changes to get here:

1. Do not fail startup if crash reporting initialization fails. This is a
   non-critical feature and should not prevent the terminal from starting.

2. Avoid freeing Sentry transport on error path. This segfaults.
   Upstream issue will be reported separately.
2025-01-01 13:55:22 -05:00
Mitchell Hashimoto
e51065367c note source tarball name for 1.0.0 2025-01-01 13:55:22 -05:00
Tristan Partin
192a527e98 apprt/gtk: use CSS variables to deduplicate code
Signed-off-by: Tristan Partin <tristan@partin.io>
2025-01-01 13:55:22 -05:00
Tristan Partin
acfd503f1c apprt/gtk: style the tab overview when window-theme=ghostty
This requires libadwaita main (to be 1.8).

Signed-off-by: Tristan Partin <tristan@partin.io>
2025-01-01 13:55:22 -05:00
GoProSlowYo
59ec2338f2 Fix typo in list-themes browser
Signed-off-by: GoProSlowYo <68455785+goproslowyo@users.noreply.github.com>
2025-01-01 13:55:22 -05:00
521337
25beb650b3 Fix typo in config reference: window-decorations -> window-decoration 2025-01-01 13:55:22 -05:00
Tristan Partin
46c6c3e086 apprt/gtk: create the tab overview even if gtk-titlebar=false
self.isAdwWindow() obscures that check a bit.

Signed-off-by: Tristan Partin <tristan@partin.io>
2025-01-01 13:55:22 -05:00
Jon Parise
fad04ba178 macos: disable auto-updates for local builds
The auto-update prompt isn't useful for local (source) builds. Disable
it by default by setting Sparkle's SUEnableAutomaticChecks Info.plist
key to NO (false) for all build configurations.

We then selectively re-enable it by deleting that Info.plist key from
our release workflows. We delete the key instead of setting its value to
YES (true) to give us Sparkle's default behavior of prompting the user
to enable update checks on the second application launch. (YES tells
Sparkle to skip that prompt and silently enable update checks.)

See also: https://sparkle-project.org/documentation/customization/
2025-01-01 13:55:22 -05:00
Mitchell Hashimoto
375328c633 ci: keep old source tarballs as well 2025-01-01 13:55:22 -05:00
Anthony
4094eee3ab Use github yaml substitution for yaml element 2025-01-01 13:55:22 -05:00
Anthony
379f373b9a CI: Update release-tag.yml to include the version in the source archive name and prefix 2025-01-01 13:55:22 -05:00
Mitchell Hashimoto
217f35ebeb Revert "macos: disable auto-updates for local (source) builds (#3273)"
This reverts commit b39850fd8b463f78c6fb450cd7a59e43bdf4b622, reversing
changes made to 64ea3a1a29677ca5f094f8058c40c549bb741bc5.
2025-01-01 13:55:22 -05:00
Jon Parise
692322d9b8 macos: disable Sparkle checks in Debug and Release
This approach uses Xcode's Info.plist preprocessing to conditionally set
`SUEnableAutomaticChecks=false` for the Debug and Release build schemes.
It is unset for the ReleaseLocal scheme.

When this Info.plist key is explicitly set to false (as it is for these
build schemes), we disable auto-updates at runtime. Otherwise, we apply
the behavior defined by our "auto-update" configuration.
2025-01-01 13:55:22 -05:00
Jon Parise
821a8f00c5 macos: disable auto-updates for local (source) builds
The auto-update prompt isn't useful for local (source) builds so disable
both update checks and automatic downloads.

There are multiple ways we could check if we've been built for source,
but the easiest and least intrusive approach is to check the value of
the 'GhosttyCommit' Info.plist key. Because it is only set as part of
the release build process, an empty key implies that we've been build
from source.
2025-01-01 13:55:22 -05:00
Gregory Anders
f9c9a80493 renderer: track if fg/bg/cursor color is explicitly set by an OSC
The renderer must track if the foreground, background, and cursor colors
are explicitly set by an OSC so that changes are not overridden when the
config file is reloaded.
2025-01-01 13:55:22 -05:00
Anund
0144d29813 testing: point Command.zig at ~more universal external binaries
The `Command.zig` tests reach outside the local source tree and look for
files on the host os machine. This introduces some portability issues
for the tests.

The nix build sandbox doesn't include `/usr/bin/env` making it error out
when `zig build test` runs `Command.zig` tests as part of a `nix build`.
Current ci and local development relies on `nix develop` sharing a host os
file system that includes `/usr/bin/env`.

Turns out `/tmp` and `/bin/sh` are available in the build sandbox in
nix so we swap these in to enable nixpkg builds to include testing
ghostty as part of any update cycle.
2025-01-01 13:55:22 -05:00
Anund
6877b1a894 testing: move cleanup of execveZ into the test code 2025-01-01 13:55:22 -05:00
Anund
ae443ae1bd testing: handle execveZ failing during test execution
Duplicating a test process via fork does unexepected things.
zig build test will hang
A test binary created via -Demit-test-exe will run 2 copies of the test suite
2025-01-01 13:55:22 -05:00
Mitchell Hashimoto
b976b10372 config: add title_report (default false) to configure CSI 21 t 2025-01-01 13:55:22 -05:00
Adam Wolf
bb3de9008d fix: scrollback limit not being parsed correctly 2025-01-01 13:55:22 -05:00
Maciej Bartczak
34e5f55165 Invalidate the timer when the surface is destroyed 2025-01-01 13:55:22 -05:00
Maciej Bartczak
e5bbd14295 Add delay before updating the title 2025-01-01 13:55:22 -05:00
Misaki Kasumi
73a4f0a1fd misc: add desktop entry fields to support xdg-terminal-exec 2025-01-01 13:55:22 -05:00
Sebastian Estrella
b93bc6be5b Add default Nix overlay 2025-01-01 13:55:22 -05:00
Richard Feldman
2faf08976d Fix markdown formatting for (blank) in docs
It currently has two backticks side by side, which end up rendering as actual backticks rather than a code-formatted blank space.
2025-01-01 13:55:22 -05:00
hustcer
9e1e2ab282 chore: Add milestone workflow to add milestone to merged PR and fixed Issues 2025-01-01 13:55:22 -05:00
Jeffrey C. Ollie
b55574afbd gtk/x11: link directly to libX11, no more dlopen 2025-01-01 13:55:22 -05:00
Tristan Partin
85609be719 apprt: add window-titlebar-{background,foreground} config options
This gives people finer-grained control over the coloring of their
window titlebars. Currently only implemented for GTK.

Signed-off-by: Tristan Partin <tristan@partin.io>
2025-01-01 13:55:22 -05:00