54 Commits

Author SHA1 Message Date
Gregory Anders
2ee80a52df macos: set window resizeIncrements when cell size changes
The resizeIncrements property is only modified when the cell size of the
focused window changes. If two splits have the same cell size then the
property is not modified when focusing between the two splits.
2023-10-26 20:27:58 -05:00
Gregory Anders
4681b95bb3 macos: force new window for "New Window" action
There is a setting in the macOS System Preferences called "Prefer tabs
when opening documents" (accessed through the userTabbingPreference
field of NSWindow) which, when set to "Always", makes the "New Window"
action open windows in tabs.

Ideally, this setting would be controlled on a per-app basis in macOS,
but unfortunately that is not the case. Because Ghostty explicitly
offers both "New Tab" and "New Window" actions, this user setting should
be ignored when creating new windows.
2023-10-09 09:20:52 -05:00
Mitchell Hashimoto
a040e807e8
macos: implement service provider 2023-10-04 12:11:23 -07:00
Mitchell Hashimoto
96b8fbb84d
macos: support dropping folder with window 2023-10-03 22:07:58 -07:00
Mitchell Hashimoto
d5299fec25
macos: use SurfaceConfiguration everywhere instead of bare c struct 2023-10-03 22:00:56 -07:00
Mitchell Hashimoto
00cb572a5b
macos: change close confirmations to NSAlert
Fixes #560
2023-10-03 09:53:15 -07:00
Mitchell Hashimoto
cc8e1cd936
macos: support initial window size 2023-09-30 20:47:31 -07:00
Mitchell Hashimoto
0e4b91de88
macos: stylistic changes 2023-09-28 08:34:27 -07:00
Gregory Anders
137d24db9c
macos: display keybinding instead of index in tab label 2023-09-28 08:28:46 -07:00
Gregory Anders
8f75e83958
macos: rename indexTabs() to relabelTabs()
This is a better name because the tab label may not necessarily be an
index (if a user binds some non-numeric key, for instance).
2023-09-28 08:28:46 -07:00
Gregory Anders
59ba6fac2b
macos: add tab index labels 2023-09-28 08:28:46 -07:00
Mitchell Hashimoto
960edee559
macos: background-opacity getter 2023-09-20 22:05:23 -07:00
SoraTenshi
833be445ba
Spawn alert box on new tab if decorations disabled
Stray spaces

Fix check for windowDecoration
2023-09-17 11:58:11 -07:00
Mitchell Hashimoto
2b380ad37e
macos: stylistic changes 2023-09-17 11:57:36 -07:00
Will Pragnell
81efb2dfe5
macos: always use latest window decoration config from runtime 2023-09-17 11:57:01 -07:00
SoraTenshi
ddb9be0971
Remove custom CAPI function
and use the already existing get_config function
2023-09-17 11:57:01 -07:00
SoraTenshi
ed8b5bc283
macos: allow to hide decorations 2023-09-17 11:57:00 -07:00
Mitchell Hashimoto
2dccf4596a
macos: consistent text 2023-09-15 15:58:14 -07:00
Mitchell Hashimoto
f8fea2f65b
macos: show warning in debug mode 2023-09-15 15:40:41 -07:00
Mitchell Hashimoto
c1fe1f6646
macos: AppState config must be published and observed
Fixes #440

We previously weren't observing changes so they weren't being
automatically propagated. We were using an old pointer which at best
returned the wrong value and at worst crashed. I was able to make it
crash eventually, too.

This changes the fields to be properly published and observed and as a
result the config is immediately available to all users.
2023-09-13 15:06:41 -07:00
Mitchell Hashimoto
9c42b9976a
macos: use appearance-sensitive bg color for error window
Fixes #432
2023-09-13 08:10:19 -07:00
Mitchell Hashimoto
a95a1a8838
macos: add button to ignore configuration errors
The popup will return on the next launch or configuration load.
2023-09-12 22:25:24 -07:00
Mitchell Hashimoto
42bbcbfb9b
macos: add a reload configuration button 2023-09-11 15:13:02 -07:00
Mitchell Hashimoto
ffd181f10d
macos: don't steal focus for config errors 2023-09-11 13:59:03 -07:00
Mitchell Hashimoto
6f7fdf002f
macos: hook up proper data events 2023-09-11 13:52:47 -07:00
Mitchell Hashimoto
4c0871b6dc
macos: don't clear contentview for configuration on close 2023-09-11 13:39:29 -07:00
Mitchell Hashimoto
f485672d4e
macos: fix some error window styling 2023-09-11 13:28:48 -07:00
Mitchell Hashimoto
db799d53e6
macos: UI for configuration errors 2023-09-11 13:21:13 -07:00
Mitchell Hashimoto
2b04a7114b
macos: use the configured unfocused split opacity 2023-09-10 18:52:40 -07:00
Mitchell Hashimoto
5f30223e84
macos: new window assertion is unnecessary
We handle both cases
2023-09-10 09:03:53 -07:00
Mitchell Hashimoto
f31bde48fc
macos: add prev/next tab custom binding support 2023-09-09 13:00:23 -07:00
Mitchell Hashimoto
8619351df7
macos: dock menu 2023-09-08 11:37:56 -07:00
Will Pragnell
7d9598fe6e macos: fix split focus when toggling fullscreen 2023-09-03 22:55:22 -07:00
Mitchell Hashimoto
e2282f1f4d
macos: zoomed splits put an emoji in the title bar 2023-09-02 16:33:33 -07:00
Will Pragnell
86122624e0 macos: add visible-menu non-native-fullscreen option 2023-09-01 21:45:45 -07:00
Karol Bakunowski
d7072cd29e
macos: default to sRGB color space 2023-09-01 15:05:16 -07:00
Mitchell Hashimoto
d945640401
macos: break reference cycle to window to allow window to free memory
Fixes #366

The comment in the Swift code explains what was happening here:

> I don't know if this is the right place, but because of WindowAccessor in our
> SwiftUI hierarchy, we have a reference cycle between view and window and windows
> are never freed. When the window is closed, the window controller is deinitialized,
> so we can use this opportunity detach the view from the window and break the cycle.

An alternate solution would be to make our reference back to the window
"weak" but we appear to not be able to do that with SwiftUI property
wrappers such as `@State` and `@Binding` and so on.
2023-09-01 09:12:03 -07:00
Thorsten Ball
be114e792f macOS: fix cascading windows when using tabs and closing windows
This fixes two things:

1. Issue #294: cascade point for new windows is set when creating new tabs
2. Cascade point was *not* reset when closing windows, which lead to a
   big "gap" appearing when, say, opening 5 windows, closing 4, opening
   a new window.
2023-08-19 20:21:20 +02:00
Thorsten Ball
a76aea4d0a macOS: new split can inherit font size 2023-08-19 09:59:04 +02:00
Thorsten Ball
2e9b787668 macOS: new window can inherit font size
This is the second part of #281 and adds the same mechanism that was
added for tabs in #296 for windows.

It works exactly the same way.
2023-08-19 09:29:56 +02:00
Mitchell Hashimoto
4f5460475c
Merge pull request #296 from mitchellh/mrn/macos-inherit-font-size
macOS: inherit font size when creating new tab
2023-08-18 09:22:06 -07:00
Mitchell Hashimoto
79971c62a6
macos: pass around a base surface_config_s rather than a new tab 2023-08-18 09:09:43 -07:00
Thorsten Ball
12311e9707 macOS: simplify code for new tab 2023-08-18 06:26:15 +02:00
Thorsten Ball
3e7c4475a1 macOS: move newTab code to PrimaryWindowManager 2023-08-17 20:57:00 +02:00
Thorsten Ball
d2dae7a696 macOS: inherit font size when creating new tab
This is one part of #281.
2023-08-17 20:56:56 +02:00
Thorsten Ball
0597b03fa2 macOS: remove dead code from PrimaryWindowController
I think this is a left-over from the refactor that moved this field to
the `PrimaryWindowManager`.
2023-08-17 07:04:46 +02:00
Kevin Hovsäter
22b8173164 Fix typos 2023-08-08 14:27:34 +02:00
Mitchell Hashimoto
2752995ec5
macos: Cmd-Q without any window focus works
Previously, this would crash. Once the crash was fixed, it would hang
because we would only show confirmation if the terminal window had
focus.

This introduces some medium complexity logic to work around this:

  1. If we are the key window, then show the confirmation dialog. Done.
  2. Otherwise, if any other window is a terminal window and is key,
     they're going to take it so we do nothing.
  3. Otherwise, if we are the first terminal window in the application
     windows list, we show it even if we're not focused.
2023-08-05 10:43:56 -07:00
Mitchell Hashimoto
7c98f991db
macos: new tab menu/shortcut works even if no windows are present 2023-08-04 17:45:57 -07:00
Mitchell Hashimoto
8c01160afa
macos: "+" button ensures tab is added to same window group 2023-08-04 17:39:40 -07:00