6734 Commits

Author SHA1 Message Date
Jeffrey C. Ollie
b7fa8e5947 linux: ensure that group dir fd is closed
The CLOEXEC flag on the fd will ensure that the directory is closed on
the child, but also need to close the fd in the parent.
2025-02-03 15:10:06 -06:00
Jeffrey C. Ollie
3fdbd5f7ba core: fix up pty Zig error sets 2025-02-03 15:06:59 -06:00
Jeffrey C. Ollie
7f0d22a31e core: add explicit errors to src/pty.zig 2025-02-03 15:06:59 -06:00
Jeffrey C. Ollie
8607d463ff core: fix puralization of src/os/env.zig Errors->Error 2025-02-03 14:38:00 -06:00
Jeffrey C. Ollie
002cce4e81 core: handle src/os/env.zig errors on windows 2025-02-03 14:26:12 -06:00
Jeffrey C. Ollie
8660cdaad5 core: add explicit errors to src/os/env.zig 2025-02-03 14:26:12 -06:00
Leah Amelia Chen
d61ee46210 config: mention X11 support in window-decoration docs 2025-02-03 18:56:09 +01:00
Leah Amelia Chen
4cd49632b2 gtk(x11): support server-side decorations
Remind me to never touch Xlib code ever again.
2025-02-03 18:56:09 +01:00
Mitchell Hashimoto
f70ba14abd apprt/gtk: handle input methods that end preedit before commit
Fixes #5494

When ibus/fcitx is not running (the GTK "simple" input method is
active), the preedit end event triggers _before_ the commit event. For
both ibus/fcitx, the opposite is true. We were relying on this ordering.

This commit changes the GTK input handling to not rely on this ordering.
Instead, we encode our composing state into the boolean state of whether
a key event is pressed. This happens before ANY input method events are
triggered.

Tested dead key handling on: X11/Wayland, ibus/fcitx/none.
2025-02-03 09:24:29 -08:00
Mitchell Hashimoto
3b3e75c1dc gtk(wayland): respect window-decoration=none on GNOME (#5463)
This is, admittedly, a very silly bug. On GNOME the SSD protocol is not
available and past me just decided to always enable CSDs in that case,
*even when* `window-decoration = none`. I now question my own
intelligence.
2025-02-03 07:23:10 -08:00
Mitchell Hashimoto
61fd41116a linux: fix installation path of nautilus-python extension (#5469)
Fixes #5468
2025-02-03 07:19:01 -08:00
Mitchell Hashimoto
1a1d3db207 Linux: Syscall errno handle (#5537)
When trying to run valgrind this incorrectly results in a correct
result, this is because `posix.errno` will use libc errno when linking
libc which ghostty does.


cf90dfd309/lib/std/posix.zig (L219-L221)

Since we are making the syscall directly we should not use this function
but rather use the return code directly on the enum, name from this
function seems odd to me (no zig experience) but it is the suggested
answer from zig (refer to issue below)
https://github.com/ziglang/zig/issues/22718

Note this definitely isnt much better than what we were doing before in
the case of running in valgrind

```text
error(linux-cgroup): unable to clone: os.linux.E__enum_81093.NOSYS
debug(io_thread): IO thread exited
warning(io_thread): error in io thread err=error.CloneError
warning(io_thread): abrupt io thread exit detected, starting xev to drain mailbox
debug(io_thread): io thread fully exiting after abnormal failure
```

opening a new tab shows
```
error starting IO thread: error.CloneError

The underlying shell or command was unable to be started.
This error is usually due to exhausting a system resource.
If this looks like a bug, please report it.

This terminal is non-functional. Please close it and try again.
```

this did not show on the original surface only on the new tab
2025-02-03 07:12:18 -08:00
Kat
1bd5ea6f73 Fix a typo in the docs for adjust-strikethrough-position and adjust-overline-position 2025-02-03 05:58:48 +00:00
rhodes-b
fb2516fbf6 comment on why to not use posix.errno 2025-02-02 16:35:20 -06:00
rhodes-b
bc156266c6 fix errno handle 2025-02-02 16:27:10 -06:00
Jeffrey C. Ollie
660d9dc671 linux: fix installation path of nautilus-python extension
Fixes #5468
2025-01-31 09:14:50 -06:00
Leah Amelia Chen
ac582ccf7c gtk(wayland): respect window-decoration=none on GNOME
This is, admittedly, a very silly bug. On GNOME the SSD protocol is not
available and past me just decided to always enable CSDs in that case,
*even when* `window-decoration = none`. I now question my own intelligence.
2025-01-31 12:17:05 +01:00
Mitchell Hashimoto
c5508e7d19 update version for development 2025-01-30 14:23:24 -08:00
Mitchell Hashimoto
facda0c3fb gtk(x11): update blur region upon syncAppearance (#5443)
Fixes a bug where the blur region offset used to accomodate CSDs are
applied even when CSDs are disabled.
2025-01-30 13:43:48 -08:00
Leah Amelia Chen
48a1a10330 gtk(x11): update blur region upon syncAppearance
Fixes a bug where the blur region offset used to accomodate CSDs
are applied even when CSDs are disabled.
2025-01-30 20:28:00 +01:00
Mitchell Hashimoto
a62b26cd2f next version will be 1.1.0 2025-01-30 07:18:43 -08:00
Mitchell Hashimoto
ce2a3773d2 input: performable bindings aren't part of the reverse mapping
Fixes #4522

This is a bit of a hammer-meets-nail solution, but it's a simple
solution to the problem. The reverse mapping is used to find the
binding that an action is bound to, and it's used by apprt's to populate
the accelerator label in the UI.

The problem is that accelerators in GTK are handled early in the event
handling process and its difficult to get that event mapping to a
specific surface. Therefore, the "performable" prefix was not working.
On macOS, this issue didn't exist because there exists an OS mechanism
to install an event handler earlier than the menu system.

This commit changes the reverse mapping to only include bindings that
are not performable. This way, the keybind always reaches the surface
and can be handled by `Surface.keyCallback` which processes
`performable`.

The caveat is that performable bindings will not show up in the UI
for menu items. This is documented in this commit now. They still work,
its just a UI issue.
2025-01-29 14:12:21 -08:00
Mitchell Hashimoto
27b254db8a apprt/gtk: set key modifier flag if physical modifier key is pressed
Fixes #5191
2025-01-29 13:12:50 -08:00
Lee Marlow
71d0481da8 Remove if check that was left in after change to exhaustive switch
This came out of cmd+triple-click fix in PR #5373
2025-01-29 11:38:35 -07:00
Mitchell Hashimoto
76fd4fa8df fix: cmd+triple-click select all command output when first line wraps (#5373)
I found this bug was easily reproduced with any command that wrapped to
multiple rows on the first line of its output. The cause is that we stop
searching for rows once we reach the first one where
`row.semantic_prompt = .command`, which means that we reach the bottom
line of wrapped output and stop there.

This PR makes it so that we continue iterating until we reach a row
where `semantic_prompt != .command` and then return the previous one (or
the last one if we run out of rows).

I also updated the test cases to include this.

I considered that this bug would also be avoided if we didn't propagate
the `command` semantic prompt to additional rows on wrapped lines, but I
don't know enough about the shell integration to make a call on that.

Closes #4693
2025-01-29 07:28:17 -08:00
Daniel Fox
a80cf3db9c Fix older adwaita tab bars at top of window 2025-01-28 12:30:57 -08:00
Qwerasd
016a26cf98 cleanup: rename text-blending to alpha-blending
+ correct docs
2025-01-27 19:37:44 -05:00
Qwerasd
5c8f984ea1 renderer/Metal: improve linear blending correction
More mathematically sound approach, does a much better job of matching
the appearance of non-linear blending. Removed `experimental` from name
because it's not really an experiment anymore.
2025-01-27 19:15:18 -05:00
Qwerasd
ac568900a5 fix(renderer/Metal): properly load cursor color 2025-01-26 20:40:19 -05:00
Daniel Patterson
4b8010a6f4 Change ifs to exhaustive switches 2025-01-26 15:22:23 +00:00
Daniel Patterson
645b4b0031 Fix cmd+triple click not selecting full output 2025-01-25 23:37:46 +00:00
Mitchell Hashimoto
e2e6770ed1 Docs: improve doc structure for action bindings with args and examples (#5344)
Related to #4446 , as suggested i've made a smaller chunk of updates for
the action binding docs, including arguments and examples. I did this
only for enum types this time.

I've also included the argument type name in the Argument (e.g.
AdjustSelection).

Not sure if we should include the keybindings or not in the example?

I also added a format of some unrelated code change.
2025-01-24 15:45:54 -08:00
Mitchell Hashimoto
a88e30179a cli/list-keybinds: output chorded keybinds (#5357)
Print chorded/sequenced keybinds in `+list-keybinds`.

Recursively traverses the binding sets of sequenced keybinds and builds
a singly-linked list of triggers for each leaf. Also adapted the current
sorting criteria to work for multiple triggers per keybind.

Chorded keybinds are already output when not printing to a tty so that
code path is unchanged.

Closes #4505
2025-01-24 15:34:51 -08:00
Mitchell Hashimoto
3b108945f3 Merge branch 'main' into cleanup-action-binding-docs 2025-01-24 15:33:39 -08:00
Mitchell Hashimoto
f73cae0738 Ignore SIGPIPE
Fixes #5359

The comments explain what's going on. Longer term we should adjust our
termio/exec to avoid the SIGPIPE but its still possible (i.e. that
thread crashes) to happen so we should be robust to it.
2025-01-24 13:48:30 -08:00
Mitchell Hashimoto
47ff4c96e0 build: options to enable/disable terminfo & termcap install (take 2) (#5340)
Fixes #5253

Add -Demit-terminfo and -Demit-termcap build options to enable/disable
installation of source terminfo and termcap files.

Replacement for #5311
2025-01-24 13:28:48 -08:00
Daniel Patterson
5ad2ec8f71 Add chorded/sequenced keybinds to +list-keybinds output 2025-01-24 19:58:15 +00:00
Mitchell Hashimoto
8475768ad1 termio/exec: if pty fd HUP, end read thread
Fixes #4884

When our command exits, it will close the pty slave fd. This will
trigger a HUP on our poll. Previously, we only checked for IN. When a fd
is closed, IN triggers forever which would leave to an infinite loop and
100% CPU.

Now, detect the HUP and exit the read thread.
2025-01-24 09:39:22 -08:00
Erlend Lind Madsen
0c5ef5578c Docs: remove type from action arguments 2025-01-24 23:13:42 +07:00
Jeffrey C. Ollie
593d70a42f fix missing check of emit_termcap build option 2025-01-24 10:06:40 -06:00
Jeffrey C. Ollie
d1969f74ac only the cp step needs to depend on the mkdir step 2025-01-24 10:06:39 -06:00
Jeffrey C. Ollie
2f8b0dc899 build: options to enable/disable terminfo & termcap install (take 2)
Fixes #5253

Add -Demit-terminfo and -Demit-termcap build options to enable/disable
installation of source terminfo and termcap files.
2025-01-24 10:06:39 -06:00
Erlend Lind Madsen
c4c2d06571 fmt 2025-01-24 15:06:47 +07:00
Erlend Lind Madsen
076bcccde4 Docs: improve doc structure for action bindings with args and examples
minor doc changes
2025-01-24 15:06:45 +07:00
Mitchell Hashimoto
0d6a1d3fdb Prevent fd leaks to the running shell or command
Multiple fixes to prevent file descriptor leaks:

- libxev eventfd now uses CLOEXEC
- linux: cgroup clone now uses CLOEXEC for the cgroup fd
- termio pipe uses pipe2 with CLOEXEC
- pty master always sets CLOEXEC because the child doesn't need it
- termio exec now closes pty slave fd after fork

There still appear to be some fd leaks happening. They seem related to
GTK, they aren't things we're accessig directly. I still want to
investigate them but this at least cleans up the major sources of fd
leakage.
2025-01-23 22:12:58 -08:00
Mitchell Hashimoto
c0eb6985ee Revert "build: options to enable/disable terminfo & termcap install"
This reverts commit 8f49a227b7c352083b0815e7818db900402513e0.
2025-01-23 19:38:13 -08:00
Qwerasd
78790f6ef7 fix(Metal): always render explicit background colors fully opaque
This fixes a regression introduced by the rework of this area before
during the color space changes. It seems like the original intent of
this code was the behavior it regressed to, but it turns out to be
better like this.
2025-01-23 20:06:53 -05:00
Mitchell Hashimoto
95327bff18 Prevent hyperlink hover state when mouse is outside viewport (#5267)
## Description

Fixed an issue where hyperlinks would maintain their hover state when
the mouse is outside the viewport while holding the Cmd key. This
created inconsistent behavior with the window's standard hover state
clearing logic.

## Changes

- Added viewport boundary check in `mouseRefreshLinks` function to
prevent link processing when cursor is outside the window

## Testing

To reproduce and verify the fix:

1. Run `fd --hyperlink "\.zig$" src/apprt` to create hyperlinks

2. Move mouse over a hyperlink (it should highlight)

3. Move mouse outside window

4. Hold Cmd key

	- Before: Link would show hover state

	- After: Link remains in non-hover state

Fixes #5252

@rrotter Could you please try this to see if it solves your issue?
2025-01-23 16:29:07 -08:00
Mitchell Hashimoto
9b30eb8eb8 bash: handle additional command arguments (#5319)
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 16:18:49 -08:00
Mitchell Hashimoto
a4b0e6d937 Fix sudo fish shell integration (#5276)
Currently, `sudo_has_sudoedit_flags` variable is being erased when `for`
block ends.
Change its scope to `--function` to prevent this.

Fixes `sudo: you may not specify environment variables in edit mode`.
2025-01-23 16:17:51 -08:00