51 Commits

Author SHA1 Message Date
Mitchell Hashimoto
960edee559 macos: background-opacity getter 2023-09-20 22:05:23 -07:00
Mitchell Hashimoto
3ad39dd5e4 macos: sync NSAppearance for app based on window-theme setting 2023-09-20 21:54:50 -07:00
Mitchell Hashimoto
5a02635d2c macos: async style clipboard reading 2023-09-19 10:36:17 -07:00
Mitchell Hashimoto
d911c49f44 macos: remove unnecessary call 2023-09-17 12:01:36 -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
Mitchell Hashimoto
f8fea2f65b macos: show warning in debug mode 2023-09-15 15:40:41 -07:00
Mitchell Hashimoto
724900f143 macos: implement setCursorVisibility 2023-09-14 19:37:30 -07:00
Mitchell Hashimoto
cb2931cb27 rename cursor shape to mouse shape for OSC 22 2023-09-14 11:12:17 -07:00
Mitchell Hashimoto
3356146bb4 macos: support cursor style 2023-09-14 10:40:40 -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
999d17c49d macos: integrate needsConfirmQuit to quit if all windows are at prompt 2023-09-11 15:44:28 -07:00
Mitchell Hashimoto
2f0905b60c macos: reload config MUST go through Zig core 2023-09-11 15:20:31 -07:00
Mitchell Hashimoto
711e3a5043 macos: add reload configuration to the Ghostty menu bar 2023-09-11 13:49:20 -07:00
Mitchell Hashimoto
db799d53e6 macos: UI for configuration errors 2023-09-11 13:21:13 -07:00
Mitchell Hashimoto
f0ee2fb454 macos: log configuration errors 2023-09-11 09:39:58 -07:00
Mitchell Hashimoto
2b04a7114b macos: use the configured unfocused split opacity 2023-09-10 18:52:40 -07:00
Mitchell Hashimoto
ef5c5d1c0b macos: add split zoom to menu 2023-09-10 09:30:42 -07:00
Mitchell Hashimoto
4570356e57 turn zoom into a toggle rather than an explicit zoom/unzoom 2023-09-02 16:03:51 -07:00
Mitchell Hashimoto
70bdc21d22 macos: support zoomed splits 2023-09-02 15:51:10 -07:00
Will Pragnell
86122624e0 macos: add visible-menu non-native-fullscreen option 2023-09-01 21:45:45 -07:00
Mitchell Hashimoto
b7508cdc66 macos: setup delegate for app state, config reload callback 2023-08-31 11:56:15 -07:00
Mitchell Hashimoto
c71979804e apprt/embedded: ghostty_surface_binding_action can now run any action 2023-08-30 21:46:38 -07: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
a18503fc01 macos: can always set base config on new tab 2023-08-18 09:21:47 -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
cda87a6963 embedded: use separate struct to pass options to new_tab_cb 2023-08-18 06:50:47 +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
Mitchell Hashimoto
57a527b0c9 macos: detect keyboard layout change and reload the keymap 2023-08-11 12:01:59 -07:00
Mitchell Hashimoto
688ab84661 apprt/embedded: allow noting that selection clipboard is not supported 2023-08-09 14:52:22 -07:00
Mitchell Hashimoto
afc6a9976f apprt/embedded: support selection clipboard 2023-08-09 14:29:39 -07:00
Mitchell Hashimoto
bf190ba442 macos: merge AppController and AppDelegate, organize groups 2023-08-04 17:05:52 -07:00
Thorsten Ball
b56ffa6285 Add config setting to turn non-native fullscreen on or off 2023-08-04 14:12:33 -07:00
Thorsten Ball
850bf3e945 macos: add support for non-native fullscreen mode
This adds support for what's commonly referred to as "non-native
fullscreen": a fullscreen-mode that doesn't use macOS' native fullscreen
mechanism and thus doesn't use animations and a separate space on which
to display the fullscreen window. Instead it's really fast and it allows
the user to `Cmd+tab` to other windows, with the fullscreen-ed window
staying in the background.

Another name for it is "traditional fullscreen" since it was the default
pre Mac OS X Lion, if I remember correctly.

Other applications that offer macOS non-native fullscreen:

- Kitty: https://sw.kovidgoyal.net/kitty/conf/#opt-kitty.macos_traditional_fullscreen
- wezterm: https://wezfurlong.org/wezterm/config/lua/config/native_macos_fullscreen_mode.html
- MacVim
- IINA: fc66b27d50/iina/MainWindowController.swift (L1401-L1423)
- mpv: https://mpv.io/manual/stable/#options-native-fs
- iTerm2

Adding this wasn't straightforward, as it turned out. Mainly because
SwiftUI's app lifecycle management doesn't allow one to use a custom
class for the windows it creates. And without custom classes we'd always
get a warning when entering/leaving fullscreen mode.

So what I did here is the following:

- remove SwiftUI app lifecycle management
- introduce `MainMenu.xib` to define the main menu via interface builder
- add `GhosttyAppController` to handle requests from the app
- add a `main.swift` file to boot up the app without a storyboard and
  without SwiftUI lifecycle management
- introduce the `FullScreenHandler` to manage non-native fullscreen -
  this is where the "magic" is

But since removing the SwiftUI lifecycle management also means removing
the top-level `App` that means I had to introduce the menu (which I
mentioned), but also tab and window management.

So I also added the `WindowService` which manages open tabs and windows.
It's based on the ideas presented in

    https://christiantietze.de/posts/2019/07/nswindow-tabbing-multiple-nswindowcontroller/

and essentially keeps tracks of windows.

Then there's some auxilliary changes: `CustomWindow` and `WindowController` and so on.

Now everything still works, in addition to non-native fullscreen:

* opening/closing of tabs
* opening/closing of windows
* splits
* `gotoTab`

Worthy of note: when toggling back from non-native fullscreen to
non-fullscreen I had to manually implement the logic to re-add the
window back to a tabgroup. The only other app that supports tabs with
non-native FS is iTerm2 and they have implemented their own tab
management to keep the tab bar even in non-native FS -- that's a bit too
much for me. Every other app has non-native apps and doesn't have to
wory about it.
2023-08-04 14:12:30 -07:00
Thorsten Ball
8e464db049 Toggle fullscreen on super/ctrl+return, only macOS for now
This fixes or at least is the first step towards #171:

- it adds `cmd/super + return` as the default keybinding to toggle
  fullscreen for currently focused window.
- it adds a keybinding handler to the embedded apprt and then changes
  the macOS app to handle the keybinding by toggling currently focused
  window.
2023-07-02 20:23:49 +02:00
Thorsten Ball
6ff3f62e3a macOS: implement cmd+[0-9] to goto tab
This is my attempt at fixing #63. It works! But:

1. The `NotificationCenter` subscription is triggered once for every
   open tab. That's obviously wrong. But I'm not sure and could use some
   pointers where else to put the subscription. That leads me to...
2. I'm _not_ knowledgable in Swift/AppKit/SwiftUI, so I might have put
   the wrong/right things in the wrong/right places. For example: wasn't
   sure what's to be handled in Swift and what's to be handled by the
   core in Zig.

Would love some pointers :)
2023-07-01 09:08:02 -07:00
Mitchell Hashimoto
f36a35ecc9 core: quit flag is reset after tick 2023-03-27 10:10:06 -07:00
Mitchell Hashimoto
a1831ecacb macos: show close confirmation if running process exists 2023-03-26 10:40:38 -07:00
Mitchell Hashimoto
86c4a8ed7d apprt/embedded: support new process alive callback on close 2023-03-25 16:41:18 -07:00
Mitchell Hashimoto
b26e51d222 macos: implement config reloading callback 2023-03-19 09:50:54 -07:00
Mitchell Hashimoto
8d3f40fa41 apprt/embedded: reload config support 2023-03-19 09:50:54 -07:00
Mitchell Hashimoto
04b1625a68 ghostty.h: fix type usage before declaration 2023-03-15 15:55:52 -07:00
Mitchell Hashimoto
04c38ef3b0 macos: change focus callback to use an enum so we can get other dirs 2023-03-11 17:44:00 -08:00
Mitchell Hashimoto
18cf0dc9fc macos: put next/prev split focus into menu 2023-03-11 17:25:39 -08:00
Mitchell Hashimoto
b582691185 macos: hook up all the bindings so we're ready to handle focus event 2023-03-11 16:22:04 -08:00
Mitchell Hashimoto
f85c1c256c macos: menu bar to split 2023-03-10 15:24:45 -08:00
Mitchell Hashimoto
a265e7ce20 macos: take over menu bar, separate close and close window 2023-03-10 14:27:55 -08:00
Mitchell Hashimoto
6c857877e8 apprt/embedded: close surface callback 2023-03-08 15:05:15 -08:00
Mitchell Hashimoto
fa9ee0815f apprt/embedded: newSplit callback 2023-03-08 14:56:50 -08:00