macOS: add description as hover tooltip

This commit is contained in:
Mitchell Hashimoto
2025-04-22 08:36:12 -07:00
parent 3e5fe5de9a
commit 5427b0b507
2 changed files with 3 additions and 0 deletions

View File

@ -3,6 +3,7 @@ import SwiftUI
struct CommandOption: Identifiable, Hashable {
let id = UUID()
let title: String
let description: String?
let shortcut: String?
let action: () -> Void
@ -222,6 +223,7 @@ fileprivate struct CommandRow: View {
)
.cornerRadius(6)
}
.help(option.description ?? "")
.buttonStyle(PlainButtonStyle())
.onHover { hovering in
hoveredID = hovering ? option.id : nil

View File

@ -39,6 +39,7 @@ struct TerminalCommandPaletteView: View {
let action = String(cString: c.action)
return CommandOption(
title: String(cString: c.title),
description: String(cString: c.description),
shortcut: ghosttyConfig.keyboardShortcut(for: action)?.description
) {
onAction(action)