16 Commits

Author SHA1 Message Date
Gregory Anders
f966a5a163 macos: add menu items to modify font size
Add a new "View" menu to the menu bar with items to increase, decrease,
or reset the font size.
2023-10-16 20:32:33 -05:00
Mitchell Hashimoto
21b46bd612 macos: change text to "toggle full screen" 2023-09-27 18:41:30 -07:00
Mitchell Hashimoto
57213547cd macos: custom fullscreen menu item to respect non-native fullscreen
Related to #392
2023-09-27 18:34:04 -07:00
Mitchell Hashimoto
711e3a5043 macos: add reload configuration to the Ghostty menu bar 2023-09-11 13:49:20 -07:00
Mitchell Hashimoto
ef5c5d1c0b macos: add split zoom to menu 2023-09-10 09:30:42 -07:00
Mitchell Hashimoto
10aaf8bd35 macos: sync all remaining menu items 2023-08-31 11:44:43 -07:00
Mitchell Hashimoto
76053460d5 macos: sync File menu 2023-08-31 11:40:21 -07:00
Mitchell Hashimoto
22b925223a macos: sync many more menu items 2023-08-31 11:33:58 -07:00
Mitchell Hashimoto
52396304ff macos: begin syncing menuitem key equivalents 2023-08-30 22:45:29 -07:00
Mitchell Hashimoto
5f5a23acc4 macos: help menu goes to the github repo 2023-08-05 15:03:17 -07:00
Mitchell Hashimoto
d895887361 macos: enable copy/paste menu items in "Edit" 2023-08-05 14:50:18 -07:00
Mitchell Hashimoto
2f6159b16d macos: quit menu should say "Ghostty" 2023-08-05 13:04:06 -07:00
Mitchell Hashimoto
bbe171f314 macos: remove unimplemented menu items 2023-08-05 11:59:57 -07:00
Thorsten Ball
1908895303 macos: re-add Edit submenu to main menu
This menu got list in #215 and with it we lost the ability to use the
macOS emoji picker via the `Cmd+Ctrl Space` shortcut, for example.

This adds a standard Edit menu back to the main menu.
2023-08-05 20:51:43 +02:00
Mitchell Hashimoto
bf190ba442 macos: merge AppController and AppDelegate, organize groups 2023-08-04 17:05:52 -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