28 Commits

Author SHA1 Message Date
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
Mitchell Hashimoto
1a3cd852f9 macos: massive reorg 2023-03-06 21:28:09 -08:00