33 Commits

Author SHA1 Message Date
Mitchell Hashimoto
5f9d4f9733 macos: fullscreen=true with non-native fullscreen works
Fixes #1377
2024-09-30 10:02:50 -07:00
Mitchell Hashimoto
718fa6042c macos: new fullscreen implementation 2024-09-30 09:42:46 -07:00
Mitchell Hashimoto
332e1a1494 macos: new FullscreenMode/Style architecture for fullscreen impls 2024-09-29 21:31:58 -07:00
Mitchell Hashimoto
1b31663865 apprt/embedded: new_window can be called without a parent 2024-09-24 18:33:10 -07:00
Qwerasd
16919488da macOS: add macos-titlebar-style = hidden
Hides titlebar without removing the other typical window frame elements
2024-09-20 16:11:51 -06:00
pnodet
7ff9af1520 style(macos): cleanup trailing spaces 2024-08-21 21:53:09 +02:00
Mitchell Hashimoto
45eecf801e macos: show alert when creating new tab in non-native fs
Fixes #1683

The root issue is #392 and we can likely find a way to fix it, but for
now let's prevent the full program hang by showing an alert.
2024-04-16 09:34:10 -07:00
Mitchell Hashimoto
875a774d4b macos: remove AppState and unify onto Ghostty.App cross-platform 2024-01-14 19:35:57 -08:00
Mitchell Hashimoto
eba3d5414d macos: Ghostty.Config to store all config-related operations 2024-01-14 15:53:33 -08:00
Thorsten Ball
2bf8dac864 macos: use switch statement instead of if-let 2024-01-13 08:32:50 +01:00
Thorsten Ball
90427a8d22 macos: respect window-new-tab-position configuration 2024-01-12 20:22:53 +01:00
Mitchell Hashimoto
8b0d4312ee macos: invalidate restorable state whenever a terminal window is closed 2024-01-10 21:28:49 -08:00
Mitchell Hashimoto
88c525d593 macos: minor style changes 2024-01-10 09:37:36 -08:00
Thorsten Ball
3e811dad2c macos: stop windows glitching when cascading
Noticed that windows glitch when cascading: they show up in center of
screen, then quickly move to the correct position at last-cascade point.

This fixes the issue, by moving the `showWindow` call to _after_ the
setting of the last cascade point.

Now if you look at the code and think: "shouldn't this work without the
async-dispatch, like this?"

```swift
if (!window.styleMask.contains(.fullScreen)) {
    Self.lastCascadePoint = window.cascadeTopLeft(from: Self.lastCascadePoint)
}
c.showWindow(self)
```

Then, yes, I had the same thought, but it doesn't. And as discussed on
Discord, we probably don't know what's going on behind the scenes.

So this is the simplified code of the version we have to live with:
async dispatching the cascade and non-cascade versions both.
2024-01-10 18:28:19 +01:00
Vivek Roy
3aad646be2 macos: Address window spawning and ordering issues from service. 2024-01-06 00:35:34 +05:30
Mitchell Hashimoto
0008fb0a27 macos: set surface tree on init in restore
This prevents an unnecessary SurfaceView from being created. Creating a
SurfaceView is very expensive because this starts multiple threads,
creates the pty, starts the pty process, etc.

Additionally, this was exposing what I believe to be #497 when restoring
state: a surface view was created and destroyed very quickly causing
hangs on some machines. This still needs to be resolved but the behavior
in this commit was still a bug anyways.
2023-12-27 20:12:46 -08:00
Mitchell Hashimoto
59f54a1d88 macos: initial window save/restore is working for frames only 2023-12-22 21:24:27 -08:00
Mitchell Hashimoto
97433d3aa1 macos: close all windows
Fixes #1052

This implements a `close_all_windows` binding in the core and implements
it for macOS specifically. This will ask for close confirmation if any
surface in any of the windows requires confirmation.

This is bound by default to option+shift+command+w to match Safari. The
binding is generall option+command+w but users may expect this to also
mean "Close All Other Tabs" which is the changed behavior if any tabs
are present in a standard macOS application. So I chose to follow Safari
instead.

This doesn't implement this feature for GTK, that's left as an exercise
for a contributor.
2023-12-17 20:54:57 -08:00
Mitchell Hashimoto
ec989d6b46 macos: newTab needs to call Controller.showWindow 2023-12-08 08:46:05 -08:00
Mitchell Hashimoto
4b25356625 macos: manually show window to handle mission control behavior
Fixes #1018
Fixes #1020

This disables the "visibleAtLaunch" configuration in the xib and
manually shows the window when it loads. This lets us carefully control
what happens particularly when a window is full screen (native) and part
of Mission Control.

Previously, the behavior depended on the Settings.app "Prefer tabs
when opening documents" setting, but we didn't handle every behavior
correctly (see #1018 and #1020). I couldn't find a way to robustly
handle all cases because there are no published macOS APIs for
interacting with Mission Control...

Plus, terminals aren't really "documents" so it did confuse at least one
user that Ghostty would follow this configuration. We just incidently
did because we use native tabbing.

This PR takes full control into our own hands. Our behavior is now:

  - If a new window is created from a native fullscreen window, the
    new window is created into native fullscreen.

  - If a new tab is created from a native fullscreen window, the
    tab is added to the existing window and does not create a new space.

  - If a window or tab is created from a non-fullscreen window, the
    existing behaviors remain.
2023-12-07 22:44:47 -08:00
Mitchell Hashimoto
3f76094d84 macos: handle the "+" button automatically adding the window to the tabs
Fixes #1010
2023-12-07 14:39:54 -08:00
Mitchell Hashimoto
6fed7cde19 macos: do not open an initial window if opening from URL 2023-12-01 19:28:06 -08:00
Mitchell Hashimoto
efe9721c98 macos: honor fullscreen setting 2023-11-06 08:52:36 -08:00
Mitchell Hashimoto
3bef50f0cf macos: deminiaturize on new tab 2023-11-03 09:35:14 -07:00
Mitchell Hashimoto
cad461fff7 macos: modify tabbing mode when entering/exiting fullscreen
Related to #799

With tabbing mode disabled, fullscreen (native) windows when creating a
new tab creates a window in the tab bar, but ALSO puts the window into a
new "screen" on macOS. When you click the tab bar, macOS animates
between screens. Its jarring!

This commit makes it so that in fullscreen we go back to automatic
tabbing even for new windows, which produces new windows within a tab.
This is normal default behavior for macOS tabbed programs. When you are
not in fullscreen or exit fullscreen, then the tabbing mode returns to
disabled so Ghostty can manage it.
2023-11-03 09:16:55 -07:00
Gregory Anders
6c340810a5 macos: fix tab labeling
Fixes a regression introduced in
https://github.com/mitchellh/ghostty/pull/772.
2023-11-03 07:40:56 -07:00
Gregory Anders
a844613a26 macos: always create new window on New Window action
Fixes: https://github.com/mitchellh/ghostty/issues/799
2023-11-03 07:34:17 -07:00
Mitchell Hashimoto
db309a0b61 macos: fix cascade points 2023-10-30 15:28:14 -07:00
Mitchell Hashimoto
b4c973cd23 macos: improved comments 2023-10-30 15:15:56 -07:00
Mitchell Hashimoto
ed1741730e macos: base config plumbed through 2023-10-30 11:53:05 -07:00
Mitchell Hashimoto
481d128405 macos: tab labels, detect window close 2023-10-30 09:50:52 -07:00
Mitchell Hashimoto
bee0f25d54 macos: new terminal view new tab/window 2023-10-30 09:06:24 -07:00
Mitchell Hashimoto
704c303cd1 macos: working on the new terminalmanager 2023-10-30 09:06:24 -07:00