5828 Commits

Author SHA1 Message Date
Kristófer R
03bb16fcec Move hostname helpers to src/os/hostname.zig 2024-11-04 16:54:38 -05:00
Mitchell Hashimoto
737dc0896d Merge pull request #2581 from FineFindus/fix/adw-headerbar-ghostty-theme
apprt/adw: reapply headerbar colors in toolbarview
2024-11-03 18:43:15 -08:00
Emily
20a77123d4 renderer/metal: prefer low‐power GPUs
Some Intel MacBook Pro laptops have both an integrated and discrete
GPU and support automatically switching between them. The system
uses the integrated GPU by default, but the default Metal device on
those systems is the discrete GPU. This means that Metal‐using
applications activate it by default, presumably as the intended
audience is high‐performance graphics applications.

This is unfortunate for productivity applications like terminals,
however, as the discrete GPU decreases battery life and worsens the
thermal throttling problems these machines have always had. Prefer
to use an integrated GPU when present and not using an external GPU.

The behaviour should be unchanged on Apple Silicon, as the platform
only supports one GPU. I have confirmed that the resulting app runs,
works, and doesn’t activate the AMD GPU on my MacBook Pro, but have
not done any measurements of the resulting performance impact. If
it is considered sufficiently noticeable, a GPU preference setting
could be added.

See <https://github.com/zed-industries/zed/issues/5124>,
<https://github.com/zed-industries/zed/pull/13685>,
<https://github.com/zed-industries/zed/pull/14738>, and
<https://github.com/zed-industries/zed/pull/14744> for discussion,
measurements, and changes relating to this issue in the Zed
project. The logic implemented here reflects what Zed ended up
settling on.

The [Metal documentation] recommends using
`MTLCopyAllDevicesWithObserver` to receive notifications of when
the list of available GPUs changes, such as when [external GPUs
are connected or disconnected]. I didn’t bother implementing that
because it seemed like a lot of fussy work to deal with migrating
everything to a new GPU on the fly just for a niche use case on a
legacy platform. Zed doesn’t implement it and I haven’t heard
about anyone complaining that their computer caught fire when they
unplugged an external GPU, so hopefully it’s fine.

[Metal documentation]: https://developer.apple.com/documentation/metal/gpu_devices_and_work_submission/multi-gpu_systems/finding_multiple_gpus_on_an_intel-based_mac
[external GPUs are connected or disconnected]: https://developer.apple.com/documentation/metal/gpu_devices_and_work_submission/multi-gpu_systems/handling_external_gpu_additions_and_removals

Closes: #2572
2024-11-04 00:35:21 +00:00
Emily
9c8b00f87d renderer/metal: release device on deinit() 2024-11-04 00:21:39 +00:00
Emily
e5f9f222b2 renderer/metal: use release() consistently
I’m not sure why this variation was here previously – maybe it
predated the introduction of `release()`?
2024-11-04 00:21:39 +00:00
FineFindus
89f7f88286 apprt/adw: reapply headerbar colors
Fixes a regression in ca42b4ca1c7a9319b7fbc17cabab0cbb4120f0fb that
caused the headerbar to no longer use the same color as the
ghostty-theme.
2024-11-03 19:42:58 +01:00
Mitchell Hashimoto
f04b6c8768 font/harfbuzz: force LTR font shaping
Fixes #2570
Related to #1740

See #1740 for details.
2024-11-03 09:51:51 -08:00
Mitchell Hashimoto
0ba3c67be5 Merge pull request #2562 from neurocyte/apprt-send-color_change-on-reset
apprt: also send color_change notifications when colors are reset
2024-11-02 09:46:12 -07:00
Jeffrey C. Ollie
6d8cf55040 gtk: use correct function to destroy window
adw_application_window_destroy and gtk_application_window_destroy do not
exist. I believe that this didn't trigger a compile error because the
errdefer got compiled out because there are no potential error returns
after this code in the function.
2024-11-01 10:33:18 -05:00
Kristófer R
3b0a34afbc Extract OSC 7 hostname parsing into helper functions 2024-10-31 21:55:02 -04:00
Kristófer R
3a3da82aa9 Update explanation for number of digits in port number
The explanation now refers to RFC 793 instead of just claiming some
arbitrary value as truth. The previous value was correct, but now there
is a proper source for the correct value.
2024-10-31 18:09:36 -04:00
CJ van den Berg
24f5050484 apprt: also send color_change notifications when colors are reset 2024-10-31 17:52:02 +01:00
Mitchell Hashimoto
b56cb7038a core: only do cursor click to move without a mouse selection 2024-10-31 09:34:46 -07:00
Mitchell Hashimoto
b11b5871e9 cli: do not parse actions (+command) after -e
Fixes #2506
2024-10-30 20:56:53 -04:00
Mitchell Hashimoto
c97c0858be macos: rectangle select only requires option + drag
Fixes #2537

This matches Terminal.app. iTerm2 requires cmd+option (our old
behavior). Kitty doesn't seem to support rectangle select or I couldn't
figure out how to make it work. WezTerm matches Terminal.app too.
Outside of terminal emulators, this is also the rectangular select
binding for neovim.
2024-10-30 20:47:24 -04:00
Mitchell Hashimoto
569d887de8 core: show mouse whenever focus state changes on surface
Related to #2525
2024-10-30 18:03:16 -04:00
Rick Calixte
e0c5bdc53b Terminal: Reinitialize screens on scrollback reset
When resetting the terminal screen, the memory buffer allocated for the
scrollback is now cleared by reinitializing the screen and falling back to the
current method if any of the attempts to reinitialize fail.

Closes #2464
2024-10-30 17:21:38 -04:00
Mitchell Hashimoto
1065359b9a apprt: rename set_bg/fg to "color_change" to report all color changes 2024-10-30 16:33:18 -04:00
CJ van den Berg
a2a1d93d5c apprt: propagate OSC10/11 (set term fore/background color) through to apprt
This is to allow the running apprt to set the UI theme to match the
terminal application coloring.
2024-10-30 17:35:34 +01:00
Qwerasd
487f08b1dd fix(PageList, Page): fix off-by-1 in map capacity checks
We're already using `>=`, we don't need to also use `- 1`
2024-10-28 15:41:34 -07:00
Mitchell Hashimoto
6109edd00b terminal: refactor hyperlink memory management
Fixes #2500
Based on #2508

This separates out the concept of a "hyperlink" from a "hyperlink page
entry." The difference is that the former has real Zig slices into
things like strings and the latter has offsets into terminal page
memory.

From this separation, the Page structure now has an `insertHyperlink`
function that takes a hyperlink and converts it to a page entry.

This does a couple things: (1) it moves page memory management out of
Screen and into Page which is historically more appropriate and (2) it
let's us more easily test hyperlinks from the Page unit tests.

Finally, this PR makes some error sets explicit.
2024-10-28 15:30:04 -07:00
Mitchell Hashimoto
df12e9bca5 Merge pull request #2507 from anmolw/themes-mouse-fix
Add an out of bounds check for mouse-selected themes in +list-themes
2024-10-28 09:56:50 -07:00
Kristófer R
892dc27896 Make sure a potential port component is considered during hostname validation 2024-10-28 00:50:24 -04:00
Jeffrey C. Ollie
348287c620 core: add a .txt extenstion to scrollback file
This should make it easier for open or xdg-open to find an appropriate
application to open the scrollback file with.
2024-10-27 16:03:18 -05:00
Anmol Wadhwani
70d850f8e4 make selection a const 2024-10-27 21:40:25 +05:30
Anmol Wadhwani
9190dd3ad7 Add an out of bounds check for mouse-selected themes in +list-themes 2024-10-27 20:51:21 +05:30
Mitchell Hashimoto
1aa932f810 font/coretext: use CTFontCreateForString for final codepoint fallback
Fixes #2499

We rely on CoreText's font discovery to find the best font for a
fallback by using the character set attribute. It appears that for some
codepoints, the character set attribute is not enough to find a font
that supports the codepoint.

In this case, we use CTFontCreateForString to find the font that
CoreText would use. The one subtlety here is we need to ignore the
last resort font, which just has replacement glyphs for all codepoints.

We already had a function to do this for CJK characters (#1637)
thankfully so we can just reuse that!

This also fixes a bug where CTFontCreateForString range param expects
the range length to be utf16 code units, not utf32.
2024-10-25 21:29:45 -07:00
Mitchell Hashimoto
734c8cec55 Merge pull request #2490 from futurepaul/quick-terminal-improvements
macos: quick terminal animate duration
2024-10-25 20:48:40 -07:00
Mitchell Hashimoto
3c8fc86d6f small rename 2024-10-25 19:23:17 -07:00
Paul Miller
f4ba95b2c5 add quick-terminal-animate-duration option 2024-10-25 19:17:38 -05:00
Mitchell Hashimoto
28751ae5b8 Merge pull request #2485 from axdank/move_current_Tab
gui: add move_current_tab action
2024-10-25 14:15:16 -07:00
axdank
e7bd60b28e fix type mismatch in moveTab function parameter 2024-10-25 16:53:13 -03:00
Mitchell Hashimoto
de5ec5d83e macos: make move_tab work 2024-10-25 11:54:07 -07:00
Mitchell Hashimoto
4885ffd042 input: note that toggle_split_zoom is macOS only 2024-10-25 09:34:53 -07:00
axdank
520dda65cb apply review changes 2024-10-25 08:07:11 -03:00
Mitchell Hashimoto
582b8d039a Merge pull request #2492 from johnseth97/macos-proxy-icon-fix
Macos proxy icon fix
2024-10-24 21:08:15 -07:00
Mitchell Hashimoto
495925355a config: make the proxy icon documentation more detailed 2024-10-24 20:56:45 -07:00
Mitchell Hashimoto
e5d7c38d06 Merge pull request #2482 from max397574/push-snqtmwzyxmwx
feat: make too big tab indices go to last tab
2024-10-24 20:02:57 -07:00
Mitchell Hashimoto
a793ad2f0d gtk: make goto_tab go to last tab if too large 2024-10-24 20:01:15 -07:00
Mitchell Hashimoto
a651dbf3bf macos: fix goto last tab 2024-10-24 19:58:13 -07:00
johnseth97
93f70ce237 added macos-titlebar-proxy-icon to config 2024-10-24 21:52:13 -04:00
Mitchell Hashimoto
8bb8b01e54 build: use Zig system packaging options
This allows dynamically linking against system libraries, which is
particularly useful for packaging.
2024-10-24 14:46:37 -07:00
axdank
23927d1fda removing unnecessary enum 2024-10-24 00:11:04 -03:00
axdank
465d60def8 gui: add move_current_tab action 2024-10-24 00:01:54 -03:00
Jon Parise
d7331f06e3 bash: stop modifying HISTCONTROL in bash-preexec.sh
This hack is only needed to improve the accuracy of the command argument
passed to the preexec functions, and we don't use that argument in our
bash shell integration script (and nor does the __bp_original_debug_trap
function above, which is the only other active preexec function).

See also:
- https://github.com/rcaloras/bash-preexec/issues/147
- https://github.com/rcaloras/bash-preexec/issues/115

Fixes #2269
2024-10-23 08:09:01 -04:00
Mitchell Hashimoto
5e001fcb64 Revert "config: change macos-option-as-alt default to left"
This reverts commit 31b6833ea1b0871eaa25512bcc82e3037d427ee1.
2024-10-22 08:34:52 -04:00
Marijn Besseling
4496e7d314 implement overline decoration (SGR 53/55) 2024-10-21 08:36:08 -04:00
Mitchell Hashimoto
fc6eda6623 cli: +help needs to use the proper args iterator 2024-10-19 10:43:08 -07:00
Mitchell Hashimoto
ebe8fb3ab3 Merge pull request #2458 from rockorager/cell-size
fix: report correct screen pixel size
2024-10-19 09:34:40 -07:00
Mitchell Hashimoto
ed1bb5eed3 Merge pull request #2460 from 0xcharly/font-codepoint-map
Tentative fix for unexpected `font-codepoint-map` behavior
2024-10-19 09:34:15 -07:00