538 Commits

Author SHA1 Message Date
Thorsten Ball
90427a8d22 macos: respect window-new-tab-position configuration 2024-01-12 20:22:53 +01:00
Ryota
ad9de6707d Fix comment 2024-01-12 00:54:16 +00:00
Ryota
3baae1dce8 Wrap around split focus with next and previous 2024-01-12 00:53:47 +00:00
Ryota
3500293bac Add firstOrLast search based on next and previous 2024-01-12 00:53:19 +00:00
Ryota
ab8dfab9de Add helper func for first and last leaf 2024-01-12 00:52:26 +00:00
Ryota
d9c4bd7e25 Add helper functions for finding root 2024-01-12 00:52:17 +00:00
Mitchell Hashimoto
8b0d4312ee macos: invalidate restorable state whenever a terminal window is closed 2024-01-10 21:28:49 -08:00
Mitchell Hashimoto
837b551a92 macos: invalid restorable state whenever surface tree changes
Related to #1177

This detects whenever the surface tree (splits) change in any way and
requests that the restorable state be invalided by macOS.
2024-01-10 21:24:47 -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
Thorsten Ball
b7a715ec86 macos: allow submitting clipboard confirmation with return
Before this change I couldn't submit the dialog with return. Or
cmd+return.

From what I understand the problem was that the `TextEditor` always
steals the default focus. I tried a bunch of workarounds I found to set
the default focus on the button, but none of them worked.

Then I thought: do we even need a full-on Text*Editor*? So I switched
`TextEditor` to `Text` with a `ScrollView`: things look the same, text
is selectable and scrollable, but I can hit return to submit the dialog.
2024-01-10 06:58:56 +01:00
Mitchell Hashimoto
afb1fea48b macos: add Edit => Select All menu item
Fixes #1268
2024-01-09 20:54:23 -08:00
Mitchell Hashimoto
44544f29b2 macos: support Display P3 colorspace through configuration
Fixes #1214

This introduces the `window-colorspace` configuration which allows
configuring the colorspace to use for windows on macOS. The default is
sRGB (same as before) but this can also be set to `display-p3`.
2024-01-09 20:47:07 -08:00
Mitchell Hashimoto
42c10de814 macos: move active state to delegate 2024-01-05 12:32:18 -08:00
Vivek Roy
3aad646be2 macos: Address window spawning and ordering issues from service. 2024-01-06 00:35:34 +05:30
Mitchell Hashimoto
9bf13c6236 macos: set initial window size in controller window init
Fixes #1227
Fixes #1206

This moves the logic that respects `window-width` and `window-height` to
the controller window initialization. This is where it should've been
all the time but we previously didn't use a controller architecture so
we did our best to use heuristics in the view to do this.

This location now ensures that this only happens on window
initialization and only if we have one surface.
2024-01-05 09:42:50 -08:00
Mitchell Hashimoto
f93c41669e macos: order main window front on restore 2024-01-03 12:10:52 -08:00
Mitchell Hashimoto
c9ff034b62 macos: prevent super hot loop to restore focus state 2024-01-03 12:07:03 -08:00
Mitchell Hashimoto
ae7221d680 macos: try to save window state before sparkle restart 2024-01-03 11:53:18 -08:00
Mitchell Hashimoto
5e0e0b2bd4 macos: wait for window to become visible to set blur
Fixes #1181
2023-12-29 21:58:30 -08:00
Mitchell Hashimoto
6532ff73a8 macos: verify inspector is not nil before sending it to draw 2023-12-29 07:53:20 -08:00
Mitchell Hashimoto
40e882ff48 macos: invalid restorable state when surface is closed
Fixes #1177
2023-12-28 19:39:47 -08:00
Burak Yildiz
f3c6066be3 Reorder menu items (File, Edit, View ...) like most of the other apps 2023-12-28 21:43:24 +01:00
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
181cfa1350 macos: notifications use surface UUID for lookups
Fixes #1162
2023-12-27 08:49:12 -08:00
Mitchell Hashimoto
789107ff1b macos: text in about window is selectable
Fixes #1163

I also fixed the AppIconImage from being 1024x1024 to much smaller so we
don't see as many artifacts in the downsize.
2023-12-27 07:53:28 -08:00
Mitchell Hashimoto
2aa7f12417 macos: increment restorable state version 2023-12-26 14:45:39 -08:00
Mitchell Hashimoto
98041940f0 macos: restore focused split on app restore 2023-12-26 14:45:27 -08:00
Mitchell Hashimoto
a321ef515d macos: assign unique UUID per surface, store in app state 2023-12-26 14:24:05 -08:00
Mitchell Hashimoto
20f9a3baab macos: reset state version to 1 2023-12-23 18:59:19 -08:00
Mitchell Hashimoto
c3b89fa215 macos: use securecoding for codablebridge to prevent warning
Thanks Matt Polzin!
2023-12-23 18:49:41 -08:00
Mitchell Hashimoto
a8568306c9 macos: store pwd with save/restore state 2023-12-23 17:06:34 -08:00
Mitchell Hashimoto
2390668834 macos: encode surface tree in state restore 2023-12-23 13:15:46 -08:00
Mitchell Hashimoto
a5d249eb48 config: if window-save-state is never, never restore state 2023-12-22 22:00:25 -08:00
Mitchell Hashimoto
f0bf0fd888 config: window-save-state 2023-12-22 21:51:06 -08:00
Mitchell Hashimoto
59f54a1d88 macos: initial window save/restore is working for frames only 2023-12-22 21:24:27 -08:00
Chris Marchesi
e1320be757 macos: handle middle click
This adds middle-click support to MacOS.

Very simple update, since everything else is in place to handle mouse
clicks in the embedded runtime already, we just needed to add the event
handlers in the UI.
2023-12-22 00:05:28 -08:00
Vivek Roy
aa75e7dfd8 macos: Implement context menu functionality to open tabs and windows. 2023-12-22 11:20:42 +05:30
Mitchell Hashimoto
0acf783700 macos: set the update URL 2023-12-19 08:04:36 -08:00
Mitchell Hashimoto
25342f545b macos: add update delegate so we can configure some behavior 2023-12-18 19:09:45 -08:00
Mitchell Hashimoto
f192ffd5bc macos: boilerplate to setup updater menu item 2023-12-18 19:09:45 -08:00
Mitchell Hashimoto
68a23e786d macos: put build numbers back into info.plist, other metadata
This adds more metadata back into the Info.plist for a build. This
metadata is used with the About window. The reason I want the build
number back is so that we have a monotonically increasing number to do
self-updating with (i.e. Sparkle).
2023-12-18 18:56:34 -08:00
Mitchell Hashimoto
9c0de96c79 Merge pull request #1116 from clebs/feature/settings-shortcut
macos: Add settings shortcut
2023-12-18 08:08:48 -08:00
Mitchell Hashimoto
7600c761ef fix callback struct ordering, use internal_os.open 2023-12-18 08:00:40 -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
20ba6f3d78 macos: close_window binding works properly again
This binding closes the physical window and all surfaces in that window.
2023-12-17 20:29:23 -08:00
Mitchell Hashimoto
2e74a0f9d4 macos: custom about window so we can be a first responder
Fixes #1052

This implements the about window as a custom window with a view
controller. This lets us implement the proper responder chain so that
our custom close window IBActions do the right thing.

This has an additional benefit that we can easily customize this window
going forward.
2023-12-17 15:51:04 -08:00
Borja Clemente
646e3c365c Add settings shortcut on MacOS
- Settings shortcut opens the config file in the default editor.

Signed-off-by: Borja Clemente <borja.clemente@gmail.com>
2023-12-17 16:19:22 +01:00
Mitchell Hashimoto
9642dd3275 macos: proper event when sided mod released with other side pressed
Related to https://github.com/mitchellh/ghostty/issues/1082

This fixes two separate issues to follow along with the new spec changes
Kovid pushed to Kitty:

  1. When two modifiers are pressed and one is released, this shows up
     as a proper release event with the correct side. Previously, the
     correct side was shown but as a press event.

  2. When two modifiers are pressed and one is released, the Kitty event
     should not have that specific modifier set. For example, pressing
     left ctrl, then right ctrl, then releasing right ctrl should encode
     as "right ctrl released" but with NO modifiers still present.
2023-12-13 21:50:00 -08:00
Mitchell Hashimoto
9f7e53620b Merge pull request #1070 from mattrobenolt/overlay-color
Configurable unfocused dimming color
2023-12-13 19:10:22 -08:00