8825 Commits

Author SHA1 Message Date
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
Bryan Lee
6fca26972b Remove the redundant check and directly use dir() 2025-01-03 00:24:14 +08:00
Bryan Lee
9f44ec7c21 Use bundle ID for macOS cache directory path 2025-01-03 00:24:14 +08:00
Bryan Lee
67794d3f6f Respect XDG_CACHE_HOME and useNSFileManager for cache paths 2025-01-03 00:24:14 +08:00
Bryan Lee
1941a440d8 Use $HOME/Library/Caches on macOS instead of $HOME/.cache 2025-01-03 00:24:14 +08:00
Mitchell Hashimoto
80c3833031 Add alt keybindings for ctrl+ins = Copy and shift+ins = Paste (#2870)
On non-MacOS desktop environments (Windows, Gnome, KDE, Xfce, VS Code,
...), `ctrl+ins` and `shift+ins` are system-wide alternate keybindings
(except for terminals) for `Copy` and `Paste` respectively. This PR
explicitly defines them as such in Ghostty's default keybindings.

Using `ctrl+ins` as an alt-keybinding for `Copy` allows
static/context-unaware remapping of `Copy` to `cmd+c` for Linux systems
using Mac keyboards via
[keyd](https://github.com/NixOS/nixpkgs/issues/137698#issuecomment-2404192700);
with the default `ctrl+shift+c` keybinding for copy this is basically
impossible (because that binding only applies to terminals).
2025-01-02 07:57:57 -08:00
Mitchell Hashimoto
9503c9fe50 Rename goto_split top/bottom directions to up/down. (#3427)
Renames the top/bottom directions of `goto_split` to up/down. I have
tested this on linux (nixos) but given that `goto_split` is broken on
linux anyway (#2866) there's not a whole lot to test.

I have no way to build on macOS so I can't verify that I've changed
everything correctly for that.

Closes #3237
2025-01-02 07:08:16 -08:00
Mitchell Hashimoto
2030599e1d Fix the format string of font size in points in the inspector (#4371)
It's an `f32` which was previously formatted with `%d`.

Credits to @gabydd who found this over at
https://discord.com/channels/1005603569187160125/1324249888514506752/1324275061380874250.
2025-01-02 07:05:04 -08:00
Mitchell Hashimoto
75571fb804 Improve resize_split documentation (#4393) 2025-01-02 07:02:33 -08:00
Mitchell Hashimoto
4047c89c24 Improve new_split documentation (#4389) 2025-01-02 07:02:23 -08:00
Mitchell Hashimoto
e55444e6fe Improve goto_split documentation (#4388)
This wasn't immediately obvious to me when configuring goto_split
2025-01-02 07:02:14 -08:00
Jade
355ac91c0a Improve resize_split documentation 2025-01-02 21:33:47 +08:00
Jade
cd809106c4 Improve new_split documentation 2025-01-02 21:05:56 +08:00
Jade
80fe32be32 Update Binding.zig 2025-01-02 20:58:50 +08:00
Jade
15ceb18fcb Improve goto_split documentation 2025-01-02 20:54:42 +08:00
Kat
78b914b3d8 Fix format string of font size in points in the inspector
Credits to @gabydd who found this over at https://discord.com/channels/1005603569187160125/1324249888514506752/1324275061380874250.

Co-authored-by:  Gabriel Dinner-David  <gabydinnerdavid@gmail.com>
2025-01-02 07:44:40 +00:00
Jeffrey C. Ollie
22c2fe9610 wuffs: use common struct to return decoded image data 2025-01-01 22:48:30 -06:00
Jeffrey C. Ollie
652079b26c wuffs: update, add jpeg decoding, add simple tests 2025-01-01 22:48:30 -06:00
Ethan Conneely
f38d1585e8 Do nothing if action not performed with flag 2025-01-02 01:14:47 +00:00
Ethan Conneely
98aa046a4d Add performable flag 2025-01-02 00:18:39 +00:00
Ethan Conneely
46097617b4 copy_to_clipboard return false if not performed 2025-01-02 00:18:05 +00:00
Mitchell Hashimoto
94599102e9 Try to create parent directory when writing default config (#4295)
Fixes https://github.com/ghostty-org/ghostty/issues/4277
2025-01-01 13:02:08 -08:00
Mitchell Hashimoto
89982912c1 Fix: typo in comment (#4257)
Fix: 'becauseonce' -> 'because once'
2025-01-01 13:01:29 -08:00
Mitchell Hashimoto
bec9483892 Adding default.nix for flake-compat (#4279)
This way non-flake users can access packages with niv or npins easily,
and as flake-compat is already a dependency, this is just a "glue".
Copy-pasted from
[here](ff81ac966b (usage)).

An example with npins would be:
`npins add github ghostty-org ghostty`

and then in the config:
```nix
{pkgs, ...}: let
    sources = import ./npins;
    ghostty = import sources.ghostty;
in {
    environment.systemPackages = [ ghostty.packages.${pkgs.system}.default ];
}
```
2025-01-01 13:01:14 -08:00
Mitchell Hashimoto
028eeb442c Fix typo in freetype-load-flags documentation (#4291) 2025-01-01 13:00:54 -08:00
Mitchell Hashimoto
f1ab7bf0f6 Don't install 1024x1024 icons for Flatpak (#4313)
Per the Flatpak spec
(https://docs.flatpak.org/en/latest/conventions.html#application-icons)
the maximum icon size is 512x512. Trying to build a Flatpak with an icon
larger than this will fail.

To solve this, installing the icon is skipped when building with
-Dflatpak=true.
2025-01-01 12:58:26 -08:00
Jeffrey C. Ollie
9ea0aa4934 core: if we change RLIMIT_NOFILE, reset it when executing commands 2025-01-01 14:31:15 -06:00
Yorick Peterse
96fd18f994 Don't install 1024x1024 icons for Flatpak
Per the Flatpak spec (https://docs.flatpak.org/en/latest/conventions.html#application-icons)
the maximum icon size is 512x512. Trying to build a Flatpak with an icon
larger than this will fail.

To solve this, installing the icon is skipped when building with
-Dflatpak=true.
2025-01-01 20:43:52 +01:00
Tim Visher
57ace2d0b8 Clarify CLI vs. Keybind Actions documentation
https://github.com/ghostty-org/ghostty/discussions/4107#discussioncomment-11699228
2025-01-01 12:34:55 -05:00
Maciej Bartczak
cdf51b1304 Try to create parent directory when writing default config 2025-01-01 18:28:26 +01:00