8697 Commits

Author SHA1 Message Date
Mitchell Hashimoto
26b1888494 apprt/gtk: move some static CSS to the style.css file (#4011) 2024-12-30 08:47:55 -08:00
Mitchell Hashimoto
1a27ce0797 bash: improved 'sudo' command wrapper (#4080)
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.
2024-12-30 08:44:47 -08:00
Mitchell Hashimoto
adcaff7137 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.
2024-12-30 08:43:59 -08:00
Mitchell Hashimoto
c2c578789b Correct comptime GTK atLeast() version comparison (#3977)
The comptime path of the GTK `atLeast()` version function fails to take
the proceeding 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).

This update required that the major versions be equal when comparing
minor versions and the major and minor versions be equal when comparing
micro versions.

For example, building against GTK 4.17.1:
Before: version.atLeast(4,16,2) -> false
After:  version.atLeast(4,16,2) -> true
2024-12-30 08:39:56 -08:00
Mitchell Hashimoto
1c2532c184 gtk: correct comptime adwaita.versionAtLeast() comparison (#4084)
Companion to #3977
2024-12-30 08:39:47 -08:00
Mitchell Hashimoto
ff50b5539e fix: quick terminal CPU spikes (#4055)
# Description

The following code is causing an infinite loop that causes a CPU spikes
until the quick terminal is displayed:

87bd0bb744/macos/Sources/Features/QuickTerminal/QuickTerminalController.swift (L314-L317)

## Reproduce steps
1. Open Ghostty.
2. Open the Quick Terminal.
3. Close the Quick Terminal.
4. Reload the configuration (Ghostty > Reload Configuration or
`shift+cmd+,`).
5. Observe CPU spike.

## Fix
Now, `syncAppearance` doesn't postpone the process until it can be
consumed, and the appearance is synchronized once the animation is done
and the quick terminal is visible.

Fixes #3998
2024-12-30 08:21:21 -08:00
Jeffrey C. Ollie
f2ac9b85e3 gtk: correct comptime adwaita.versionAtLeast() comparison 2024-12-30 09:52:21 -06:00
Damien Mehala
011c17da41 fix: quick terminal CPU spikes
Fixes #3998
2024-12-30 07:24:35 -08:00
Mitchell Hashimoto
da186fb9df bash: remove "request for experts" comment (#4081)
We now have a multiple folks who have pitched in to improve this script.
2024-12-30 07:22:25 -08:00
Jon Parise
0dc3ea35c0 bash: remove "request for experts" comment
We now have a multiple folks who have pitched in to improve this script.
2024-12-30 10:19:55 -05:00
Jon Parise
4e7982fc2b 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.
2024-12-30 10:15:04 -05:00
Iain H
4f2110bce0 Be more idiomatic in tests when comparing to booleans 2024-12-30 08:25:03 -06:00
Mitchell Hashimoto
89e5ca2fb4 macos: add generated Nvim files to app bundle (#4031)
resolves #3966

<img width="689" alt="image"
src="https://github.com/user-attachments/assets/a969e1ee-2302-44cf-857d-f71345d4840b"
/>
2024-12-30 06:23:44 -08:00
Maciej Bartczak
d01b2397f1 fish: handle short boolean flags 2024-12-30 10:39:43 +01:00
Maciej Bartczak
aed61b62ae zsh: handle short boolean flags 2024-12-30 10:29:28 +01:00
Leigh Oliver
e9bc033b88 fix(gtk): fix issue detecting preferred color scheme 2024-12-30 09:17:46 +00:00
Bryan Lee
c011c4622d macos: add generated Nvim files to app bundle 2024-12-30 17:01:48 +08:00
Tristan Partin
057dd3e209 apprt/gtk: move some static CSS to the style.css file
Signed-off-by: Tristan Partin <tristan@partin.io>
2024-12-29 23:51:29 -06:00
Mitchell Hashimoto
87bd0bb744 gtk: Install 1024x1024 icon (#4003)
Fixes #3967

Include the 1024x1024 icon in the files installed by `build.zig` when
building the package for Linux with the GTK app runtime.
2024-12-29 21:18:41 -08:00
Arvin Verain
cfeed2b7a2 gtk: Install 1024x1024 icon 2024-12-30 13:05:57 +08:00
Mitchell Hashimoto
d2d6f8b9f4 apprt/gtk: make window-decoration=false with gtk-titlebar=true look better (#3999)
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.
2024-12-29 21:01:01 -08:00
Tristan Partin
31c9a2fe59 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>
2024-12-29 22:57:48 -06:00
moni-dz
4d983a2083 surface: don't issue mode 2031 DSR reports when colors are changed by a VT sequence 2024-12-30 12:33:05 +08:00
Tristan Partin
0fd65035c5 apprt/gtk: fix the combination of gtk-titlebar=false and gtk-tabs-location=hidden
Fixes: #3178
Signed-off-by: Tristan Partin <tristan@partin.io>
2024-12-29 22:12:37 -06:00
Mitchell Hashimoto
3059d9036b macos: Help menu goes to website docs (#3990) 2024-12-29 19:32:13 -08:00
Mitchell Hashimoto
37c5f5a123 macos: Help menu goes to website docs 2024-12-29 19:27:22 -08:00
Mitchell Hashimoto
35eefd4240 Add back quotes for variables in the zsh shell integration to improve compatibility (#3989)
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.
2024-12-29 19:26:09 -08:00
Caleb Norton
8607b1f844 macos: correctly save terminal fullscreen style 2024-12-29 21:24:48 -06:00
XiaoYan Li
a9c1a5c73c 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.
2024-12-30 11:24:39 +08:00
Mitchell Hashimoto
06389b280a macos: restore 0 blur-radius when reloading config (#3954)
If a blur radius config value was previously set but then removed or set
to 0, the new blur radius would not take effect on config reload due to
the early return clause.
2024-12-29 19:17:25 -08:00
Mitchell Hashimoto
cb96ce5dcc apprt/gtk: fix website link in about window (#3958) 2024-12-29 19:17:11 -08:00
Iain H
936d0c0d58 Add unit tests 2024-12-29 21:01:18 -06:00
Tristan Partin
7256ebe13d apprt/gtk: fix website link in about window 2024-12-29 16:47:44 -06:00
Caleb Norton
479e735e7f macos: restore 0 blur-radius when reloading config 2024-12-29 16:25:30 -06:00
Iain H
b3290f6887 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
2024-12-29 16:20:20 -06:00
Mitchell Hashimoto
d5703a57e7 Allow startup with $HOME read-only (#3949)
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.
2024-12-29 14:05:15 -08:00
Mitchell Hashimoto
84a03aa202 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.
2024-12-29 13:59:39 -08:00
Mitchell Hashimoto
b3925b83ae note source tarball name for 1.0.0 2024-12-29 13:39:11 -08:00
Mitchell Hashimoto
5698358c2f apprt/gtk: style the tab overview when window-theme=ghostty (#3920)
This requires libadwaita main (to be 1.8).

Signed-off-by: Tristan Partin <tristan@partin.io>


https://github.com/user-attachments/assets/057abec5-f85b-4fbb-980c-c58a20e7ddc7
2024-12-29 13:30:44 -08:00
Mitchell Hashimoto
ff6e60be56 Fix typo in list-themes browser (#3919)
This is a small PR to fix a tiny continuity typo I noticed in the
list-themes viewer.

#### Before and After


![image](https://github.com/user-attachments/assets/c95b23bb-01ad-4e82-8f9b-0b8559d006ba)
2024-12-29 13:29:41 -08:00
Mitchell Hashimoto
db0da9a273 Fix typo in config reference: window-decorations -> window-decoration (#3930)
I made the same PR to the autogenerated reference here:
https://github.com/ghostty-org/website/pull/168.
2024-12-29 13:28:44 -08:00
Mitchell Hashimoto
31ee48a355 apprt/gtk: create the tab overview even if gtk-titlebar=false (#3940)
self.isAdwWindow() obscures that check a bit.
2024-12-29 13:27:11 -08:00
Mitchell Hashimoto
b7dba0c5f5 macos: disable auto-updates for local builds (#3943)
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/

(This is a safer alternative to #3273.)

Fixes: #3179
2024-12-29 13:26:35 -08:00
Mitchell Hashimoto
3b8a0ed2b8 CI: Update release-tag.yml to include the version in the source archive and prefix within (#3490)
Continuing from #3043 I agree that it seems idiomatic to have an archive
with format <name>-<version>.tar.gz and matching prefix for packaging,
RPM and Debian packaging guides seem to assume this format and the
automated extract tooling assumes it too.

# Testing
I haven't tested running this workflow, and am unsure about the yaml
substitution at lines 105-106

# Breaking changes
This would break existing packaging scripts, not sure how we want to
version it
2024-12-29 13:25:28 -08:00
Mitchell Hashimoto
9c15d8de35 ci: keep old source tarballs as well 2024-12-29 13:24:28 -08:00
Jon Parise
074edd3065 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/
2024-12-29 15:48:59 -05:00
Tristan Partin
27ddc2a9b2 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>
2024-12-29 14:45:45 -06:00
521337
7881bb2bf0 Fix typo in config reference: window-decorations -> window-decoration 2024-12-29 20:07:36 +01:00
Tristan Partin
c20fe23946 apprt/gtk: use CSS variables to deduplicate code
Signed-off-by: Tristan Partin <tristan@partin.io>
2024-12-29 12:11:26 -06:00
Tristan Partin
2e048c870c 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>
2024-12-29 12:11:13 -06:00