8855 Commits

Author SHA1 Message Date
Mitchell Hashimoto
8c74b80704 config: Add the option toast_on_clipboard_copy (#4185)
Add a config option to enable/disable the toast shown on clipboard copy

Also suggested in
https://github.com/ghostty-org/ghostty/discussions/4165
2025-01-02 14:31:13 -08:00
Mitchell Hashimoto
509cf306f5 config: improve documentation for color configuration (#4184)
The documentation used to say e.g. "The format of the color is the same
as the `background` configuration; see that for more information.", yet
`background` left the format actually undocumented.

To avoid people having to jump around the docs to find out the supported
formats, the prose for the formats is repeated for each color.

I dug around a bit to find out that named colors from the default X11
map are also a supported format (`cursor-color = purple` works fine), so
that's now documented too.
2025-01-02 14:23:09 -08:00
Mitchell Hashimoto
fb8c83e07c config: change toast config to packed struct 2025-01-02 14:15:16 -08:00
Mitchell Hashimoto
d28024bb60 Clarify CLI vs. Keybind Actions documentation (#4116)
https://github.com/ghostty-org/ghostty/discussions/4107#discussioncomment-11699228

I was confused about not being able to run `ghostty +new_window` since I
hadn't read the docs closely enough to understand the distinction
between Keybind Actions and CLI Actions.

I think if the error messages I've modified here would have read this
way to begin with I would've had a better chance of discovering this
distinction on my own.

I did read the Contributing guidelines but I avoided opening an Issue
since the changes here are minimal enough that I felt it would just add
noise. If that's a mistake then I'm happy to close this out and return
to the original discussion and/or create a new Issue.
2025-01-02 14:10:23 -08:00
Yotam Gurfinkel
e6bb1a56eb config: Add the option toast_on_clipboard_copy
Add a config option to enable/disable the toast shown on clipboard copy
2025-01-02 14:09:29 -08:00
Mitchell Hashimoto
5293e8a819 Merge branch 'patch-1' 2025-01-02 14:06:41 -08:00
Mitchell Hashimoto
bed37ac844 update wording 2025-01-02 14:06:23 -08:00
Mitchell Hashimoto
e7354e7308 Update src/config/Config.zig
Co-authored-by: Aarni Koskela <akx@iki.fi>
2025-01-02 14:05:49 -08:00
Mitchell Hashimoto
18001c3251 font: allow non-boolean font feature settings (#4139)
\+ much more flexible syntax and lenient parser
\+ allows comma-separated list as a single config value

This allows, e.g. `cv01 = 2` to select the second variant of `cv01`.

Resolves #3128 

Parser could probably be a little smaller than it is- would be a lot
cleaner with the labeled switch continue pattern from Zig 0.14. Maybe
should've put it in its own file too...

I spent *much* too long trying to test this with `cv01` with
[monaspace](https://github.com/githubnext/monaspace) before realizing
that the README refers to v1.2 but the latest released version (and
hence the one I had installed) was v1.101 -- I installed the v1.2
version and tested with both CoreText and HarfBuzz and successfully set
`cv01 = 2` and got the expected result.

Feel free to make any stylistic changes you feel necessary before
merging.
2025-01-02 14:04:20 -08:00
Mitchell Hashimoto
3a01beb050 Don't steal focus on mouse events that are within 1 px (#3997)
Fixes #3229


Gets the desired behavior for #3229, I'm unsure if there is a nicer way
to omit the mouse motion events from the event controller
when the glarea is resized due to the splitting behavior. Thresholding
to 1px is required because just checking for equality results
in the focus still being stolen sometimes. This is kinda of a hack so a
nicer solution would be much appreciated!
2025-01-02 14:01:27 -08:00
Mitchell Hashimoto
fc545cd048 fix: handle intermediate bytes in CSI and ESC sequences (#4063)
This adds missing handling for CSI and ESC commands.

Fixes: https://github.com/ghostty-org/ghostty/issues/3122

Supersedes: #3132
2025-01-02 13:53:19 -08:00
Mitchell Hashimoto
f5f887efd9 fix: selected text remains after clear_screen action (#4040)
Fixes #3414
2025-01-02 13:50:09 -08:00
Mitchell Hashimoto
1a530cb96a core: add build option to disable sentry (#3934)
This disables compiling/linking Sentry automatically on platforms other
than macOS, which removes a potential blocker for getting Ghostty
running on *BSD or other systems.

This is also useful for the security paranoid that don't want any chance
that sensitive information could be captured in a crash dump.
2025-01-02 13:49:54 -08:00
Matt Rochford
6a4842f110 Don't steal focus on mouse events that are within 1 px 2025-01-02 13:46:15 -08:00
Mitchell Hashimoto
f60068eabd add option to strip build regardless of optimization (#3945)
adds the option "strip" which can be used to override the default strip
setting, which is based on the optimization mode.

Useful for a distro setting where you want a release build but still
keep symbols.

Also reuses the option for the shared and static library
2025-01-02 13:41:47 -08:00
Mitchell Hashimoto
7eb6b29d4c macos: make auto-update optional (#4436)
When unset, we use Sparkle's default behavior, which is based on the
user's preference stored in the standard user defaults.

The rest of the previous behavior is preserved:
- When SUEnableAutomaticChecks is explicitly false, auto-updates are
disabled.
- When 'auto-update' is set, use its value to set Sparkle's auto-update
behavior.

Fixes #4433
2025-01-02 13:38:15 -08:00
Mitchell Hashimoto
0d2a6c7346 gtk: refactor gtk & adw notebook implementations (#3578)
Put GTK and libadwaita notebook implementations into separate structs/
files for clarity.
2025-01-02 13:37:29 -08:00
Mitchell Hashimoto
898d988799 Set an initial start position (#3929)
Allow the ability to set an initial start position from the config. Adds
`window-initial-position-{x,y}` to the config as an optional i16 value
(see swift docs in [this
comment](https://github.com/ghostty-org/ghostty/pull/3929#discussion_r1899266607)
for the reasoning behind this if needed) and handles setting the
position when the initial window is created

Closes https://github.com/ghostty-org/ghostty/issues/3362
2025-01-02 13:35:13 -08:00
Mitchell Hashimoto
7a5ef3da2b remove sentry test for macOS, remove windows check 2025-01-02 13:34:23 -08:00
Jeffrey C. Ollie
cb8d30f938 core: add build option to disable sentry 2025-01-02 13:32:45 -08:00
Jeffrey C. Ollie
0778c67429 gtk: refactor gtk & adw notebook implementations
Put GTK and libadwaita notebook implementations into separate structs/
files for clarity.
2025-01-02 15:21:11 -06:00
Mitchell Hashimoto
29b96be84f tweaks to window position 2025-01-02 13:18:53 -08:00
Mitchell Hashimoto
e634eb102e feat: expand tildes ~ in config file paths to HOME (#3811)
Fixes https://github.com/ghostty-org/ghostty/issues/3328
2025-01-02 13:11:09 -08:00
Adam Wolf
f49a029c49 Merge branch 'ghostty-org:main' into InitialStartPosition 2025-01-02 12:58:40 -08:00
Adam Wolf
f9250e28b5 chore: rename window-position-{x,y} to window-initial-position-{x,y} 2025-01-02 12:58:40 -08:00
Adam Wolf
16bf3b8820 docs: update config docs to reflect window positioning changes 2025-01-02 12:58:40 -08:00
Adam Wolf
200d0d642b macos: handle setting initial window position when window is created 2025-01-02 12:58:40 -08:00
Adam Wolf
970e45559b apprt/glfw: handle setting initial window position when window is
created
2025-01-02 12:58:40 -08:00
Adam Wolf
13d935a401 revert: renaming of window-position-{x,y} 2025-01-02 12:58:40 -08:00
Adam Wolf
a7e3e5915c docs: fix spelling of macOS 2025-01-02 12:58:40 -08:00
Adam Wolf
568f1f9d72 chore: removed setInitialWindowPosition from gtk and renamed window-position-{x,y} to start-position-{x,y} for clarity 2025-01-02 12:58:40 -08:00
Adam Wolf
7195bda7a2 chore: add missing case in switch statement 2025-01-02 12:58:40 -08:00
Adam Wolf
9a58de6d5a feat(macos): allow setting an intial start position 2025-01-02 12:58:40 -08:00
Adam Wolf
5ced72498e feat(linux): allow setting an intial start position 2025-01-02 12:58:40 -08:00
Mitchell Hashimoto
d58b618c74 config: windows can't expand homedir (yet) 2025-01-02 12:55:47 -08:00
Jon Parise
713dd24ab9 macos: make auto-update optional
When unset, we use Sparkle's default behavior, which is based on the
user's preference stored in the standard user defaults.

The rest of the previous behavior is preserved:
- When SUEnableAutomaticChecks is explicitly false, auto-updates are
  disabled.
- When 'auto-update' is set, use its value to set Sparkle's auto-update
  behavior.
2025-01-02 15:53:01 -05:00
Mitchell Hashimoto
a94cf4b3a2 config: make diagnostic if homedir expansion fails 2025-01-02 12:44:03 -08:00
Mitchell Hashimoto
600e417154 Restore hidden titlebar after fullscreen (#3572)
This fixes https://github.com/ghostty-org/ghostty/issues/3535 .

There exists an issue in ghostty on mac where if you have hidden your
titlebar, then enter fullscreen, the titlebar will reappear after
exiting fullscreen.

The reason for this is that after exiting fullscreen macos reapplies
some styling on the new window created after exiting fullscreen. To
combat this we will reapply the styling to hide the titlebar after
exiting fullscreen.

Required config:
```
macos-titlebar-style = hidden
macos-non-native-fullscreen = true
```

Steps to reproduce:

- Open Ghostty
- Enter fullscreen (non-native)
- Exit fullscreen

On main you will see the titlebar reappearing after exiting fullscreen,
while that does not happen with this patch.
2025-01-02 12:40:11 -08:00
z-jxy
7bd842a530 add test for expandHomeUnix 2025-01-02 12:33:34 -08:00
z-jxy
5ae2cc01ac move current expandHome functionality into separate expandHomeUnix function 2025-01-02 12:33:34 -08:00
z-jxy
138a8f1602 move tilde expansion functionality to os/homedir 2025-01-02 12:33:34 -08:00
z-jxy
d27761a499 use home() from os/homedir, check for ~/ rather than ~ 2025-01-02 12:33:34 -08:00
z-jxy
7c9c982df7 refactor: handle tilde before checking realpath 2025-01-02 12:33:34 -08:00
z-jxy
f184258f0e expand tilde to HOME in config 2025-01-02 12:33:34 -08:00
Christoffer Tønnessen
88674a1957 Restore hidden titlebar after fullscreen
This fixes https://github.com/ghostty-org/ghostty/issues/3535 .

There exists an issue in ghostty on mac where if you have hidden your
titlebar, then enter fullscreen, the titlebar will reappear after
exiting fullscreen.

The reason for this is that after exiting fullscreen macos reapplies
some styling on the new window created after exiting fullscreen. To
combat this we will reapply the styling to hide the titlebar after
exiting fullscreen.

Required config:
```
macos-titlebar-style = hidden
macos-non-native-fullscreen = true
```

Steps to reproduce:

- Open Ghostty
- Enter fullscreen (non-native)
- Exit fullscreen

On main you will see the titlebar reappearing after exiting fullscreen,
while that does not happen with this patch.
2025-01-02 12:25:02 -08:00
Mitchell Hashimoto
b68e9a10e0 gtk: Always read gtk-xft-dpi for font scaling (#4424)
Commit ad503b8c4fa7 ("linux: consider Xft.dpi to scale the content")
introduced reading gtk-xft-dpi when the X11 build option is enabled.

While the name suggests it is X11-specific (perhaps it was at one
point), gtk-xft-dpi is a GTK setting that can be modified regardless of
GDK backend. GNOME’s Large Text accessibility setting ultimately
modifies it. Outside of desktop environments, it can be set via GTK
configuration files.

Remove the conditional gating the code on X11, since none of the code is
actually X11-specific. While we’re here, document scaling behaviors
under Config.font-size.

Fixes: ad503b8c4fa7 ("linux: consider Xft.dpi to scale the content")
Fixes: https://github.com/ghostty-org/ghostty/issues/4338
Link: https://docs.gtk.org/gtk4/class.Settings.html
Link: https://docs.gtk.org/gtk4/property.Settings.gtk-xft-dpi.html
2025-01-02 12:10:24 -08:00
Mitchell Hashimoto
afdaaf1825 Use platform-specific cache paths and respect XDG_CACHE_HOME (#3458)
## Description:

Use proper platform-specific methods to determine cache directory paths:

1. First check `XDG_CACHE_HOME` environment variable

2. On macOS:

- Use `NSFileManager.URLForDirectory` to get system cache path
(`~/Library/Caches`)
   
- Use bundle ID (`com.mitchellh.ghostty`) as base directory to follow
macOS conventions
   
3. Fall back to XDG spec defaults for other platforms (`~/.cache`)

## Changes:

- Extract common NSFileManager path lookup logic into `makeCommonPath`
helper

- Use `NSFileManager.URLForDirectory` to get proper macOS cache
directory

- Use bundle ID for macOS cache directory to match system conventions
and `appSupportDir` behavior

- Follows the [same pattern as our configuration file
path](https://ghostty.org/docs/config#macos-specific-path-(macos-only):)
(`~/Library/Application Support/com.mitchellh.ghostty/config`)
  
- Aligns with `appSupportDir` implementation which already uses bundle
ID

- Add tests to verify path construction for different platforms

## Questions for reviewers:

1. Should we add migration logic for existing cache files?

2. Or should we document this as a breaking change and let users
manually clean up?

## Testing:

1. Added unit tests for path construction:

   - macOS: verifies `~/Library/Caches/com.mitchellh.ghostty` path
   
   - Linux: verifies `~/.cache/ghostty` path (XDG spec)
   
2. Verified tests pass with `zig build test`

Fixes #3202
2025-01-02 12:06:12 -08:00
Mitchell Hashimoto
57af5f3106 crash: prefer XDG cache dir if available 2025-01-02 11:50:22 -08:00
Liam Hupfer
aa34b91856 gtk: Always read gtk-xft-dpi for font scaling
Commit ad503b8c4fa7 ("linux: consider Xft.dpi to scale the content")
introduced reading gtk-xft-dpi when the X11 build option is enabled.

While the name suggests it is X11-specific (perhaps it was at one
point), gtk-xft-dpi is a GTK setting that can be modified regardless of
GDK backend. GNOME’s Large Text accessibility setting ultimately
modifies it. Outside of desktop environments, it can be set via GTK
configuration files.

Remove the conditional gating the code on X11, since none of the code is
actually X11-specific. While we’re here, document scaling behaviors
under Config.font-size.

Fixes: ad503b8c4fa7 ("linux: consider Xft.dpi to scale the content")
Fixes: https://github.com/ghostty-org/ghostty/issues/4338
Link: https://docs.gtk.org/gtk4/class.Settings.html
Link: https://docs.gtk.org/gtk4/property.Settings.gtk-xft-dpi.html
2025-01-02 12:48:28 -06:00
Nhan Luu
0c10db9f14 chore: fix typos 2025-01-02 23:41:57 +07:00