2567 Commits

Author SHA1 Message Date
Mitchell Hashimoto
994d456223 set the title of the window 2023-08-04 17:24:28 -07:00
Mitchell Hashimoto
9105637697 macos: reorganize, rename, put files in groups 2023-08-04 17:17:18 -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
Mitchell Hashimoto
4df462ce6f Merge pull request #221 from mitchellh/default-title
zsh window title integration, better general title defaults
2023-08-04 11:26:20 -07:00
Mitchell Hashimoto
363e911f77 shell-integration/zsh: enable title changes 2023-08-04 11:14:45 -07:00
Mitchell Hashimoto
b11734bd67 default the title to the ghostty emoji
This only happens if the shell hasn't reported a pwd AND title.
2023-08-04 11:11:15 -07:00
Mitchell Hashimoto
fb2f635c91 termio/exec: default window title to the pwd if not reported
We rely on the shell to report the window title. If the shell doesn't
report the window title then we default to the pwd.
2023-08-04 11:07:59 -07:00
Mitchell Hashimoto
63ce5d67ed HTML tweak 2023-08-03 14:50:10 -07:00
Mitchell Hashimoto
bd1991f6f4 add README for testers 2023-08-03 10:52:29 -07:00
Mitchell Hashimoto
674bdac024 Merge pull request #217 from mitchellh/update-zig
Update Zig to nearly 0.11
2023-08-02 17:52:44 -07:00
Mitchell Hashimoto
9e3d59534d update build.zig required zig version 2023-08-02 16:18:27 -07:00
Mitchell Hashimoto
5c277bf9f9 update flatpak builder to correct zig version 2023-08-02 16:18:07 -07:00
Mitchell Hashimoto
2b5776b101 switch back to mach-glfw fork
So we don't need to fully adopt the Zig package manager yet.
2023-08-02 16:01:53 -07:00
Mitchell Hashimoto
dd18eaab5d fix various build scripts 2023-08-02 15:06:24 -07:00
Mitchell Hashimoto
d649b3f6d4 update zig 2023-08-02 14:39:19 -07:00
Mitchell Hashimoto
7324cccffc Merge pull request #216 from mitchellh/mrn/gtk-close-dialog
gtk: add missing space in close dialog and add newline
2023-08-01 08:09:21 -07:00
Thorsten Ball
3ab96f266b gtk: add missing space in close dialog and add newline
See before/after screenshots. Before, without the space, it's wrong. I
fixed that and added a newline, since a big paragraph like that looks a
bit wrong in a dialog popup.
2023-08-01 07:03:57 +02:00
Mitchell Hashimoto
4b3b42bc54 update zig 2023-07-28 10:22:58 -07:00
Mitchell Hashimoto
b459c6e002 Merge pull request #214 from mitchellh/mrn/gtk-default-keybinding-split
config: change default keybind for goto-split on non-Darwin
2023-07-23 15:59:45 -07:00
Mitchell Hashimoto
1b9c183d66 Merge pull request #213 from mitchellh/mrn/gtk-disable-border
gtk: remove thin, white border
2023-07-23 15:58:55 -07:00
Thorsten Ball
920b90ba1a config: change default keybind for goto-split on non-Darwin
Feel free to ignore or close this, because this is personal and if I
could figure out the syntax, I'm sure I could overwrite the keybindings
in the config myself.

But here's my case: `Ctrl+[` sends escape and I use that instead of
`Esc` because it's easier to reach (capslock is remapped to `ctrl`, so
`ctrl+[` is homerow only).

Kitty uses it's own "kittymod" combo for a lot of keybindings and for
the equivalent of these two, it uses `Ctrl+shift`. That's already taken
by other keybindings, so I added `.super` here.

Again: feel free to ignore. Personal preference. If you close this PR,
I'll have to tweak my config on Linux.
2023-07-23 14:02:39 +02:00
Thorsten Ball
a01a3fdcde gtk: remove thin, white border
The GTK app has a really thin, white border around the terminal
contents. It's really distracting when in fullscreen.

At first I thought it's the window that has a border, but turns out
that's not it. It's the GTK Notebook widget. Luckily for us, GTK4 has a
single API call that allows us to turn off the border.
2023-07-23 13:05:02 +02:00
Mitchell Hashimoto
587a5159a1 Merge pull request #212 from mitchellh/sgr
CSI for SGR only if there are no intermediates
2023-07-20 19:31:31 -07:00
Mitchell Hashimoto
e45c8d97d7 CSI for SGR only if there are no intermediates
Fixes #210

We were previously taking any `CSI <symbol> <data> m` as SGR. But SGR is
only if "symbol" is empty. There are other forms of `CSI m` that set the
intermediate symbol to `?` or `>` and we don't implement those. We
shouldn't treat that as a SGR attribute either.
2023-07-20 19:23:01 -07:00
Mitchell Hashimoto
595c855d76 Merge pull request #211 from mitchellh/update-zig
Update Zig
2023-07-20 19:02:17 -07:00
Mitchell Hashimoto
7ba68ce361 update libxev 2023-07-20 18:50:46 -07:00
Mitchell Hashimoto
57cd4ec4ca update zig 2023-07-20 18:49:29 -07:00
Mitchell Hashimoto
6faa7c195b Revert "update zig"
This reverts commit 11939915cd7345b353306ed14449bbb0be0c42e3.
2023-07-20 17:57:30 -07:00
Mitchell Hashimoto
11939915cd update zig 2023-07-20 17:50:23 -07:00
Mitchell Hashimoto
b49dd6e3b7 Merge pull request #208 from mitchellh/mrn/locale-lang
locale: set LANG to fallback locale
2023-07-18 22:08:15 -07:00
Thorsten Ball
5472d03832 locale: remove default value for local dev env
I commented this out to test something locally and it compiles & runs
fine on macOS with Xcode. Looks like it's not needed anymore.
2023-07-19 06:46:01 +02:00
Thorsten Ball
4b48d42a07 locale: set LANG to the fallback value if we have invalid locale
See #201 for more information.

Problem is that while we fall back to a default value to pass to
`setlocale`, we don't set a `LANG` and instead reset it to `""`.

What this does here is it changes the resetting to `""` and instead sets
it to the default value.
2023-07-19 06:44:35 +02:00
Mitchell Hashimoto
c9b0c42341 Merge pull request #207 from mitchellh/split-at-cursor
font/shaper: text runs should split around block cursors
2023-07-18 16:44:07 -07:00
Mitchell Hashimoto
4137c6cf69 font/shaper: do not break on merged emoji if cursor is directly on it 2023-07-18 16:38:02 -07:00
Mitchell Hashimoto
4b062dc45c font/shaper: text runs should split around block cursors
Fixes #206
2023-07-18 16:20:30 -07:00
Mitchell Hashimoto
1aec2f2ca5 update zig version 2023-07-18 10:59:09 -07:00
Mitchell Hashimoto
6ae3c4b20e Merge pull request #205 from mitchellh/locale2
reset LANG env var if we set it and it is invalid
2023-07-18 10:55:06 -07:00
Mitchell Hashimoto
f8ce52a9e1 Merge pull request #204 from mitchellh/mrn/blurry-fonts
Fix blurry fonts by flooring padding of surface
2023-07-18 10:54:54 -07:00
Mitchell Hashimoto
4176c6bdbf reset LANG env var if we set it and it is invalid
This was breaking downstream programs, see #201
2023-07-18 10:49:43 -07:00
Mitchell Hashimoto
3d48432daf renderer: change padding to integers
Screen size is always an integer, it makes sense for padding to also be
rounded to some integer.
2023-07-18 10:44:33 -07:00
Thorsten Ball
ead997b5ec Fix blurry fonts by flooring padding of surface
This fixes #99 for me.

Without this fix I end up with paddings of `3.333333` because my DPI is
`125.0` on Linux. If I set it to `144.0` manually so that the `/ 72`
gives me a clean `2.0`, the blurry fonts are gone.

I do think the calculation here is correct (even though I'm not sure
whether we should use 72? Why not 96? Or another system value?), so
let's use `std.math.floor` to get us to a "clean" padding of `3.0`.

That also solves blurry fonts for me.
2023-07-18 07:02:33 +02:00
Mitchell Hashimoto
5d77144e1b Merge pull request #203 from mrnugget/mrn/gtk-default-size
gtk: change default window size to 1000x600
2023-07-16 21:58:39 -07:00
Thorsten Ball
de5780a771 gtk: change default window size to 1000x600
The previous 200x200 looks ... weird :) But it was also quite unhandy
because I constantly have to resize new builds when I want to check
something.
2023-07-17 06:54:47 +02:00
Mitchell Hashimoto
24ec9f7e2a Merge pull request #202 from mitchellh/locale
validate locale prior to setting, fallback to en_US.UTF-8
2023-07-11 12:04:35 -07:00
Mitchell Hashimoto
0849aa8f20 validate locale prior to setting, fallback to en_US.UTF-8
Fixes #201

I don't fully understand locales, but it appears that the locale
returned from NSLocale can be "valid" in general but invalid according
to libc's locale API. If you attempt to `setlocale` with this bad
locale, it defaults everything to "C", which ends up breaking a lot of
things.

This commit validates the locale, and if it is invalid, we default to
"en_US.UTF-8" so things tend to work. This behavior can be overridden
using standard environment variables (LANG, LC_ALL, etc.).

This also doesn't touch env vars so further subprocesses from the shell
see original locale env vars.
2023-07-11 11:50:12 -07:00
Mitchell Hashimoto
bf25bf0a6a move a bunch of files to src/os 2023-07-10 16:48:22 -07:00
Mitchell Hashimoto
9300404603 font: block cursor was not taking full cell width 2023-07-10 11:45:35 -07:00
Mitchell Hashimoto
ea268bae5e renderer: do not blink explicit steady cursor styles 2023-07-10 11:27:37 -07:00