9274 Commits

Author SHA1 Message Date
Anund
168dd31367 documentation: consistent format for actions help 2025-01-23 15:58:33 -08:00
Mitchell Hashimoto
148a009a95 config: rename adw-toasts to app-notifications (#5332)
There is no `renamed` entry for this because this was never part of a
released version of Ghostty. This is not considered a break change.

Fixes #4460
2025-01-23 15:53:49 -08:00
Mitchell Hashimoto
5327646d58 config: rename adw-toasts to app-notifications
There is no `renamed` entry for this because this was never part of a
released version of Ghostty. This is not considered a break change.

Fixes #4460
2025-01-23 15:41:28 -08:00
Mitchell Hashimoto
0c24da1412 gtk: request initial color scheme asynchronously (#5064)
Requesting the initial color scheme on systems where the D-Bus interface
is nonexistent would delay Ghostty startup by 1-2 minutes. That's not
acceptable. Our color scheme events are already async-friendly anyway.

Fixes #4632
2025-01-23 15:31:54 -08:00
Leah Amelia Chen
956bb8f02b gtk: request initial color scheme asynchronously
Requesting the initial color scheme on systems where the D-Bus interface
is nonexistent would delay Ghostty startup by 1-2 minutes. That's not
acceptable. Our color scheme events are already async-friendly anyway.

Fixes #4632
2025-01-23 15:19:57 -08:00
Mitchell Hashimoto
b4a90a7a22 fix: gtk titlebar being restored if it shouldn't be (#5090)
I feel like we should be respecting the value of `gtk-titlebar` in the
`gtkWindowNotifyMaximized` callback as mentioned in discord
(https://discord.com/channels/1005603569187160125/1005603569711452192/1328976978094723163)

Would close https://github.com/ghostty-org/ghostty/issues/5262
2025-01-23 15:17:07 -08:00
Mitchell Hashimoto
078ee42be3 apprt/gtk: we should only show the headerbar again if csd 2025-01-23 15:04:48 -08:00
Adam Wolf
1be89cb146 fix: also respect gtk-titlebar value in fullscreened callback 2025-01-23 15:01:49 -08:00
Adam Wolf
80eb406b82 fix: gtk titlebar being restored if it shouldn't be 2025-01-23 15:01:49 -08:00
Mitchell Hashimoto
e39745113a cli: allow renaming config fields to maintain backwards compatibility (#5329)
Fixes #4631

This introduces a mechanism by which parsed config fields can be renamed
to maintain backwards compatibility. This already has a use case --
implemented in this commit -- for `background-blur-radius` to be renamed
to `background-blur`.

The remapping is comptime-known which lets us do some comptime
validation. The remap check isn't done unless no fields match which
means for well-formed config files, there's no overhead.

For future improvements:

- We should update our config help generator to note renamed fields.
- We could offer automatic migration of config files be rewriting them.
- We can enrich the value type with more metadata to help with config
gen or other tooling.
2025-01-23 14:25:26 -08:00
Mitchell Hashimoto
e854b38872 cli: allow renaming config fields to maintain backwards compatibility
Fixes #4631

This introduces a mechanism by which parsed config fields can be renamed
to maintain backwards compatibility. This already has a use case --
implemented in this commit -- for `background-blur-radius` to be renamed
to `background-blur`.

The remapping is comptime-known which lets us do some comptime
validation. The remap check isn't done unless no fields match which
means for well-formed config files, there's no overhead.

For future improvements:

- We should update our config help generator to note renamed fields.
- We could offer automatic migration of config files be rewriting them.
- We can enrich the value type with more metadata to help with
  config gen or other tooling.
2025-01-23 14:16:37 -08:00
Mitchell Hashimoto
4a3b4ea2b2 macOS: prevent native window drag by top region when titlebar hidden (#2523)
Currently `macos-titlebar-style = hidden` doesn't prevent the native
window drag gesture in the top region of the window- in the original PR
it did, but there were issues with how it went about it so it was
removed (see c6bbdfb). I figured out how to safely and simply remove the
gesture, and as a bonus it opens up potential future enhancements.

The native window drag region is driven ultimately by the window's
`contentLayoutRect`, so we can just override it in `TerminalWindow` to
return a rect the size of the full window, disabling the gesture without
causing any side effects by altering the responder chain.

This makes `macos-titlebar-style = hidden` a much nicer experience. The
window can still be resized, managed by the OS and third party window
managers, and dragged by the edges, but the native drag gesture in the
titlebar region is fully avoided.

### Future work
We may consider adjusting this to produce a `contentLayoutRect` that
doesn't include the padding area of the terminal grid(s), so that the
window can be dragged from a larger region around the edges (and not
just the resize region).
2025-01-23 13:48:31 -08:00
Qwerasd
5477eb87c1 macOS: prevent native window drag by top region when titlebar hidden
The native window drag region is driven ultimately by the window's
`contentLayoutRect`, so we can just override it in `TerminalWindow`
to return a rect the size of the full window, disabling the gesture
without causing any side effects by altering the responder chain.
2025-01-23 13:35:52 -08:00
Julia
9c8c53bffb use main buffer and copy data to fbo texture (opengl) (#5294)
NEEDS REVIEW

continuation of #5037
resolves #4729 

renders all shaders to the default buffer and then copies it to the
designated custom shader texture.

this is a draft pr because:
- it introduces a new shader "pipeline" which doesnt fit in with how the
system was designed to work (which is only rendering to the fbo)
- im not sure if this is the best way to achieve shaders being able to
sample their output while also drawing to the screen. the cusom fbo
(previous implementation) was useful in that it modularized the custom
shader stage in rendering

---------

Co-authored-by: Mitchell Hashimoto <m@mitchellh.com>
2025-01-23 20:57:14 +00:00
Jeffrey C. Ollie
8f49a227b7 build: options to enable/disable terminfo & termcap install
Fixes #5253

Add `-Demit-terminfo` and `-Demit-termcap` build options to
enable/disable installtion of source terminfo and termcap files.
2025-01-23 14:17:33 -06:00
Mitchell Hashimoto
cd57612059 apprt/gtk: when text is committed, end the preedit state (#5324)
Fixes #3567

ibus 1.5.29 doesn't trigger a preedit end state when text is committed.
This is fixed in ibus 1.5.30, but we need to handle this case for older
versions which are shipped on LTS distributions such as Ubuntu.

Every other input method engine I've tried thus far also triggers a
preedit end state when text is committed, and none would expect preedit
to continue after text is committed. So I think it's safe to assume that
this is the expected behavior.
2025-01-23 12:01:18 -08:00
Mitchell Hashimoto
d1e45ef768 apprt/gtk: when text is committed, end the preedit state
Fixes #3567

ibus 1.5.29 doesn't trigger a preedit end state when text is committed.
This is fixed in ibus 1.5.30, but we need to handle this case for older
versions which are shipped on LTS distributions such as Ubuntu.

Every other input method engine I've tried thus far also triggers a
preedit end state when text is committed, and none would expect preedit
to continue after text is committed. So I think it's safe to assume that
this is the expected behavior.
2025-01-23 11:47:46 -08:00
Jon Parise
a2018d7b20 bash: handle additional command arguments
A '-' or '--' argument signals the end of bash's own options. All
remaining arguments are treated as filenames and arguments. We shouldn't
perform any additional argument processing once we see this signal.

We could also assume a non-interactive shell session in this case unless
the '-i' (interactive) shell option has been explicitly specified, but
let's wait on that until we know that doing so would solve a real user
problem (and avoid any false negatives).
2025-01-23 10:43:36 -05:00
Mitchell Hashimoto
eb21a58aa4 apprt/gtk: ibus activation should not encode keys (#5310)
Related to #3567

This cleans up our handling of when GTK tells us the input method
handled the key press to address more scenarios we should not encode the
key event. The comments in this diff should explain clearly.

Reproduction is simple:

1. Use ibus (X11 or Wayland doesn't matter)
2. Press `super+.` to activate the emoji keyboard
3. Notice the `.` is written to the shell AND the emoji keyboard is
activated.

The bug is that `.` should not be encoded since it was used to activate
the emoji keyboard. This PR fixes that.
2025-01-22 20:32:03 -08:00
Mitchell Hashimoto
4408101b8d apprt/gtk: ibus activation should not encode keys
This cleans up our handling of when GTK tells us the input method
handled the key press to address more scenarios we should not encode the
key event. The comments in this diff should explain clearly.
2025-01-22 20:19:25 -08:00
Mitchell Hashimoto
ddf7173ae9 Change default key bindings to capture full screen contents (write_screen_file) (#5285)
The current default keybinding on `Ctrl-Shift-J`/`Cmd-Shift-J` utilize
[`write_scrollback_file`](https://ghostty.org/docs/config/keybind/reference#write_scrollback_file)
which only captures text that's scrolled off-screen. This can be
confusing, as I would expect it to capture everything on and off-screen.

Per the docs,
[`write_screen_file`](https://ghostty.org/docs/config/keybind/reference#write_screen_file)
is the "Same as `write_scrollback_file` but writes the full screen
contents" which is perfect to solve this problem and aligns exactly with
the expected behavior.

This change addresses the friction that people have reported in the
discussions below and specifically coming from the [search scrollback
feature discussion](https://github.com/ghostty-org/ghostty/issues/189),
where `Ctrl-Shift-J`/`Cmd-Shift-J` is one of the interim decent
workarounds but then you also have to figure out the extra intricacy to
use `write_screen_file` instead of `write_scrollback_file`.

Previous discussions:

 - https://github.com/ghostty-org/ghostty/discussions/3652
 - https://github.com/ghostty-org/ghostty/issues/3496
 - https://github.com/ghostty-org/ghostty/discussions/4911
 - https://github.com/ghostty-org/ghostty/discussions/4390
-
https://github.com/ghostty-org/ghostty/discussions/2363#discussioncomment-11735957
-
https://github.com/ghostty-org/ghostty/issues/189#issuecomment-2564719973
 - https://github.com/ghostty-org/ghostty/pull/2040
 
### Workaround

Before this PR is merged, you can achieve the same result by updating
your Ghostty config:

`.config/ghostty`
```sh
# So we have more scrollback history (the size of the scrollback buffer in bytes)
scrollback-limit = 100000000

# The default keybindings use `write_scrollback_file` but that only includes what is
# offscreen. `write_screen_file` includes what's on screen and offscreen.
keybind = ctrl+shift+j=write_screen_file:paste
keybind = ctrl+shift+alt+j=write_screen_file:open
```
2025-01-21 19:38:05 -08:00
Eric Eastwood
a8d2185611 Switch default key bindings to include on and offscreen contents
Previous discussions:

 - https://github.com/ghostty-org/ghostty/discussions/3652
 - https://github.com/ghostty-org/ghostty/issues/3496
 - https://github.com/ghostty-org/ghostty/discussions/4911
 - https://github.com/ghostty-org/ghostty/discussions/4390
 - https://github.com/ghostty-org/ghostty/discussions/2363#discussioncomment-11735957
 - https://github.com/ghostty-org/ghostty/issues/189#issuecomment-2564719973
 - https://github.com/ghostty-org/ghostty/pull/2040
2025-01-21 20:13:14 -06:00
Mitchell Hashimoto
6265adfcd4 apprt/gtk: fundamentally rework input method handling (#5280)
Fixes #4332

This commit fundamentally reworks the input method handling in the GTK
apprt, making it work properly (as reported in the linked issue) on both
Wayland and X11. This was tested with both a Gnome desktop on Wayland
and i3 on X11 with fcitx and mozc.

The main changes are:

- Both key press and release events must be forwarded to the input
method.

- Input method callbacks such as preedit and commit must be expected
outside of keypress events to handle on-screen keyboards and
non-keyboard input devices.

- Input methods should always commit when told to. Previously, we would
only commit when a keypress event was given. This is incorrect. For
example, it didn't work with input method changes outside the app which
should result in committed text (as can be seen with "official" Gnome
apps like Notes or Console).

The key input handling also now generally does less so I think input
latency should be positively affected by this change. I didn't measure.
2025-01-21 14:49:39 -08:00
Mitchell Hashimoto
52936b9b68 apprt/gtk: fundamentally rework input method handling
Fixes #4332

This commit fundamentally reworks the input method handling in the GTK
apprt, making it work properly (as reported in the linked issue) on both
Wayland and X11. This was tested with both a Gnome desktop on Wayland
and i3 on X11 with fcitx and mozc.

The main changes are:

- Both key press and release events must be forwarded to the input
  method.

- Input method callbacks such as preedit and commit must be expected
  outside of keypress events to handle on-screen keyboards and
  non-keyboard input devices.

- Input methods should always commit when told to. Previously, we would
  only commit when a keypress event was given. This is incorrect. For
  example, it didn't work with input method changes outside the app
  which should result in committed text (as can be seen with "official"
  Gnome apps like Notes or Console).

The key input handling also now generally does less so I think input
latency should be positively affected by this change. I didn't measure.
2025-01-21 14:37:40 -08:00
Bryan Lee
bf6cce23da Prevent hyperlink hover state when mouse is outside viewport 2025-01-22 02:49:37 +08:00
m154k1
25ccdfe495 Fix sudo fish shell integration
Set sudo_has_sudoedit_flags scope to --function.
2025-01-21 17:37:28 +02:00
Mitchell Hashimoto
5cb2fa6f75 fix(renderer): clip terminal contents to expected grid size (#4523) (#5265)
Resolves #4523

More notably this fixes a memory corruption crash that can occur while
resizing the font under Metal while there's a lot of active changes
occurring (e.g. while running DOOM fire). The change where all
background colors are explicitly written exposed this issue, though it
was technically a problem the whole time I'm fairly sure, just that the
corruption it caused before was benign.

This significantly improves the robustness of the renderers since it
prevents synchronization issues from causing memory corruption due to
out of bounds read/writes while building the cells.

TODO: when viewport is narrower than renderer grid size, fill blank
margin with bg color- currently appears as black, this only affects
DECCOLM right now, and possibly could create single-frame artefacts
during poorly managed resizes, but it's not ideal regardless.
2025-01-20 19:27:09 -08:00
Mitchell Hashimoto
fccb172ae9 unigen: Remove libc dependency, use ArenaAllocator (#5268)
Not linking libc avoids potential problems when compiling from/for
certain targets (see
https://github.com/ghostty-org/ghostty/discussions/3218), and using an
ArenaAllocator makes unigen run just as fast (in both release and debug
modes) while also taking less memory.

```
Benchmark 1 (3 runs): ./zig-out/bin/unigen-release-c
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          1.75s  ± 15.8ms    1.73s  … 1.76s           0 ( 0%)        0%
  peak_rss           2.23MB ±    0      2.23MB … 2.23MB          0 ( 0%)        0%
  cpu_cycles         7.22G  ± 62.8M     7.16G  … 7.29G           0 ( 0%)        0%
  instructions       11.5G  ± 16.0      11.5G  … 11.5G           0 ( 0%)        0%
  cache_references    436M  ± 6.54M      430M  …  443M           0 ( 0%)        0%
  cache_misses        310K  ±  203K      134K  …  532K           0 ( 0%)        0%
  branch_misses      1.03M  ± 29.9K      997K  … 1.06M           0 ( 0%)        0%
Benchmark 2 (3 runs): ./zig-out/bin/unigen-release-arena
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          1.73s  ± 6.40ms    1.72s  … 1.73s           0 ( 0%)          -  1.0% ±  1.6%
  peak_rss           1.27MB ± 75.7KB    1.18MB … 1.31MB          0 ( 0%)        - 43.1% ±  5.4%
  cpu_cycles         7.16G  ± 26.5M     7.13G  … 7.18G           0 ( 0%)          -  0.9% ±  1.5%
  instructions       11.4G  ± 28.2      11.4G  … 11.4G           0 ( 0%)          -  0.8% ±  0.0%
  cache_references    441M  ± 2.89M      439M  …  444M           0 ( 0%)          +  1.2% ±  2.6%
  cache_misses        152K  ±  102K     35.2K  …  220K           0 ( 0%)          - 50.8% ± 117.8%
  branch_misses      1.05M  ± 13.4K     1.04M  … 1.06M           0 ( 0%)          +  2.0% ±  5.1%
```

```
Benchmark 1 (3 runs): ./zig-out/bin/unigen-debug-c
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          1.75s  ± 32.4ms    1.71s  … 1.77s           0 ( 0%)        0%
  peak_rss           2.23MB ±    0      2.23MB … 2.23MB          0 ( 0%)        0%
  cpu_cycles         7.23G  ±  136M     7.08G  … 7.34G           0 ( 0%)        0%
  instructions       11.5G  ± 37.9      11.5G  … 11.5G           0 ( 0%)        0%
  cache_references    448M  ± 1.03M      447M  …  449M           0 ( 0%)        0%
  cache_misses        148K  ± 42.6K     99.3K  …  180K           0 ( 0%)        0%
  branch_misses       987K  ± 5.27K      983K  …  993K           0 ( 0%)        0%
Benchmark 2 (3 runs): ./zig-out/bin/unigen-debug-arena
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          1.76s  ± 4.12ms    1.76s  … 1.76s           0 ( 0%)          +  0.4% ±  3.0%
  peak_rss           1.22MB ± 75.7KB    1.18MB … 1.31MB          0 ( 0%)        - 45.1% ±  5.4%
  cpu_cycles         7.27G  ± 17.1M     7.26G  … 7.29G           0 ( 0%)          +  0.6% ±  3.0%
  instructions       11.4G  ± 3.79      11.4G  … 11.4G           0 ( 0%)          -  0.8% ±  0.0%
  cache_references    440M  ± 4.52M      435M  …  444M           0 ( 0%)          -  1.7% ±  1.7%
  cache_misses       43.6K  ± 19.2K     26.5K  … 64.3K           0 ( 0%)        - 70.5% ± 50.8%
  branch_misses      1.04M  ± 2.25K     1.04M  … 1.05M           0 ( 0%)        💩+  5.8% ±  0.9%
```
2025-01-20 19:25:56 -08:00
Ryan Liptak
2d3db866e6 unigen: Remove libc dependency, use ArenaAllocator
Not linking libc avoids potential problems when compiling from/for certain targets (see https://github.com/ghostty-org/ghostty/discussions/3218), and using an ArenaAllocator makes unigen run just as fast (in both release and debug modes) while also taking less memory.

Benchmark 1 (3 runs): ./zig-out/bin/unigen-release-c
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          1.75s  ± 15.8ms    1.73s  … 1.76s           0 ( 0%)        0%
  peak_rss           2.23MB ±    0      2.23MB … 2.23MB          0 ( 0%)        0%
  cpu_cycles         7.22G  ± 62.8M     7.16G  … 7.29G           0 ( 0%)        0%
  instructions       11.5G  ± 16.0      11.5G  … 11.5G           0 ( 0%)        0%
  cache_references    436M  ± 6.54M      430M  …  443M           0 ( 0%)        0%
  cache_misses        310K  ±  203K      134K  …  532K           0 ( 0%)        0%
  branch_misses      1.03M  ± 29.9K      997K  … 1.06M           0 ( 0%)        0%
Benchmark 2 (3 runs): ./zig-out/bin/unigen-release-arena
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          1.73s  ± 6.40ms    1.72s  … 1.73s           0 ( 0%)          -  1.0% ±  1.6%
  peak_rss           1.27MB ± 75.7KB    1.18MB … 1.31MB          0 ( 0%)        - 43.1% ±  5.4%
  cpu_cycles         7.16G  ± 26.5M     7.13G  … 7.18G           0 ( 0%)          -  0.9% ±  1.5%
  instructions       11.4G  ± 28.2      11.4G  … 11.4G           0 ( 0%)          -  0.8% ±  0.0%
  cache_references    441M  ± 2.89M      439M  …  444M           0 ( 0%)          +  1.2% ±  2.6%
  cache_misses        152K  ±  102K     35.2K  …  220K           0 ( 0%)          - 50.8% ± 117.8%
  branch_misses      1.05M  ± 13.4K     1.04M  … 1.06M           0 ( 0%)          +  2.0% ±  5.1%

Benchmark 1 (3 runs): ./zig-out/bin/unigen-debug-c
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          1.75s  ± 32.4ms    1.71s  … 1.77s           0 ( 0%)        0%
  peak_rss           2.23MB ±    0      2.23MB … 2.23MB          0 ( 0%)        0%
  cpu_cycles         7.23G  ±  136M     7.08G  … 7.34G           0 ( 0%)        0%
  instructions       11.5G  ± 37.9      11.5G  … 11.5G           0 ( 0%)        0%
  cache_references    448M  ± 1.03M      447M  …  449M           0 ( 0%)        0%
  cache_misses        148K  ± 42.6K     99.3K  …  180K           0 ( 0%)        0%
  branch_misses       987K  ± 5.27K      983K  …  993K           0 ( 0%)        0%
Benchmark 2 (3 runs): ./zig-out/bin/unigen-debug-arena
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          1.76s  ± 4.12ms    1.76s  … 1.76s           0 ( 0%)          +  0.4% ±  3.0%
  peak_rss           1.22MB ± 75.7KB    1.18MB … 1.31MB          0 ( 0%)        - 45.1% ±  5.4%
  cpu_cycles         7.27G  ± 17.1M     7.26G  … 7.29G           0 ( 0%)          +  0.6% ±  3.0%
  instructions       11.4G  ± 3.79      11.4G  … 11.4G           0 ( 0%)          -  0.8% ±  0.0%
  cache_references    440M  ± 4.52M      435M  …  444M           0 ( 0%)          -  1.7% ±  1.7%
  cache_misses       43.6K  ± 19.2K     26.5K  … 64.3K           0 ( 0%)        - 70.5% ± 50.8%
  branch_misses      1.04M  ± 2.25K     1.04M  … 1.05M           0 ( 0%)        💩+  5.8% ±  0.9%
2025-01-20 18:30:22 -08:00
Qwerasd
3b8ab10776 fix(renderer): clip terminal contents to expected grid size (#4523)
This significantly improves the robustness of the renderers since it
prevents synchronization issues from causing memory corruption due to
out of bounds read/writes while building the cells.

TODO: when viewport is narrower than renderer grid size, fill blank
margin with bg color- currently appears as black, this only affects
DECCOLM right now, and possibly could create single-frame artefacts
during poorly managed resizes, but it's not ideal regardless.
2025-01-20 18:56:13 -05:00
Mitchell Hashimoto
3327d32d66 Added exec permission back in for dolphin context menu item (#5254) 2025-01-20 11:41:53 -08:00
Andrej Daskalov
8a0613bd27 Merge branch 'ghostty-org:main' into main 2025-01-20 20:28:07 +01:00
Mitchell Hashimoto
a977e688cc fix(gtk): confirm tab close on close_tab action (#5166)
#4033 introduced a `ctrl-shift-w` binding to close a tab, but it doesn't
respect the `confirm-close-surface` option. Now `ctrl-shift-w` will ask
for confirmation exactly the same as clicking the close button with the
mouse.
2025-01-20 11:24:01 -08:00
Andrej Daskalov
8c1db16c79 added exec permission back to dolphin action 2025-01-20 20:19:12 +01:00
Mitchell Hashimoto
b82c70fd3c fix: quick terminal hidden by macos menu bar (#5222)
ghostty#5000 changed the window level from `.popupMenu` to `.floating`
to improve IME support. However, this introduced a side effect which
render the Quick Terminal (QT) below the macOS menu bar, whereas
previously it would cover it.

When positioned on `right` and `left`, the top of the QT becomes
partially hidden. This PR adjust the size of the QT to ensure it remains
fully visible and stays below the menu bar.

Before #5000:
![Screen Recording 2025-01-19 at 11 14
48](https://github.com/user-attachments/assets/70565c28-783f-4a2a-a8c9-a2eb16ea50e9)
With #5000:
![Screen Recording 2025-01-19 at 11 13
27](https://github.com/user-attachments/assets/184a1205-0a68-4fa0-a0d8-cc37701529af)
This branch:
![Screen Recording 2025-01-19 at 11 17
32](https://github.com/user-attachments/assets/f589d9e1-c5a0-4ed1-9f9b-651f3cb22f58)
2025-01-20 11:12:11 -08:00
Mitchell Hashimoto
977c9999dd render consecutive shaders to the fbo (opengl) (#5037)
fixes #4729

allows the shaders to sample each other via the fbo texture.

also, a better example would use the full screen e.g.:
"behind.glsl"
```glsl
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
    fragColor = vec4(fragCoord/iResolution.xy, 0.0, 1.0);
}
```

"infront.glsl"
```glsl
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
    fragColor = texture(iChannel0, fragCoord/iResolution.xy);
}
```
`ghostty --custom-shader=behind.glsl --custom-shader=infront.glsl`
|before|after|
|-|-|
|
![image](https://github.com/user-attachments/assets/d96cc8f1-7d87-4346-963a-a1fb27b81cba)
|
![image](https://github.com/user-attachments/assets/203c3827-9574-4739-9d54-430dc4a47dcc)|
2025-01-20 10:49:33 -08:00
Mitchell Hashimoto
f8ece6392d Fix triple clicking empty line and dragging (#5068)
Fixes core issue #4957. Adds a bool to `SelectLine` allowing the
`selectLine` function to select lines that are empty. When starting a
triple selection on an empty line the initial `selectLine` returns null
because we don't see any characters, in this case we rerun `selectLine`
but short circuit with the `allow_empty_lines`. We need to run
`selectLine` with out allowing empty lines once because if there are
characters on the line we don't want to select empty space.
2025-01-20 10:37:54 -08:00
julia
4cc1fa2111 render consecutive shaders to the fbo
not that big. see comments
2025-01-20 10:36:02 -08:00
Mitchell Hashimoto
a253871942 [macOS] fix: Closing tab with running process while in Stage Manager no longer causes focus to be lost (#5164)
Resolves #5108 

Reproduction: While Stage Manager is activated, create a new tab in
Ghostty, run `sleep 500` in that tab, and try and close it. Make sure to
try both closing the tab with cmd-w and clicking the x; also try
accepting the modal with a mouse click and pressing enter.

Relevant AppKit documentation: [NSAlert
beginSheetModal](https://developer.apple.com/documentation/appkit/nsalert/beginsheetmodal(for:completionhandler:))

What I believe is happening is that the alert modal ("there is still a
process running") is closed automatically after the completion handler
is run, which closes the window on which the alert is attached.
Something seems to go wrong in Stage Manager at this point; perhaps it
detects the alert closing as a "full" window closing and moves focus to
a different window.

The fix I've identified is to manually call the `orderOut` function to
dismiss the alert _before_ the code that closes the window is run.
2025-01-20 10:32:38 -08:00
Mitchell Hashimoto
8ada93d0cb Fix shell-integration-features being ignored with manual shell integration (#5048)
## Descriptions

The code was short-circuiting the shell integration setup when
`shell-integration = none`, which prevented the feature environment
variables from being set. These environment variables are needed even
for manual shell integration to work properly.

## Changes

- Extracted feature environment variables setup into a separate
`setup_features` function

- Modified the shell integration initialization to ensure features are
set up even when `shell-integration = none`

<img width="1126" alt="image"
src="https://github.com/user-attachments/assets/ceeb33f5-26ee-4a3b-a6d5-eed57848c96c"
/>


Fixes https://github.com/ghostty-org/ghostty/issues/5046
2025-01-20 10:28:14 -08:00
otomist
e5a3be3c46 use whitespace instead of new flag for selecting full line 2025-01-20 10:23:41 -08:00
Mitchell Hashimoto
c3ef4d2908 fix(flatpak): construct null-terminated array for arguments (#5213)
The variant format string `^aay` is said to be equivalent to
`g_variant_new_bytestring_array`. Given that no length parameter is
provided, glib assumed a null-terminated array, causing a crash as glib
exceed the read boundaries to copy arbitrary memory.

This commit replaces the array construction code to use its arena
equivalents instead of glib, and make sure that the resulting array is
null-terminated.

Fixes #3616.
2025-01-20 10:22:18 -08:00
Mitchell Hashimoto
0eb6f28375 fix(wuffs): don't premul alpha when loading png (#5189)
This was causing excessively faint/dark areas anywhere there was
transparency, since our image shaders for both Metal and OpenGL assume
the image data has straight alpha (which, I think should be the case for
data transmitted directly with kitty graphics protocol rather than
png-encoded), and do an additional multiplication.

After this change, our image blending looks *like most other apps*, even
though it's still technically wrong since it "should" be done in linear
space. Kitty, for example, does do linear blending for images, which is
*more correct* even though it doesn't look like most apps. On macOS if
`text-blending` is set to `linear` we do get linear blending, and match
Kitty exactly with this change.

In order to have linear blending of images while maintaining non-linear
blending of text for a "native" look on macOS we'd have to use swap
textures with different pixel formats (`*_srgb` / not `*_srgb`) or else
the API validator yells at us (even though it *does* work correctly...)
-- either that or perform our blending in a shader instead of relying on
Metal, which is my plan ultimately whenever I get around to making the
deferred render pipeline.
2025-01-20 10:22:10 -08:00
Mitchell Hashimoto
07d5ae749d Fix typo in binding comments (#5234)
I noticed this when I was reading the keybinding docs on the website and
figured I might as well fix it.
2025-01-20 10:21:15 -08:00
Mitchell Hashimoto
4b9281ee6e gtk: always set the title on the underlying window when using adwaita (#5173)
Fixes #5140
2025-01-20 10:16:03 -08:00
Mitchell Hashimoto
b9b49602cd gtk: don't toggle headerbar on (un)maximize while using SSDs (#5192)
See #5137. We should never display the header bar when using SSDs anyway
2025-01-20 10:11:42 -08:00
Mitchell Hashimoto
f5ff9c0371 chore: update stb_image.h (#5202)
exitting -> exiting
2025-01-20 10:11:20 -08:00
Mitchell Hashimoto
67b828cf21 termio: revise macOS-specific .hushlogin note (#5212)
login(1)'s .hushlogin logic was "fixed" in macOS Sonoma 14.4, so this
comment (and our workaround) is only relevant for versions earlier than
that.

The relevant change to login/login.c is part of system_cmds-979.100.8.

> login.c: look for .hushlogin in home directory (112854361)

-
1bca46ecc5
-
https://github.com/apple-oss-distributions/distribution-macOS/tree/macos-144
2025-01-20 10:10:34 -08:00
Mitchell Hashimoto
2ef04826fd Update iTerm2 colorschemes (#5216)
Upstream revision:
0e23daf592
2025-01-20 10:09:28 -08:00
Mitchell Hashimoto
9ca3cbd94b bash: revert automatic shell integration changes (#5249)
The intention of #5075 was to create a less intrusive, more hermetic
environment in which to source the bash startup files. This caused
problems for multiple people, and I believe that's because the general
expectation is that these files are sourced at global (not function)
scope.

For example, when a file is sourced from within a function scope, any
variables that weren't explicitly exported into the global environment
won't be available outside of the scope of the function. Most system and
personal startup files aren't written with that constraint because it's
not how bash itself loads these files.

As a small improvement over the original code, `rcfile` has been renamed
to `__ghostty_rcfile`. Avoiding leaking this variable while sourcing
these files was a goal of #5075, and prefixing it make it much less of a
potential issue.

This change also reverts the $HOME -> ~/ change. While the ~/ notation
is more concise, using $HOME is more common and easier to implement
safely with regard to quoting.

Fixes #5206
2025-01-20 10:09:06 -08:00