317 Commits

Author SHA1 Message Date
Khang Nguyen Duy
239056c90f avoid asserting working directory is absolute
`std.fs.accessAbsolute` asserts if the user proposed path is absolute,
which we are seemingly passing as-is with no validating that it is.

When running with safety checks on, passing non-absolute path to
--working-directory will make ghostty crash.

I changed it to use `Dir.access`, which is just `accessAbsolute` without
the check.

This has the side effect of also allowing relative working directory.
2024-12-20 22:41:28 +07:00
Jon Parise
d981ddf128 macos: add our application bundle to XDG_DATA_DIRS
We're packaging more and more application-specific data directories in
our application bundle. It's helpful to add that path to XDG_DATA_DIRS
so those applications (that support XDG_DATA_DIRS) can locate their data
directories without additional user-level configuration.

This also fixes a typo ("MATHPATH") in the nearby MANPATH-building code.
2024-12-15 21:24:43 -08:00
Isaac Mills
39fbd7db4b Prevent GTK from initializing Vulkan. This improves startup time 2024-11-26 11:10:00 -07:00
Jon Parise
433b6b4fe2 os: replace PATH_SEP with std.fs.path.delimiter
This standard library symbol is equivalent.
2024-11-19 10:51:02 -05:00
Mitchell Hashimoto
a436bd0af6 move datastructures to dedicated "datastruct" package 2024-11-07 14:39:10 -08:00
Mitchell Hashimoto
f8bdd2b1bb termio: killpg expected to fail on darwin, still go into waitpid loop
Fixes #2273

On macOS, killpg is expected to fail with EPERM because of the way we
launch a login process around it. Before this commit, this caused us to
never call waitpid and reap the child process, which caused the child
process to stick around as a zombie.

This commit allows killpg to fail with EPERM on macOS and fall through
to waitpid.
2024-09-20 15:29:06 -07:00
FineFindus
6f3db36251 termio: correct comment about windows support
The comment has conflicting information about supporting windows. This
removes the incorrect information that only windows is supported.
2024-09-20 17:42:08 +02:00
Mitchell Hashimoto
e3d528cf0b termio: use surface messages to trigger password input state 2024-09-18 21:14:05 -07:00
Mitchell Hashimoto
42e7cbc475 termio: typos 2024-09-18 20:59:27 -07:00
Mitchell Hashimoto
66a065dcdd termio: always set termios timer running bool to true on focus
Fixes #2265

See comment in diff for details.
2024-09-18 20:56:40 -07:00
Mitchell Hashimoto
1936ef7fee termio: increase termios poller to 200ms 2024-09-18 12:14:55 -07:00
Mitchell Hashimoto
e8bbc987e0 termio: stop the termios poller when not focused 2024-09-18 11:56:07 -07:00
Mitchell Hashimoto
39627e3221 termio: set pw input state on terminal and wake up renderer 2024-09-18 10:47:26 -07:00
Mitchell Hashimoto
4f6995d727 termio: poll termios for changes 2024-09-18 10:34:07 -07:00
Mitchell Hashimoto
f0c4afdf9c termio: set crash threadlocal data for exec reader thread 2024-09-03 14:31:05 -07:00
Mitchell Hashimoto
18419d3589 Clamp initial window size configurations to screen size
Fixes #2145
2024-08-26 10:09:05 -07:00
multifred
72c672adb7 Fix multiple deprecated names for zig lib/std 2024-07-22 00:07:17 +02:00
Mitchell Hashimoto
1100145cf3 tweaks 2024-07-18 15:57:55 -07:00
Łukasz Niemier
255e50124c fix: instead of overriding MANPATHs set by OS, append to them
Quoting `man man`:

>  If MANPATH begins with a colon, it is appended to the default list;

Alternatively we can think about:

> if it ends with a colon, it is prepended to the default list;

To take preference over existing values, but that shouldn't be really a
problem, as there rather isn't much of another projects named `ghostty`.
2024-07-19 00:36:42 +02:00
Mitchell Hashimoto
835d622baa termio: writer => mailbox 2024-07-15 10:23:09 -07:00
Mitchell Hashimoto
001a6d2624 termio: reader => backend 2024-07-15 10:14:14 -07:00
Mitchell Hashimoto
4a4b9f2411 termio: trying to get Exec to not have access to full Opts 2024-07-15 09:45:58 -07:00
Mitchell Hashimoto
b0cd40d1de termio: fix windows build 2024-07-14 15:16:16 -07:00
Mitchell Hashimoto
a848a53d26 termio: remove a ton of state 2024-07-14 15:10:05 -07:00
Mitchell Hashimoto
af7adedb50 termio: writer abstraction 2024-07-14 14:48:48 -07:00
Mitchell Hashimoto
e30e635bed termio: move all subprocess logic to termio.Exec 2024-07-13 19:24:10 -07:00
Mitchell Hashimoto
b3c2479f87 termio: move subprocess out to its own file 2024-07-13 15:20:38 -07:00
Mitchell Hashimoto
ff43609097 terminal: boilerplate for tmux control mode parsing 2024-07-11 18:58:25 -07:00
Mitchell Hashimoto
f375bf009c terminal: all DCS events can produce a command 2024-07-11 18:53:42 -07:00
Mitchell Hashimoto
01e1538ad3 terminal: dcs put can return a command 2024-07-11 18:42:22 -07:00
Mitchell Hashimoto
245314b14e termio: hook up OSC8 2024-07-05 21:40:38 -07:00
Mitchell Hashimoto
4d2c98afea termio: allow failing to build manpath string 2024-07-03 09:28:50 -07:00
Jon Parise
691319f6d7 termio: remove unnecessary resources_key const 2024-07-03 10:52:35 -04:00
Jon Parise
89ac7ac5f6 termio: add man pages to MANPATH on macOS 2024-07-03 10:52:35 -04:00
Jeffrey C. Ollie
fa6d2b2913 Don't leak env vars in GTK apprt.
The GTK apprt should not leak the GDK_DEBUG and GSK_RENDERER env vars
to child processes.
2024-07-01 11:25:48 -05:00
Mitchell Hashimoto
8f9cdff1f5 small stylistic tweaks 2024-06-08 19:07:10 -07:00
Jeffrey C. Ollie
e6f97c28f8 Use clone3 / CLONE_INTO_CGROUP on Linux
Use clone3 / CLONE_INTO_CGROUP to have the Linux kernel create the process in the
correct cgroup rather than move the process into the cgroup after it is created.
2024-06-07 23:48:03 -06:00
Mitchell Hashimoto
dda6a22ea9 apprt/gtk: cgroup hierarchy only affects surfaces 2024-06-05 10:42:43 -07:00
Mitchell Hashimoto
7d9da34259 termio/exec: move subprocess into cgroup 2024-06-05 09:30:21 -07:00
Mitchell Hashimoto
a63c8d0913 termio: plumb a lot more to get ready to move into cgroup 2024-06-05 09:25:36 -07:00
Mitchell Hashimoto
dc51b8269c plumb the linux cgroup through to termio 2024-06-04 21:37:34 -07:00
ilk
7377ca8917 refactor(shell-integration): refactor to make cases alphabetical
also refactors elvish file to evade unobvious returns
and tries to fix some build errors
2024-05-27 16:15:12 -07:00
Mitchell Hashimoto
d64fa6d9db termio: shell integration uses arena 2024-05-07 19:57:26 -07:00
Jon Parise
73b3560e62 shell-integration: automatic bash integration
This change adds automatic bash shell detection and integration.

Unlike our other shell integrations, bash doesn't provide a built-in
mechanism for injecting our ghostty.bash script into the new shell
environment.

Instead, we start bash in POSIX mode and use the ENV environment
variable to load our integration script, and the rest of the bash
startup sequence becomes the responsibility of our script to emulate
(along with disabling POSIX mode).
2024-05-05 13:59:52 -07:00
Mitchell Hashimoto
3f9e3c39a4 terminal: track dirty state of palette and reverse colors 2024-05-01 20:31:49 -07:00
Jon Parise
54f6abf1cf termio: pass full command to shell integration
This will allow the shell integration code to inspect the full command
string rather than just the first component (shell binary).
2024-04-21 09:53:27 -07:00
Mitchell Hashimoto
be0d52a4f2 config: rename "wcswidth" to "legacy" for "grapheme-width-method"
We don't actually use libc wcswidth to determine width and even if we
did some terminals use wcwidth (which behaves differently), some use
the Python wcswidth library (which behaves differently), etc. The
reality is there is no real consistency on "legacy" behavior so by
naming it "legacy" we show that we're doing our best but also gives us
wiggle room to change our behavior in the future.

Functionally nothing changes with this commit.
2024-04-19 09:56:22 -07:00
Mitchell Hashimoto
8dbedeb76c fix breaking changes with latest zig 2024-04-17 20:50:50 -07:00
Qwerasd
4c9e238c3f fix(termio/exec): avoid overflow in setCursorRow/ColRelative
Using a saturating addition here just to avoid overflow, since setCursorPos handles proper clamping to the screen size so we don't need to duplicate that logic.
2024-03-29 13:15:24 -04:00
Mitchell Hashimoto
1c57bbabda termio/exec: clear screen should erase rows and shift up 2024-03-22 20:28:12 -07:00