mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-01 23:48:35 +00:00
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.
This commit is contained in:
@@ -11,6 +11,12 @@ extension Ghostty {
|
||||
case loading, error, ready
|
||||
}
|
||||
|
||||
enum FontSizeModification {
|
||||
case increase(Int)
|
||||
case decrease(Int)
|
||||
case reset
|
||||
}
|
||||
|
||||
struct Info {
|
||||
var mode: ghostty_build_mode_e
|
||||
var version: String
|
||||
@@ -269,6 +275,20 @@ extension Ghostty {
|
||||
}
|
||||
}
|
||||
|
||||
func changeFontSize(surface: ghostty_surface_t, _ change: FontSizeModification) {
|
||||
let action = switch change {
|
||||
case .increase(let amount):
|
||||
"increase_font_size:\(amount)"
|
||||
case .decrease(let amount):
|
||||
"decrease_font_size:\(amount)"
|
||||
case .reset:
|
||||
"reset_font_size"
|
||||
}
|
||||
if (!ghostty_surface_binding_action(surface, action, UInt(action.count))) {
|
||||
AppDelegate.logger.warning("action failed action=\(action)")
|
||||
}
|
||||
}
|
||||
|
||||
// Called when the selected keyboard changes. We have to notify Ghostty so that
|
||||
// it can reload the keyboard mapping for input.
|
||||
@objc private func keyboardSelectionDidChange(notification: NSNotification) {
|
||||
|
Reference in New Issue
Block a user