11126 Commits

Author SHA1 Message Date
Jeffrey C. Ollie
81403f59ce dbus and systemd activation - take 2
This replaces #7433. The improvements are:

1) Install the systemd user service in the proper directory depending
on if it's a 'user' install or a 'system' install. This is controlled
either by using the `--system` build flag (as most packages will) or by
the `-Dsystem-package` flag.

2) Add the absolute path to the `ghostty` binary in the application
file, the DBus service, and the systemd user service. This is done so
that they do not depend on `ghostty` being in the `PATH` of whatever
is launching Ghostty. That `PATH` is not necessarily the same as the
`PATH` in a user shell (especially for DBus activation and systemd user
services).

3) Adjust the DBus bus name that is expected by the system depending on
the optimization level that Ghostty is compiled with.
2025-06-26 10:28:46 -07:00
Qwerasd
f7ee6b3bda terminal/Screen: clean up selection remap in clone
Cleans up the logic, checks for out of bounds using rows instead of
sel.contains because that excludes cases where a rectangle selection
doesn't include the leftmost column.

Also adds test for clipping behavior of rectangular selections.
2025-06-26 11:26:03 -06:00
Qwerasd
360124ded0 terminal/Screen: account for rectangle selection in clone
Fixes an issue where rectangle selections would appear visually wrong if
their start or end were out of the viewport area, because when cloning
them the restored pins were defaulting to the start and end of the row
instead of the appropriate column.
2025-06-25 23:16:43 -06:00
Jason Rayne
076f742dd4 fix: replace non-existent GHOSTTY_VERSION with TERM_PROGRAM_VERSION in shell integration
GHOSTTY_VERSION was mistakenly referenced but is never set. Use
TERM_PROGRAM_VERSION which is actually provided by Exec.zig from
build_config.version_string.
2025-06-25 17:50:15 -07:00
Jason Rayne
b5372468e4 docs: clarify infocmp/tic requirements for ssh-terminfo feature
infocmp is required locally to extract terminfo, tic is required on
remote hosts to install it
2025-06-25 17:47:26 -07:00
Jason Rayne
eed2006b4d fix: correct resources directory fallback path and eliminate code duplication in ssh_cache
- Fix fallback path from full path to "src" since full path is built
later
- Extract duplicate code from listCachedHosts and clearCache into
runCacheCommand helper
- Addresses feedback from @00-kat
2025-06-25 17:47:01 -07:00
Jason Rayne
1873add697 docs: call out bash dependency 2025-06-25 17:00:17 -07:00
Jason Rayne
e5e2a56c98 fix: use imported modules consistently in action dispatch 2025-06-25 16:47:17 -07:00
Jason Rayne
59229d7681 style: revert fish_indent quote removal
forgot to disable autoformat for this buffer (again)
2025-06-25 16:36:08 -07:00
Jason Rayne
931efcd1e3 fix: restore background-image config accidentally removed during rebase 2025-06-25 16:15:41 -07:00
Jason Rayne
21d95c42c6 docs: improve clear-ssh-cache description (missed in previous commit)
Clarifies this clears hosts cached by SSH shell integration, completing
mitchellh's feedback on both action descriptions.
2025-06-25 15:58:13 -07:00
Jason Rayne
0ccb7cf353 docs: improve SSH cache CLI action descriptions
- Clarify that +list-ssh-cache shows shell integration cached hosts
- Add note about +clear-ssh-cache command and when to use it

Addresses mitchellh's feedback on action descriptions.
2025-06-25 15:46:18 -07:00
Jason Rayne
f617c9b3b7 docs: update ssh-terminfo description to reference new CLI actions
Updates Config.zig documentation to reflect that SSH cache management is
now handled by proper CLI actions (+list-ssh-cache and +clear-ssh-cache)
rather than shell wrapper commands.

Fixes documentation missed in e8c8a51.
2025-06-25 15:46:18 -07:00
Jason Rayne
0565ed3954 refactor: replace ghostty wrapper with proper CLI actions for terminfo cache management
- Add +list-ssh-cache and +clear-ssh-cache CLI actions
- Remove ghostty() wrapper functions from all shell integrations
- Improve variable naming in shell scripts for readability

Addresses @00-kat's feedback about CLI discoverability and naming
consistency. The new CLI actions follow established Ghostty patterns
and are discoverable via `ghostty --help`, while maintaining clean
separation of concerns between shell logic and cache management.
2025-06-25 15:46:18 -07:00
Jason Rayne
6789b7fb6e docs: add shared directory section to shell-integration README 2025-06-25 15:46:18 -07:00
Jason Rayne
8a2fa6485e refactor: extract SSH cache functionality to shared script
Addresses feedback about separation of concerns in shell integration
scripts.

Extracts host caching logic to
`src/shell-integration/shared/ghostty-ssh-cache` and updates all four
shell integrations to use the shared script. The `shared/` subdirectory
preserves the existing organizational pattern where all shell-specific
code lives in subdirectories. This cleanly separates SSH transport logic
from cache management while reducing code duplication by ~25%.

All existing SSH integration behavior remains identical.
2025-06-25 15:46:18 -07:00
Jason Rayne
bbb02a8392 test: update shell integration tests for SSH flags
Add ssh-env and ssh-terminfo fields to existing setupFeatures tests.
2025-06-25 15:46:18 -07:00
Jason Rayne
c8d5e60390 docs: expand flag descriptions, usage overview 2025-06-25 15:46:18 -07:00
Jason Rayne
81641e56b1 ssh-integration: replace levels with flags, optimize implementation
Rewrote shell functions to support the two new flags for
shell-integration-features:
- ssh-env: TERM compatibility + best effort environment variable
propagation (anything beyond TERM will depend on what the remote host
allows)
- ssh-terminfo: automatic terminfo installation with control socket
orchestration
- Flags work independently or combined

Implementation optimizations:
- ~65% code reduction through unified execution path
- Eliminated GHOSTTY_SSH_INTEGRATION environment variable system
- Replaced complex function dispatch with direct flag detection
- Consolidated 4 cache helper functions into single _ghst_cache()
utility
- Simplified control socket management (removed multi-step
orchestration)
- Subsequent connections to cached hosts are now directly executed and
more reliable

New additions:
- If ssh-terminfo is enabled, ghostty will be wrapped to provide users
with convenient commands to invoke either of the two utility functions:
`ghostty ssh-cache-list` and `ghostty ssh-cache-clear`
2025-06-25 15:46:18 -07:00
Jason Rayne
e73313ed40 change: migrate SSH integration from standalone option to shell-integration-features flags
- Add ssh_env and ssh_terminfo flags to ShellIntegrationFeatures
- Remove SSHIntegration enum and ssh-integration config option
- Update setupFeatures to handle new flags via reflection
- Remove setupSSHIntegration function and all references

Integrates SSH functionality into existing shell-integration-features
system for better consistency and user control.
2025-06-25 15:46:18 -07:00
Jason Rayne
ddd3da487e fix: update cache file location 2025-06-25 15:46:18 -07:00
Jason Rayne
30683979bc fix: catch up to current state 2025-06-25 15:46:18 -07:00
Jason Rayne
f206e76841 ssh-integration: improve host caching, new method for "full" integration
Need a sanity check on this new approach for "full" to help determine if
it's worth additional iteration/refinement.

It solves the double auth issue, successfully propagates env vars, and
avoids output noise for connections that happen after terminfo is
installed. The only issue I don't have time to fix tonight is the fact
that it drops the MOTD for cached (re)connections.
2025-06-25 15:46:18 -07:00
Jason Rayne
69f9976394 fix: manual formatting pass to ensure consistency with existing patterns 2025-06-25 15:46:18 -07:00
Jason Rayne
4cebee5c8e fix: add client-side caching to eliminate redundant terminfo installations
- Cache known hosts with terminfo in
$GHOSTTY_RESOURCES_DIR/terminfo_hosts
- Skip installation step for cached hosts (single connection instead of
two)
- Use secure file permissions (600) and atomic writes
- Extract SSH target safely from command arguments
- Maintains full functionality while improving user experience on
repeated connections
2025-06-25 15:46:18 -07:00
Jason Rayne
b6bb9abfbc fix: address comprehensive shell integration code review issues
- Fix elvish function name mismatch and use conj for list operations
- Simplify terminfo installation command per ghostty docs (tic -x -)
- Fix conditional structure to ensure error messages always print
- Remove redundant checks and optimize array initialization
- Use consistent patterns across bash, fish, elvish, and zsh
implementations
2025-06-25 15:46:18 -07:00
Jason Rayne
995fb09813 fix: add builtin prefix for safety and consistency 2025-06-25 15:46:18 -07:00
Jason Rayne
2ddcf2fffe fix: remove resources_dir var, add builtin prefix for consistency 2025-06-25 15:46:18 -07:00
Jason Rayne
3319b2b6ed docs: added full stop for consistency 2025-06-25 15:46:18 -07:00
Jason Rayne
fb8f6c77dd fix: remove dangling resources_dir var 2025-06-25 15:46:18 -07:00
Jason Rayne
80475e1d17 fix: critical elvish syntax errors for environment variables 2025-06-25 15:46:18 -07:00
Jason Rayne
af28763a34 fix: trailing newline in Config.zig 2025-06-25 15:46:18 -07:00
Jason Rayne
8fafd5ace1 docs: expand SSH integration configuration documentation
Add detailed explanations of shell function behavior, TERM compatibility
trade-offs, environment variable propagation, and authentication
requirements per maintainer feedback.
2025-06-25 15:46:18 -07:00
Jason Rayne
4206ab1210 fix: use idiomatic Fish shell syntax in SSH integration
- Use `set --append` for array operations
- Use `type -q` for command existence checks
2025-06-25 15:46:18 -07:00
Jason Rayne
050cb3bfec fix: remove unnecessary jsonStringify method 2025-06-25 15:46:18 -07:00
Jason Rayne
2e9a0e92db fix: clean up SSH environment variable propagation 2025-06-25 15:46:18 -07:00
Jason Rayne
b07b3e4608 fish: revert all formatting changes
Keeps only functional additions for SSH integration wrapper,
preserving original line breaks and indentation to minimize
diff noise per maintainer feedback.
2025-06-25 15:46:18 -07:00
Jason Rayne
c70643404c bash: revert all formatting changes
Keeps only functional additions for SSH integration wrapper,
preserving original line breaks and indentation to minimize
diff noise per maintainer feedback.
2025-06-25 15:46:18 -07:00
Jason Rayne
842ced9212 bash: preserve mixed indentation in SSH integration changes
Preserves existing mixed indentation in ghostty.bash to minimize
diff noise per maintainer feedback.
2025-06-25 15:46:18 -07:00
Jason Rayne
2babdb458f refactor: simplify ssh integration environment variable checks 2025-06-25 15:46:18 -07:00
Jason Rayne
34af3ffbaf docs: inline ssh-integration documentation instead of referencing enum 2025-06-25 15:46:18 -07:00
Jason Rayne
8f93d8fe03 fix: use kebab-case for ssh-integration enum values 2025-06-25 15:46:18 -07:00
Jason Rayne
142e07c502 feat: add SSH integration wrapper for shell integration
- Implements opt-in SSH wrapper following sudo pattern
- Supports term_only, basic, and full integration levels
- Fixes xterm-ghostty TERM compatibility on remote systems
- Propagates shell integration environment variables
- Allows for automatic installation of terminfo if desired
- Addresses GitHub discussions #5892 and #4156
2025-06-25 15:43:32 -07:00
Mitchell Hashimoto
fa47db5363 config: add command-palette-entry config option (#7688)
Implements #7158 for GTK
2025-06-25 16:48:10 -04:00
Mitchell Hashimoto
9eec80e038 Terminal Background Image Support (#7686)
Adds support for background images via the `background-image` config.

Resolves #3645, supersedes PRs #4226 and #5233.

See docs of added config keys for usage details.

> [!NOTE]
> Unlike what is implied by the original issue, because this is
implemented in the renderer it is inherently per-surface not per-window,
meaning a window with a split will have two copies of the background
image.

### Future work
- We should probably introduce code in the apprts that tells surfaces
their position and size relative to the window, which would allow us to
add a `background-image-area` config with options for `surface` and
`window` to control that behavior (and probably default it to `window`).
That apprt code would also allow for window-relative custom shader
locations, which is also a fairly common user request, so I think it's
worth it.
- Currently if you use a high res background image this is fairly
inefficient, since each surface independently loads a copy of the
background image. On systems with limited VRAM this could be an issue
for users who use a lot of surfaces, so it may be worth making a shared
image cache to avoid this problem.
- ~~It's probably worth using compressed texture formats for images,
I'll look in to doing that.~~ (c43702c)
2025-06-25 16:45:40 -04:00
Mitchell Hashimoto
a8091fedf3 fix tests 2025-06-25 16:28:31 -04:00
Mitchell Hashimoto
6c2ea8637e config: add more docs for background-image 2025-06-25 16:27:23 -04:00
Qwerasd
5cb175ff63 renderer/OpenGL: use compressed texture formats for images
BPTC is required to be available OpenGL >= 4.2 and our minimum is 4.3 so
this is safe in terms of support. I tested briefly in a VM and didn't
encounter any problems so this should just be a complete win.

(Note: texture data is already automatically compressed on Metal)
2025-06-25 16:27:23 -04:00
Qwerasd
da46a47726 renderer: add support for background images
Adds support for background images via the `background-image` config.

Resolves #3645, supersedes PRs #4226 and #5233.

See docs of added config keys for usage details.
2025-06-25 16:27:23 -04:00
Qwerasd
03bdb92292 renderer: clean up image.zig, reduce repetitive code 2025-06-25 16:27:23 -04:00