Template-Bundle ghostty-template/Ghostty.app aufnehmen

War durch .gitignore-Regel *.app/ ausgeschlossen; make-ghostty-app.sh
braucht es aber als Basis. Explizit per git add -f aufgenommen.
This commit is contained in:
marcus.hinz
2026-06-24 18:52:00 +02:00
parent 401ddd6f98
commit ce173ebbdf
602 changed files with 45249 additions and 0 deletions
@@ -0,0 +1 @@
Versions/Current/Autoupdate
@@ -0,0 +1 @@
Versions/Current/Resources
@@ -0,0 +1 @@
Versions/Current/Sparkle
@@ -0,0 +1 @@
Versions/Current/Updater.app
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>25D125</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>Sparkle</string>
<key>CFBundleIdentifier</key>
<string>org.sparkle-project.Sparkle</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Sparkle</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.9.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>2053</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>25C57</string>
<key>DTPlatformName</key>
<string>macosx</string>
<key>DTPlatformVersion</key>
<string>26.2</string>
<key>DTSDKBuild</key>
<string>25C57</string>
<key>DTSDKName</key>
<string>macosx26.2</string>
<key>DTXcode</key>
<string>2620</string>
<key>DTXcodeBuild</key>
<string>17C52</string>
<key>LSMinimumSystemVersion</key>
<string>10.13</string>
</dict>
</plist>
@@ -0,0 +1,13 @@
@media (prefers-color-scheme: dark) {
html {
color-scheme: dark;
color: white;
background: transparent;
}
:link {
color: #419CFF;
}
:link:active {
color: #FF1919;
}
}
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>25D125</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>Updater</string>
<key>CFBundleIdentifier</key>
<string>org.sparkle-project.Sparkle.Updater</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>ca</string>
<string>ar</string>
<string>cs</string>
<string>da</string>
<string>de</string>
<string>el</string>
<string>es</string>
<string>fa</string>
<string>fi</string>
<string>fr</string>
<string>he</string>
<string>hr</string>
<string>hu</string>
<string>is</string>
<string>it</string>
<string>ja</string>
<string>ko</string>
<string>nb</string>
<string>nl</string>
<string>nn</string>
<string>pl</string>
<string>pt-BR</string>
<string>pt-PT</string>
<string>ro</string>
<string>ru</string>
<string>sk</string>
<string>sl</string>
<string>sv</string>
<string>th</string>
<string>tr</string>
<string>uk</string>
<string>vi</string>
<string>zh_CN</string>
<string>zh_HK</string>
<string>zh_TW</string>
</array>
<key>CFBundleName</key>
<string>Updater</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.9.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>2053</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>25C57</string>
<key>DTPlatformName</key>
<string>macosx</string>
<key>DTPlatformVersion</key>
<string>26.2</string>
<key>DTSDKBuild</key>
<string>25C57</string>
<key>DTSDKName</key>
<string>macosx26.2</string>
<key>DTXcode</key>
<string>2620</string>
<key>DTXcodeBuild</key>
<string>17C52</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
<string>10.13</string>
<key>LSUIElement</key>
<string>1</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict>
<key>Resources/SUStatus.nib</key>
<data>
4v8P2HfH6ueONuvXrQq9XN2iUUQ=
</data>
</dict>
<key>files2</key>
<dict>
<key>Resources/SUStatus.nib</key>
<dict>
<key>hash2</key>
<data>
Qw/E5n9JX0l4RAAjHNKNPlL01zSswWCEFb2cX29ws70=
</data>
</dict>
</dict>
<key>rules</key>
<dict>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>25D125</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>Downloader</string>
<key>CFBundleIdentifier</key>
<string>org.sparkle-project.DownloaderService</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Downloader</string>
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>2.9.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>2053</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>25C57</string>
<key>DTPlatformName</key>
<string>macosx</string>
<key>DTPlatformVersion</key>
<string>26.2</string>
<key>DTSDKBuild</key>
<string>25C57</string>
<key>DTSDKName</key>
<string>macosx26.2</string>
<key>DTXcode</key>
<string>2620</string>
<key>DTXcodeBuild</key>
<string>17C52</string>
<key>LSMinimumSystemVersion</key>
<string>10.13</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<false/>
</dict>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2016 Sparkle Project. All rights reserved.</string>
<key>XPCService</key>
<dict>
<key>RunLoopType</key>
<string>NSRunLoop</string>
<key>ServiceType</key>
<string>Application</string>
</dict>
</dict>
</plist>
@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict/>
<key>files2</key>
<dict/>
<key>rules</key>
<dict>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>25D125</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>Installer</string>
<key>CFBundleIdentifier</key>
<string>org.sparkle-project.InstallerLauncher</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Installer</string>
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>2.9.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>2053</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>25C57</string>
<key>DTPlatformName</key>
<string>macosx</string>
<key>DTPlatformVersion</key>
<string>26.2</string>
<key>DTSDKBuild</key>
<string>25C57</string>
<key>DTSDKName</key>
<string>macosx26.2</string>
<key>DTXcode</key>
<string>2620</string>
<key>DTXcodeBuild</key>
<string>17C52</string>
<key>LSMinimumSystemVersion</key>
<string>10.13</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2016 Sparkle Project. All rights reserved.</string>
<key>XPCService</key>
<dict>
<key>JoinExistingSession</key>
<true/>
<key>ServiceType</key>
<string>Application</string>
</dict>
</dict>
</plist>
@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict/>
<key>files2</key>
<dict/>
<key>rules</key>
<dict>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>
@@ -0,0 +1 @@
Versions/Current/XPCServices
@@ -0,0 +1,203 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>25F80</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>Ghostty</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>command</string>
<string>tool</string>
<string>sh</string>
<string>zsh</string>
<string>csh</string>
<string>pl</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>AppIcon.icns</string>
<key>CFBundleTypeName</key>
<string>Terminal scripts</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Folders</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.directory</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Shell</string>
<key>LSItemContentTypes</key>
<array>
<string>public.unix-executable</string>
</array>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>ghostty</string>
<key>CFBundleIconFile</key>
<string>Ghostty</string>
<key>CFBundleIconName</key>
<string>Ghostty</string>
<key>CFBundleIdentifier</key>
<string>com.mitchellh.ghostty</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Ghostty</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.1</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>25F70</string>
<key>DTPlatformName</key>
<string>macosx</string>
<key>DTPlatformVersion</key>
<string>26.5</string>
<key>DTSDKBuild</key>
<string>25F70</string>
<key>DTSDKName</key>
<string>macosx26.5</string>
<key>DTXcode</key>
<string>2650</string>
<key>DTXcodeBuild</key>
<string>17F42</string>
<key>GhosttyBuild</key>
<string></string>
<key>GhosttyCommit</key>
<string></string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSEnvironment</key>
<dict>
<key>GHOSTTY_MAC_LAUNCH_SOURCE</key>
<string>app</string>
</dict>
<key>LSMinimumSystemVersion</key>
<string>13.0</string>
<key>MDItemKeywords</key>
<string>Terminal</string>
<key>NSAppleEventsUsageDescription</key>
<string>A program running within Ghostty would like to use AppleScript.</string>
<key>NSAppleScriptEnabled</key>
<true/>
<key>NSAutoFillRequiresTextContentTypeForOneTimeCodeOnMac</key>
<true/>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>A program running within Ghostty would like to use Bluetooth.</string>
<key>NSCalendarsUsageDescription</key>
<string>A program running within Ghostty would like to access your Calendar.</string>
<key>NSCameraUsageDescription</key>
<string>A program running within Ghostty would like to use the camera.</string>
<key>NSContactsUsageDescription</key>
<string>A program running within Ghostty would like to access your Contacts.</string>
<key>NSDockTilePlugIn</key>
<string>DockTilePlugin.plugin</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSLocalNetworkUsageDescription</key>
<string>A program running within Ghostty would like to access the local network.</string>
<key>NSLocationUsageDescription</key>
<string>A program running within Ghostty would like to access your location information.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSMicrophoneUsageDescription</key>
<string>A program running within Ghostty would like to use your microphone.</string>
<key>NSMotionUsageDescription</key>
<string>A program running within Ghostty would like to access motion data.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>A program running within Ghostty would like to access your Photo Library.</string>
<key>NSRemindersUsageDescription</key>
<string>A program running within Ghostty would like to access your reminders.</string>
<key>NSServices</key>
<array>
<dict>
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>New Ghostty Tab Here</string>
</dict>
<key>NSMessage</key>
<string>openTab</string>
<key>NSRequiredContext</key>
<dict>
<key>NSTextContent</key>
<string>FilePath</string>
</dict>
<key>NSSendTypes</key>
<array>
<string>NSFilenamesPboardType</string>
<string>public.plain-text</string>
</array>
</dict>
<dict>
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>New Ghostty Window Here</string>
</dict>
<key>NSMessage</key>
<string>openWindow</string>
<key>NSRequiredContext</key>
<dict>
<key>NSTextContent</key>
<string>FilePath</string>
</dict>
<key>NSSendTypes</key>
<array>
<string>NSFilenamesPboardType</string>
<string>public.plain-text</string>
</array>
</dict>
</array>
<key>NSSpeechRecognitionUsageDescription</key>
<string>A program running within Ghostty would like to use speech recognition.</string>
<key>NSSystemAdministrationUsageDescription</key>
<string>A program running within Ghostty requires elevated privileges.</string>
<key>OSAScriptingDefinition</key>
<string>Ghostty.sdef</string>
<key>SUEnableAutomaticChecks</key>
<false/>
<key>SUPublicEDKey</key>
<string>wsNcGf5hirwtdXMVnYoxRIX/SqZQLMOsYlD3q3imeok=</string>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>Ghostty Surface Identifier</string>
<key>UTTypeIdentifier</key>
<string>com.mitchellh.ghosttySurfaceId</string>
<key>UTTypeTagSpecification</key>
<dict/>
</dict>
</array>
</dict>
</plist>
Binary file not shown.
@@ -0,0 +1 @@
APPL????
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>25F80</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>Ghostty Dock Tile Plugin</string>
<key>CFBundleExecutable</key>
<string>DockTilePlugin</string>
<key>CFBundleIdentifier</key>
<string>com.mitchellh.ghostty-dock-tile</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>DockTilePlugin</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>0.1</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>25F70</string>
<key>DTPlatformName</key>
<string>macosx</string>
<key>DTPlatformVersion</key>
<string>26.5</string>
<key>DTSDKBuild</key>
<string>25F70</string>
<key>DTSDKName</key>
<string>macosx26.5</string>
<key>DTXcode</key>
<string>2650</string>
<key>DTXcodeBuild</key>
<string>17F42</string>
<key>LSMinimumSystemVersion</key>
<string>13.0</string>
</dict>
</plist>
Binary file not shown.
@@ -0,0 +1,318 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd">
<dictionary title="Ghostty Scripting Dictionary">
<suite name="Ghostty Suite" code="Ghst" description="Ghostty scripting support.">
<class name="application" code="capp" description="The Ghostty application.">
<cocoa class="NSApplication"/>
<property name="name" code="pnam" type="text" access="r" description="The name of the application."/>
<property name="frontmost" code="pisf" type="boolean" access="r" description="Is this the active application?">
<cocoa key="isActive"/>
</property>
<property name="front window" code="GFWn" type="window" access="r" description="The frontmost Ghostty window.">
<cocoa key="frontWindow"/>
</property>
<property name="version" code="vers" type="text" access="r" description="The version number of the application."/>
<responds-to command="perform action">
<cocoa method="handlePerformActionScriptCommand:"/>
</responds-to>
<responds-to command="new window">
<cocoa method="handleNewWindowScriptCommand:"/>
</responds-to>
<responds-to command="new tab">
<cocoa method="handleNewTabScriptCommand:"/>
</responds-to>
<responds-to command="new surface configuration">
<cocoa method="handleNewSurfaceConfigurationScriptCommand:"/>
</responds-to>
<responds-to command="quit">
<cocoa method="handleQuitScriptCommand:"/>
</responds-to>
<element type="window" access="r">
<cocoa key="scriptWindows"/>
</element>
<element type="terminal" access="r">
<cocoa key="terminals"/>
</element>
</class>
<class name="window" code="Gwnd" plural="windows" description="A Ghostty window containing one or more tabs.">
<cocoa class="GhosttyScriptWindow"/>
<property name="id" code="ID " type="text" access="r" description="Stable ID for this window."/>
<property name="name" code="pnam" type="text" access="r" description="The title of the window.">
<cocoa key="title"/>
</property>
<property name="selected tab" code="GWsT" type="tab" access="r" description="The selected tab in this window.">
<cocoa key="selectedTab"/>
</property>
<responds-to command="activate window">
<cocoa method="handleActivateWindowCommand:"/>
</responds-to>
<responds-to command="close window">
<cocoa method="handleCloseWindowCommand:"/>
</responds-to>
<element type="tab" access="r">
<cocoa key="tabs"/>
</element>
<element type="terminal" access="r">
<cocoa key="terminals"/>
</element>
</class>
<class name="tab" code="Gtab" plural="tabs" description="A tab within a Ghostty window.">
<cocoa class="GhosttyScriptTab"/>
<property name="id" code="ID " type="text" access="r" description="Stable ID for this tab."/>
<property name="name" code="pnam" type="text" access="r" description="The title of the tab.">
<cocoa key="title"/>
</property>
<property name="index" code="pidx" type="integer" access="r" description="1-based index of this tab in its window."/>
<property name="selected" code="GTsl" type="boolean" access="r" description="Whether this tab is selected in its window."/>
<property name="focused terminal" code="GTfT" type="terminal" access="r" description="The currently focused terminal surface in this tab.">
<cocoa key="focusedTerminal"/>
</property>
<responds-to command="select tab">
<cocoa method="handleSelectTabCommand:"/>
</responds-to>
<responds-to command="close tab">
<cocoa method="handleCloseTabCommand:"/>
</responds-to>
<element type="terminal" access="r">
<cocoa key="terminals"/>
</element>
</class>
<class name="terminal" code="Gtrm" plural="terminals" description="An individual terminal surface.">
<cocoa class="GhosttyScriptTerminal"/>
<property name="id" code="ID " type="text" access="r" description="Stable ID for this terminal surface."/>
<property name="name" code="pnam" type="text" access="r" description="Current terminal title.">
<cocoa key="title"/>
</property>
<property name="working directory" code="Gwdr" type="text" access="r" description="Current working directory for the terminal process."/>
<responds-to command="split">
<cocoa method="handleSplitCommand:"/>
</responds-to>
<responds-to command="focus">
<cocoa method="handleFocusCommand:"/>
</responds-to>
<responds-to command="close">
<cocoa method="handleCloseCommand:"/>
</responds-to>
</class>
<record-type name="surface configuration" code="GScf" description="Reusable settings applied when creating a terminal surface.">
<property name="font size" code="GScF" type="real" description="Font size in points.">
<cocoa key="fontSize"/>
</property>
<property name="initial working directory" code="GScD" type="text" description="Initial working directory for the terminal process.">
<cocoa key="workingDirectory"/>
</property>
<property name="command" code="GScC" type="text" description="Command to execute instead of the configured shell.">
<cocoa key="command"/>
</property>
<property name="initial input" code="GScI" type="text" description="Input sent to the terminal after launch.">
<cocoa key="initialInput"/>
</property>
<property name="wait after command" code="GScW" type="boolean" description="Keep the terminal open after command exit.">
<cocoa key="waitAfterCommand"/>
</property>
<property name="environment variables" code="GScE" description="Environment variables in KEY=VALUE format.">
<type type="text" list="yes"/>
<cocoa key="environmentVariables"/>
</property>
</record-type>
<enumeration name="split direction" code="GSpD" description="Direction for a new split.">
<enumerator name="right" code="GSrt" description="Split to the right."/>
<enumerator name="left" code="GSlf" description="Split to the left."/>
<enumerator name="down" code="GSdn" description="Split downward."/>
<enumerator name="up" code="GSup" description="Split upward."/>
</enumeration>
<enumeration name="input action" code="GIAc" description="Whether an input is pressed or released.">
<enumerator name="press" code="GIpr" description="Press."/>
<enumerator name="release" code="GIrl" description="Release."/>
</enumeration>
<enumeration name="mouse button" code="GMBt" description="A mouse button.">
<enumerator name="left button" code="GMlf" description="Left mouse button."/>
<enumerator name="right button" code="GMrt" description="Right mouse button."/>
<enumerator name="middle button" code="GMmd" description="Middle mouse button."/>
</enumeration>
<enumeration name="scroll momentum" code="GSMo" description="Momentum phase for inertial scrolling.">
<enumerator name="none" code="SMno" description="No momentum."/>
<enumerator name="began" code="SMbg" description="Momentum began."/>
<enumerator name="changed" code="SMch" description="Momentum changed."/>
<enumerator name="ended" code="SMen" description="Momentum ended."/>
<enumerator name="cancelled" code="SMcn" description="Momentum cancelled."/>
<enumerator name="may begin" code="SMmb" description="Momentum may begin."/>
<enumerator name="stationary" code="SMst" description="Stationary."/>
</enumeration>
<command name="perform action" code="GhstPfAc" description="Perform a Ghostty action string on a terminal.">
<direct-parameter type="text" description="The Ghostty action string."/>
<parameter name="on" code="GonT" type="terminal" description="Target terminal."/>
<result type="boolean" description="True when the action was performed."/>
</command>
<command name="new surface configuration" code="GhstNSCf" description="Create a reusable surface configuration object.">
<parameter name="from" code="GScS" type="surface configuration" optional="yes" description="Surface configuration to copy.">
<cocoa key="configuration"/>
</parameter>
<result type="surface configuration" description="The newly created surface configuration."/>
</command>
<command name="new window" code="GhstNWin" description="Create a new Ghostty window.">
<parameter name="with configuration" code="GNwS" type="surface configuration" optional="yes" description="Base surface configuration for the initial terminal.">
<cocoa key="configuration"/>
</parameter>
<result type="window" description="The newly created window."/>
</command>
<command name="new tab" code="GhstNTab" description="Create a new Ghostty tab.">
<parameter name="in" code="GNtW" type="window" optional="yes" description="Target window for the new tab.">
<cocoa key="window"/>
</parameter>
<parameter name="with configuration" code="GNtS" type="surface configuration" optional="yes" description="Base surface configuration for the initial terminal.">
<cocoa key="configuration"/>
</parameter>
<result type="tab" description="The newly created tab."/>
</command>
<command name="split" code="GhstSplt" description="Split a terminal in the given direction.">
<direct-parameter type="specifier" description="The terminal to split."/>
<parameter name="direction" code="GSpd" type="split direction" description="The direction to split.">
<cocoa key="direction"/>
</parameter>
<parameter name="with configuration" code="GSpS" type="surface configuration" optional="yes" description="Base surface configuration for the new split terminal.">
<cocoa key="configuration"/>
</parameter>
<result type="terminal" description="The newly created terminal."/>
</command>
<command name="focus" code="GhstFcus" description="Focus a terminal, bringing its window to the front.">
<direct-parameter type="specifier" description="The terminal to focus."/>
</command>
<command name="close" code="GhstClos" description="Close a terminal.">
<direct-parameter type="specifier" description="The terminal to close."/>
</command>
<command name="activate window" code="GhstAcWn" description="Activate a Ghostty window, bringing it to the front.">
<direct-parameter type="specifier" description="The window to activate."/>
</command>
<command name="select tab" code="GhstSlTb" description="Select a tab in its window.">
<direct-parameter type="specifier" description="The tab to select."/>
</command>
<command name="close tab" code="GhstClTb" description="Close a tab.">
<direct-parameter type="specifier" description="The tab to close."/>
</command>
<command name="close window" code="GhstClWn" description="Close a window.">
<direct-parameter type="specifier" description="The window to close."/>
</command>
<command name="input text" code="GhstInTx" description="Input text to a terminal as if it was pasted.">
<cocoa class="GhosttyScriptInputTextCommand"/>
<direct-parameter type="text" description="The text to input."/>
<parameter name="to" code="GItT" type="terminal" description="The terminal to input text to.">
<cocoa key="terminal"/>
</parameter>
</command>
<command name="send key" code="GhstSKey" description="Send a keyboard event to a terminal.">
<cocoa class="GhosttyScriptKeyEventCommand"/>
<direct-parameter type="text" description="The key name (e.g. &quot;enter&quot;, &quot;a&quot;, &quot;space&quot;)."/>
<parameter name="action" code="GKeA" type="input action" optional="yes" description="Press or release (default: press).">
<cocoa key="action"/>
</parameter>
<parameter name="modifiers" code="GKeM" type="text" optional="yes" description="Comma-separated modifier keys: shift, control, option, command.">
<cocoa key="modifiers"/>
</parameter>
<parameter name="to" code="GKeT" type="terminal" description="The terminal to send the key event to.">
<cocoa key="terminal"/>
</parameter>
</command>
<command name="send mouse button" code="GhstSMBt" description="Send a mouse button event to a terminal.">
<cocoa class="GhosttyScriptMouseButtonCommand"/>
<direct-parameter type="mouse button" description="The mouse button."/>
<parameter name="action" code="GMbA" type="input action" optional="yes" description="Press or release (default: press).">
<cocoa key="action"/>
</parameter>
<parameter name="modifiers" code="GMbM" type="text" optional="yes" description="Comma-separated modifier keys: shift, control, option, command.">
<cocoa key="modifiers"/>
</parameter>
<parameter name="to" code="GMbT" type="terminal" description="The terminal to send the event to.">
<cocoa key="terminal"/>
</parameter>
</command>
<command name="send mouse position" code="GhstSMPs" description="Send a mouse position event to a terminal.">
<cocoa class="GhosttyScriptMousePosCommand"/>
<parameter name="x" code="GMpX" type="real" description="Horizontal position in pixels.">
<cocoa key="x"/>
</parameter>
<parameter name="y" code="GMpY" type="real" description="Vertical position in pixels.">
<cocoa key="y"/>
</parameter>
<parameter name="modifiers" code="GMpM" type="text" optional="yes" description="Comma-separated modifier keys: shift, control, option, command.">
<cocoa key="modifiers"/>
</parameter>
<parameter name="to" code="GMpT" type="terminal" description="The terminal to send the event to.">
<cocoa key="terminal"/>
</parameter>
</command>
<command name="send mouse scroll" code="GhstSMSc" description="Send a mouse scroll event to a terminal.">
<cocoa class="GhosttyScriptMouseScrollCommand"/>
<parameter name="x" code="GMsX" type="real" description="Horizontal scroll delta.">
<cocoa key="x"/>
</parameter>
<parameter name="y" code="GMsY" type="real" description="Vertical scroll delta.">
<cocoa key="y"/>
</parameter>
<parameter name="precision" code="GMsP" type="boolean" optional="yes" description="High-precision scroll (e.g. trackpad). Default: false.">
<cocoa key="precision"/>
</parameter>
<parameter name="momentum" code="GMsM" type="scroll momentum" optional="yes" description="Momentum phase for inertial scrolling. Default: none.">
<cocoa key="momentum"/>
</parameter>
<parameter name="to" code="GMsT" type="terminal" description="The terminal to send the event to.">
<cocoa key="terminal"/>
</parameter>
</command>
</suite>
<!--
The Standard Suite definition below is copied from Apple's
/System/Library/ScriptingDefinitions/CocoaStandard.sdef, trimmed to only
include what we need.
-->
<suite name="Standard Suite" code="????" description="Common classes and commands for all applications.">
<command name="count" code="corecnte" description="Return the number of elements of a particular class within an object.">
<cocoa class="NSCountCommand"/>
<access-group identifier="*"/>
<direct-parameter type="specifier" requires-access="r" description="The objects to be counted."/>
<parameter name="each" code="kocl" type="type" optional="yes" description="The class of objects to be counted." hidden="yes">
<cocoa key="ObjectClass"/>
</parameter>
<result type="integer" description="The count."/>
</command>
<command name="exists" code="coredoex" description="Verify that an object exists.">
<cocoa class="NSExistsCommand"/>
<access-group identifier="*"/>
<direct-parameter type="any" requires-access="r" description="The object(s) to check."/>
<result type="boolean" description="Did the object(s) exist?"/>
</command>
<command name="quit" code="aevtquit" description="Quit the application.">
<cocoa class="NSQuitCommand"/>
</command>
</suite>
</dictionary>
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -0,0 +1,4 @@
{
"version" : "3.0",
"toolsVersion" : "17F42"
}
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,642 @@
_ghostty() {
# compat: mapfile -t COMPREPLY < <( "$@" )
_compreply() {
COMPREPLY=()
while IFS='' read -r line; do COMPREPLY+=("$line"); done < <( "$@" )
}
# -o nospace requires we add back a space when a completion is finished
# and not part of a --key= completion
_add_spaces() {
for idx in "${!COMPREPLY[@]}"; do
[ -n "${COMPREPLY[idx]}" ] && COMPREPLY[idx]="${COMPREPLY[idx]} ";
done
}
_fonts() {
local IFS=$'\n'
COMPREPLY=()
while read -r line; do COMPREPLY+=("$line"); done < <( compgen -P '"' -S '"' -W "$($ghostty +list-fonts | grep '^[A-Z]' )" -- "$cur")
}
_themes() {
local IFS=$'\n'
COMPREPLY=()
while read -r line; do COMPREPLY+=("$line"); done < <( compgen -P '"' -S '"' -W "$($ghostty +list-themes | sed -E 's/^(.*) \(.*$/\1/')" -- "$cur")
}
_files() {
_compreply compgen -o filenames -f -- "$cur"
for i in "${!COMPREPLY[@]}"; do
if [[ -d "${COMPREPLY[i]}" ]]; then
COMPREPLY[i]="${COMPREPLY[i]}/";
fi
if [[ -f "${COMPREPLY[i]}" ]]; then
COMPREPLY[i]="${COMPREPLY[i]} ";
fi
done
}
_dirs() {
_compreply compgen -o dirnames -d -- "$cur"
for i in "${!COMPREPLY[@]}"; do
if [[ -d "${COMPREPLY[i]}" ]]; then
COMPREPLY[i]="${COMPREPLY[i]}/";
fi
done
if [[ "${#COMPREPLY[@]}" == 0 && -d "$cur" ]]; then
COMPREPLY=( "$cur " )
fi
}
_handle_config() {
local config="--help"
config+=" --version"
config+=" --language="
config+=" --font-family="
config+=" --font-family-bold="
config+=" --font-family-italic="
config+=" --font-family-bold-italic="
config+=" --font-style="
config+=" --font-style-bold="
config+=" --font-style-italic="
config+=" --font-style-bold-italic="
config+=" --font-synthetic-style="
config+=" --font-feature="
config+=" --font-size="
config+=" --font-variation="
config+=" --font-variation-bold="
config+=" --font-variation-italic="
config+=" --font-variation-bold-italic="
config+=" --font-codepoint-map="
config+=" --clipboard-codepoint-map="
config+=" '--font-thicken '"
config+=" --font-thicken-strength="
config+=" --font-shaping-break="
config+=" --alpha-blending="
config+=" --adjust-cell-width="
config+=" --adjust-cell-height="
config+=" --adjust-font-baseline="
config+=" --adjust-underline-position="
config+=" --adjust-underline-thickness="
config+=" --adjust-strikethrough-position="
config+=" --adjust-strikethrough-thickness="
config+=" --adjust-overline-position="
config+=" --adjust-overline-thickness="
config+=" --adjust-cursor-thickness="
config+=" --adjust-cursor-height="
config+=" --adjust-box-thickness="
config+=" --adjust-icon-height="
config+=" --grapheme-width-method="
config+=" --freetype-load-flags="
config+=" --theme="
config+=" --background="
config+=" --foreground="
config+=" --background-image="
config+=" --background-image-opacity="
config+=" --background-image-position="
config+=" --background-image-fit="
config+=" '--background-image-repeat '"
config+=" --selection-foreground="
config+=" --selection-background="
config+=" '--selection-clear-on-typing '"
config+=" '--selection-clear-on-copy '"
config+=" --selection-word-chars="
config+=" --minimum-contrast="
config+=" --palette="
config+=" '--palette-generate '"
config+=" '--palette-harmonious '"
config+=" --cursor-color="
config+=" --cursor-opacity="
config+=" --cursor-style="
config+=" '--cursor-style-blink '"
config+=" --cursor-text="
config+=" '--cursor-click-to-move '"
config+=" '--mouse-hide-while-typing '"
config+=" --scroll-to-bottom="
config+=" --mouse-shift-capture="
config+=" '--mouse-reporting '"
config+=" --mouse-scroll-multiplier="
config+=" --background-opacity="
config+=" '--background-opacity-cells '"
config+=" --background-blur="
config+=" --unfocused-split-opacity="
config+=" --unfocused-split-fill="
config+=" --split-divider-color="
config+=" --split-preserve-zoom="
config+=" --search-foreground="
config+=" --search-background="
config+=" --search-selected-foreground="
config+=" --search-selected-background="
config+=" --command="
config+=" --initial-command="
config+=" --notify-on-command-finish="
config+=" --notify-on-command-finish-action="
config+=" --notify-on-command-finish-after="
config+=" --env="
config+=" --input="
config+=" '--wait-after-command '"
config+=" --abnormal-command-exit-runtime="
config+=" --scrollback-limit="
config+=" --scrollbar="
config+=" --link="
config+=" '--link-url '"
config+=" --link-previews="
config+=" '--maximize '"
config+=" --fullscreen="
config+=" --title="
config+=" --class="
config+=" --x11-instance-name="
config+=" --working-directory="
config+=" --keybind="
config+=" --key-remap="
config+=" --window-padding-x="
config+=" --window-padding-y="
config+=" '--window-padding-balance '"
config+=" --window-padding-color="
config+=" '--window-vsync '"
config+=" '--window-inherit-working-directory '"
config+=" '--tab-inherit-working-directory '"
config+=" '--split-inherit-working-directory '"
config+=" '--window-inherit-font-size '"
config+=" --window-decoration="
config+=" --window-title-font-family="
config+=" --window-subtitle="
config+=" --window-theme="
config+=" --window-colorspace="
config+=" --window-height="
config+=" --window-width="
config+=" --window-position-x="
config+=" --window-position-y="
config+=" --window-save-state="
config+=" '--window-step-resize '"
config+=" --window-new-tab-position="
config+=" --window-show-tab-bar="
config+=" --window-titlebar-background="
config+=" --window-titlebar-foreground="
config+=" --resize-overlay="
config+=" --resize-overlay-position="
config+=" --resize-overlay-duration="
config+=" '--focus-follows-mouse '"
config+=" --clipboard-read="
config+=" --clipboard-write="
config+=" '--clipboard-trim-trailing-spaces '"
config+=" '--clipboard-paste-protection '"
config+=" '--clipboard-paste-bracketed-safe '"
config+=" '--title-report '"
config+=" --image-storage-limit="
config+=" --copy-on-select="
config+=" --right-click-action="
config+=" --click-repeat-interval="
config+=" --config-file="
config+=" '--config-default-files '"
config+=" --confirm-close-surface="
config+=" '--quit-after-last-window-closed '"
config+=" --quit-after-last-window-closed-delay="
config+=" '--initial-window '"
config+=" --undo-timeout="
config+=" --quick-terminal-position="
config+=" --quick-terminal-size="
config+=" --gtk-quick-terminal-layer="
config+=" --gtk-quick-terminal-namespace="
config+=" --quick-terminal-screen="
config+=" --quick-terminal-animation-duration="
config+=" '--quick-terminal-autohide '"
config+=" --quick-terminal-space-behavior="
config+=" --quick-terminal-keyboard-interactivity="
config+=" --shell-integration="
config+=" --shell-integration-features="
config+=" --command-palette-entry="
config+=" --osc-color-report-format="
config+=" '--vt-kam-allowed '"
config+=" --custom-shader="
config+=" --custom-shader-animation="
config+=" --bell-features="
config+=" --bell-audio-path="
config+=" --bell-audio-volume="
config+=" --app-notifications="
config+=" --macos-non-native-fullscreen="
config+=" --macos-window-buttons="
config+=" --macos-titlebar-style="
config+=" --macos-titlebar-proxy-icon="
config+=" --macos-dock-drop-behavior="
config+=" --macos-option-as-alt="
config+=" '--macos-window-shadow '"
config+=" --macos-hidden="
config+=" '--macos-auto-secure-input '"
config+=" '--macos-secure-input-indication '"
config+=" '--macos-applescript '"
config+=" --macos-icon="
config+=" --macos-custom-icon="
config+=" --macos-icon-frame="
config+=" --macos-icon-ghost-color="
config+=" --macos-icon-screen-color="
config+=" --macos-shortcuts="
config+=" --linux-cgroup="
config+=" --linux-cgroup-memory-limit="
config+=" --linux-cgroup-processes-limit="
config+=" '--linux-cgroup-hard-fail '"
config+=" '--gtk-opengl-debug '"
config+=" --gtk-single-instance="
config+=" '--gtk-titlebar '"
config+=" --gtk-tabs-location="
config+=" '--gtk-titlebar-hide-when-maximized '"
config+=" --gtk-toolbar-style="
config+=" --gtk-titlebar-style="
config+=" '--gtk-wide-tabs '"
config+=" --gtk-custom-css="
config+=" '--desktop-notifications '"
config+=" '--progress-style '"
config+=" --bold-color="
config+=" --faint-opacity="
config+=" --term="
config+=" --enquiry-response="
config+=" --async-backend="
config+=" --auto-update="
config+=" --auto-update-channel="
case "$prev" in
--language) return ;;
--font-family) _fonts ;;
--font-family-bold) _fonts ;;
--font-family-italic) _fonts ;;
--font-family-bold-italic) _fonts ;;
--font-style) return ;;
--font-style-bold) return ;;
--font-style-italic) return ;;
--font-style-bold-italic) return ;;
--font-synthetic-style) _compreply compgen -W "bold no-bold italic no-italic bold-italic no-bold-italic" -- "$cur"; _add_spaces ;;
--font-feature) return ;;
--font-size) return ;;
--font-variation) return ;;
--font-variation-bold) return ;;
--font-variation-italic) return ;;
--font-variation-bold-italic) return ;;
--font-codepoint-map) return ;;
--clipboard-codepoint-map) return ;;
--font-thicken) return ;;
--font-thicken-strength) return ;;
--font-shaping-break) _compreply compgen -W "cursor no-cursor" -- "$cur"; _add_spaces ;;
--alpha-blending) _compreply compgen -W "native linear linear-corrected" -- "$cur"; _add_spaces ;;
--adjust-cell-width) return ;;
--adjust-cell-height) return ;;
--adjust-font-baseline) return ;;
--adjust-underline-position) return ;;
--adjust-underline-thickness) return ;;
--adjust-strikethrough-position) return ;;
--adjust-strikethrough-thickness) return ;;
--adjust-overline-position) return ;;
--adjust-overline-thickness) return ;;
--adjust-cursor-thickness) return ;;
--adjust-cursor-height) return ;;
--adjust-box-thickness) return ;;
--adjust-icon-height) return ;;
--grapheme-width-method) _compreply compgen -W "legacy unicode" -- "$cur"; _add_spaces ;;
--freetype-load-flags) _compreply compgen -W "hinting no-hinting force-autohint no-force-autohint monochrome no-monochrome autohint no-autohint light no-light" -- "$cur"; _add_spaces ;;
--theme) _themes ;;
--background) return ;;
--foreground) return ;;
--background-image) return ;;
--background-image-opacity) return ;;
--background-image-position) _compreply compgen -W "top-left top-center top-right center-left center-center center-right bottom-left bottom-center bottom-right center" -- "$cur"; _add_spaces ;;
--background-image-fit) _compreply compgen -W "contain cover stretch none" -- "$cur"; _add_spaces ;;
--background-image-repeat) return ;;
--selection-foreground) return ;;
--selection-background) return ;;
--selection-clear-on-typing) return ;;
--selection-clear-on-copy) return ;;
--selection-word-chars) return ;;
--minimum-contrast) return ;;
--palette) return ;;
--palette-generate) return ;;
--palette-harmonious) return ;;
--cursor-color) return ;;
--cursor-opacity) return ;;
--cursor-style) _compreply compgen -W "bar block underline block_hollow" -- "$cur"; _add_spaces ;;
--cursor-style-blink) return ;;
--cursor-text) return ;;
--cursor-click-to-move) return ;;
--mouse-hide-while-typing) return ;;
--scroll-to-bottom) _compreply compgen -W "keystroke no-keystroke output no-output" -- "$cur"; _add_spaces ;;
--mouse-shift-capture) _compreply compgen -W "false true always never" -- "$cur"; _add_spaces ;;
--mouse-reporting) return ;;
--mouse-scroll-multiplier) return ;;
--background-opacity) return ;;
--background-opacity-cells) return ;;
--background-blur) return ;;
--unfocused-split-opacity) return ;;
--unfocused-split-fill) return ;;
--split-divider-color) return ;;
--split-preserve-zoom) _compreply compgen -W "navigation no-navigation" -- "$cur"; _add_spaces ;;
--search-foreground) return ;;
--search-background) return ;;
--search-selected-foreground) return ;;
--search-selected-background) return ;;
--command) return ;;
--initial-command) return ;;
--notify-on-command-finish) _compreply compgen -W "never unfocused always" -- "$cur"; _add_spaces ;;
--notify-on-command-finish-action) _compreply compgen -W "bell no-bell notify no-notify" -- "$cur"; _add_spaces ;;
--notify-on-command-finish-after) return ;;
--env) return ;;
--input) return ;;
--wait-after-command) return ;;
--abnormal-command-exit-runtime) return ;;
--scrollback-limit) return ;;
--scrollbar) _compreply compgen -W "system never" -- "$cur"; _add_spaces ;;
--link) return ;;
--link-url) return ;;
--link-previews) _compreply compgen -W "false true osc8" -- "$cur"; _add_spaces ;;
--maximize) return ;;
--fullscreen) _compreply compgen -W "false true non-native non-native-visible-menu non-native-padded-notch" -- "$cur"; _add_spaces ;;
--title) return ;;
--class) return ;;
--x11-instance-name) return ;;
--working-directory) _dirs ;;
--keybind) return ;;
--key-remap) return ;;
--window-padding-x) return ;;
--window-padding-y) return ;;
--window-padding-balance) return ;;
--window-padding-color) _compreply compgen -W "background extend extend-always" -- "$cur"; _add_spaces ;;
--window-vsync) return ;;
--window-inherit-working-directory) return ;;
--tab-inherit-working-directory) return ;;
--split-inherit-working-directory) return ;;
--window-inherit-font-size) return ;;
--window-decoration) _compreply compgen -W "auto client server none" -- "$cur"; _add_spaces ;;
--window-title-font-family) return ;;
--window-subtitle) _compreply compgen -W "false working-directory" -- "$cur"; _add_spaces ;;
--window-theme) _compreply compgen -W "auto system light dark ghostty" -- "$cur"; _add_spaces ;;
--window-colorspace) _compreply compgen -W "srgb display-p3" -- "$cur"; _add_spaces ;;
--window-height) return ;;
--window-width) return ;;
--window-position-x) return ;;
--window-position-y) return ;;
--window-save-state) _compreply compgen -W "default never always" -- "$cur"; _add_spaces ;;
--window-step-resize) return ;;
--window-new-tab-position) _compreply compgen -W "current end" -- "$cur"; _add_spaces ;;
--window-show-tab-bar) _compreply compgen -W "always auto never" -- "$cur"; _add_spaces ;;
--window-titlebar-background) return ;;
--window-titlebar-foreground) return ;;
--resize-overlay) _compreply compgen -W "always never after-first" -- "$cur"; _add_spaces ;;
--resize-overlay-position) _compreply compgen -W "center top-left top-center top-right bottom-left bottom-center bottom-right" -- "$cur"; _add_spaces ;;
--resize-overlay-duration) return ;;
--focus-follows-mouse) return ;;
--clipboard-read) _compreply compgen -W "allow deny ask" -- "$cur"; _add_spaces ;;
--clipboard-write) _compreply compgen -W "allow deny ask" -- "$cur"; _add_spaces ;;
--clipboard-trim-trailing-spaces) return ;;
--clipboard-paste-protection) return ;;
--clipboard-paste-bracketed-safe) return ;;
--title-report) return ;;
--image-storage-limit) return ;;
--copy-on-select) _compreply compgen -W "false true clipboard" -- "$cur"; _add_spaces ;;
--right-click-action) _compreply compgen -W "ignore paste copy copy-or-paste context-menu" -- "$cur"; _add_spaces ;;
--click-repeat-interval) return ;;
--config-file) _files ;;
--config-default-files) return ;;
--confirm-close-surface) _compreply compgen -W "false true always" -- "$cur"; _add_spaces ;;
--quit-after-last-window-closed) return ;;
--quit-after-last-window-closed-delay) return ;;
--initial-window) return ;;
--undo-timeout) return ;;
--quick-terminal-position) _compreply compgen -W "top bottom left right center" -- "$cur"; _add_spaces ;;
--quick-terminal-size) return ;;
--gtk-quick-terminal-layer) _compreply compgen -W "overlay top bottom background" -- "$cur"; _add_spaces ;;
--gtk-quick-terminal-namespace) return ;;
--quick-terminal-screen) _compreply compgen -W "main mouse macos-menu-bar" -- "$cur"; _add_spaces ;;
--quick-terminal-animation-duration) return ;;
--quick-terminal-autohide) return ;;
--quick-terminal-space-behavior) _compreply compgen -W "remain move" -- "$cur"; _add_spaces ;;
--quick-terminal-keyboard-interactivity) _compreply compgen -W "none on-demand exclusive" -- "$cur"; _add_spaces ;;
--shell-integration) _compreply compgen -W "none detect bash elvish fish nushell zsh" -- "$cur"; _add_spaces ;;
--shell-integration-features) _compreply compgen -W "cursor no-cursor sudo no-sudo title no-title ssh-env no-ssh-env ssh-terminfo no-ssh-terminfo path no-path" -- "$cur"; _add_spaces ;;
--command-palette-entry) return ;;
--osc-color-report-format) _compreply compgen -W "none 8-bit 16-bit" -- "$cur"; _add_spaces ;;
--vt-kam-allowed) return ;;
--custom-shader) _files ;;
--custom-shader-animation) _compreply compgen -W "false true always" -- "$cur"; _add_spaces ;;
--bell-features) _compreply compgen -W "system no-system audio no-audio attention no-attention title no-title border no-border" -- "$cur"; _add_spaces ;;
--bell-audio-path) return ;;
--bell-audio-volume) return ;;
--app-notifications) _compreply compgen -W "clipboard-copy no-clipboard-copy config-reload no-config-reload" -- "$cur"; _add_spaces ;;
--macos-non-native-fullscreen) _compreply compgen -W "false true visible-menu padded-notch" -- "$cur"; _add_spaces ;;
--macos-window-buttons) _compreply compgen -W "visible hidden" -- "$cur"; _add_spaces ;;
--macos-titlebar-style) _compreply compgen -W "native transparent tabs hidden" -- "$cur"; _add_spaces ;;
--macos-titlebar-proxy-icon) _compreply compgen -W "visible hidden" -- "$cur"; _add_spaces ;;
--macos-dock-drop-behavior) _compreply compgen -W "new-tab new-window" -- "$cur"; _add_spaces ;;
--macos-option-as-alt) return ;;
--macos-window-shadow) return ;;
--macos-hidden) _compreply compgen -W "never always" -- "$cur"; _add_spaces ;;
--macos-auto-secure-input) return ;;
--macos-secure-input-indication) return ;;
--macos-applescript) return ;;
--macos-icon) _compreply compgen -W "official blueprint chalkboard microchip glass holographic paper retro xray custom custom-style" -- "$cur"; _add_spaces ;;
--macos-custom-icon) return ;;
--macos-icon-frame) _compreply compgen -W "aluminum beige plastic chrome" -- "$cur"; _add_spaces ;;
--macos-icon-ghost-color) return ;;
--macos-icon-screen-color) return ;;
--macos-shortcuts) _compreply compgen -W "allow deny ask" -- "$cur"; _add_spaces ;;
--linux-cgroup) _compreply compgen -W "never always single-instance" -- "$cur"; _add_spaces ;;
--linux-cgroup-memory-limit) return ;;
--linux-cgroup-processes-limit) return ;;
--linux-cgroup-hard-fail) return ;;
--gtk-opengl-debug) return ;;
--gtk-single-instance) _compreply compgen -W "false true detect" -- "$cur"; _add_spaces ;;
--gtk-titlebar) return ;;
--gtk-tabs-location) _compreply compgen -W "top bottom" -- "$cur"; _add_spaces ;;
--gtk-titlebar-hide-when-maximized) return ;;
--gtk-toolbar-style) _compreply compgen -W "flat raised raised-border" -- "$cur"; _add_spaces ;;
--gtk-titlebar-style) _compreply compgen -W "native tabs" -- "$cur"; _add_spaces ;;
--gtk-wide-tabs) return ;;
--gtk-custom-css) _files ;;
--desktop-notifications) return ;;
--progress-style) return ;;
--bold-color) return ;;
--faint-opacity) return ;;
--term) return ;;
--enquiry-response) return ;;
--async-backend) _compreply compgen -W "auto epoll io_uring" -- "$cur"; _add_spaces ;;
--auto-update) return ;;
--auto-update-channel) return ;;
*) _compreply compgen -W "$config" -- "$cur" ;;
esac
return 0
}
_handle_actions() {
local help="'--help ' --help"
local list_fonts="--family= --style= '--bold ' '--italic ' --help"
local list_keybinds="'--default ' '--docs ' '--plain ' --help"
local list_themes="'--path ' '--plain ' --color= --help"
local list_colors="'--plain ' --help"
local list_actions="'--docs ' --help"
local ssh_cache="'--clear ' --add= --remove= --host= --expire-days= --help"
local show_config="'--default ' '--changes-only ' '--docs ' --help"
local validate_config="--config-file= --help"
local show_face="--cp= --string= --style= --presentation= --help"
local new_window="--class= --help"
case "${COMP_WORDS[1]}" in
+help)
case $prev in
--help) return ;;
*) _compreply compgen -W "$help" -- "$cur" ;;
esac
;;
+list-fonts)
case $prev in
--family) return;;
--style) return;;
--bold) return ;;
--italic) return ;;
*) _compreply compgen -W "$list_fonts" -- "$cur" ;;
esac
;;
+list-keybinds)
case $prev in
--default) return ;;
--docs) return ;;
--plain) return ;;
*) _compreply compgen -W "$list_keybinds" -- "$cur" ;;
esac
;;
+list-themes)
case $prev in
--path) return ;;
--plain) return ;;
--color) _compreply compgen -W "all dark light" -- "$cur"; _add_spaces ;;
*) _compreply compgen -W "$list_themes" -- "$cur" ;;
esac
;;
+list-colors)
case $prev in
--plain) return ;;
*) _compreply compgen -W "$list_colors" -- "$cur" ;;
esac
;;
+list-actions)
case $prev in
--docs) return ;;
*) _compreply compgen -W "$list_actions" -- "$cur" ;;
esac
;;
+ssh-cache)
case $prev in
--clear) return ;;
--add) return;;
--remove) return;;
--host) return;;
--expire-days) return;;
*) _compreply compgen -W "$ssh_cache" -- "$cur" ;;
esac
;;
+show-config)
case $prev in
--default) return ;;
--changes-only) return ;;
--docs) return ;;
*) _compreply compgen -W "$show_config" -- "$cur" ;;
esac
;;
+validate-config)
case $prev in
--config-file) return ;;
*) _compreply compgen -W "$validate_config" -- "$cur" ;;
esac
;;
+show-face)
case $prev in
--cp) return;;
--string) return;;
--style) _compreply compgen -W "regular bold italic bold_italic" -- "$cur"; _add_spaces ;;
--presentation) _compreply compgen -W "text emoji" -- "$cur"; _add_spaces ;;
*) _compreply compgen -W "$show_face" -- "$cur" ;;
esac
;;
+new-window)
case $prev in
--class) return;;
*) _compreply compgen -W "$new_window" -- "$cur" ;;
esac
;;
*) _compreply compgen -W "--help" -- "$cur" ;;
esac
return 0
}
# begin main logic
local topLevel="-e"
topLevel+=" --help"
topLevel+=" --version"
topLevel+=" +version"
topLevel+=" +help"
topLevel+=" +list-fonts"
topLevel+=" +list-keybinds"
topLevel+=" +list-themes"
topLevel+=" +list-colors"
topLevel+=" +list-actions"
topLevel+=" +ssh-cache"
topLevel+=" +edit-config"
topLevel+=" +show-config"
topLevel+=" +validate-config"
topLevel+=" +show-face"
topLevel+=" +crash-report"
topLevel+=" +boo"
topLevel+=" +new-window"
local cur=""; local prev=""; local prevWasEq=false; COMPREPLY=()
local ghostty="$1"
# script assumes default COMP_WORDBREAKS of roughly $' \t\n"\'><=;|&(:'
# if = is missing this script will degrade to matching on keys only.
# eg: --key=
# this can be improved if needed see: https://github.com/ghostty-org/ghostty/discussions/2994
if [ "$2" = "=" ]; then cur=""
else cur="$2"
fi
if [ "$3" = "=" ]; then prev="${COMP_WORDS[COMP_CWORD-2]}"; prevWasEq=true;
else prev="${COMP_WORDS[COMP_CWORD-1]}"
fi
# current completion is double quoted add a space so the cursor progresses
if [[ "$2" == \"*\" ]]; then
COMPREPLY=( "$cur " );
return;
fi
case "$COMP_CWORD" in
1)
case "${COMP_WORDS[1]}" in
-e | --help | --version) return 0 ;;
--*) _handle_config ;;
*) _compreply compgen -W "${topLevel}" -- "$cur"; _add_spaces ;;
esac
;;
*)
case "$prev" in
-e | --help | --version) return 0 ;;
*)
if [[ "=" != "${COMP_WORDS[COMP_CWORD]}" && $prevWasEq != true ]]; then
# must be completing with a space after the key eg: '--<key> '
# clear out prev so we don't run any of the key specific completions
prev=""
fi
case "${COMP_WORDS[1]}" in
--*) _handle_config ;;
+*) _handle_actions ;;
esac
;;
esac
;;
esac
return 0
}
complete -o nospace -o bashdefault -F _ghostty ghostty
@@ -0,0 +1,17 @@
%YAML 1.2
---
# See http://www.sublimetext.com/docs/syntax.html
name: Ghostty Config
file_extensions:
- ghostty
scope: source.ghostty
contexts:
main:
# Comments
- match: '^\s*#.*$'
scope: comment.line.number-sign.ghostty
# Keywords
- match: '\b(language|font-family|font-family-bold|font-family-italic|font-family-bold-italic|font-style|font-style-bold|font-style-italic|font-style-bold-italic|font-synthetic-style|font-feature|font-size|font-variation|font-variation-bold|font-variation-italic|font-variation-bold-italic|font-codepoint-map|clipboard-codepoint-map|font-thicken|font-thicken-strength|font-shaping-break|alpha-blending|adjust-cell-width|adjust-cell-height|adjust-font-baseline|adjust-underline-position|adjust-underline-thickness|adjust-strikethrough-position|adjust-strikethrough-thickness|adjust-overline-position|adjust-overline-thickness|adjust-cursor-thickness|adjust-cursor-height|adjust-box-thickness|adjust-icon-height|grapheme-width-method|freetype-load-flags|theme|background|foreground|background-image|background-image-opacity|background-image-position|background-image-fit|background-image-repeat|selection-foreground|selection-background|selection-clear-on-typing|selection-clear-on-copy|selection-word-chars|minimum-contrast|palette|palette-generate|palette-harmonious|cursor-color|cursor-opacity|cursor-style|cursor-style-blink|cursor-text|cursor-click-to-move|mouse-hide-while-typing|scroll-to-bottom|mouse-shift-capture|mouse-reporting|mouse-scroll-multiplier|background-opacity|background-opacity-cells|background-blur|unfocused-split-opacity|unfocused-split-fill|split-divider-color|split-preserve-zoom|search-foreground|search-background|search-selected-foreground|search-selected-background|command|initial-command|notify-on-command-finish|notify-on-command-finish-action|notify-on-command-finish-after|env|input|wait-after-command|abnormal-command-exit-runtime|scrollback-limit|scrollbar|link|link-url|link-previews|maximize|fullscreen|title|class|x11-instance-name|working-directory|keybind|key-remap|window-padding-x|window-padding-y|window-padding-balance|window-padding-color|window-vsync|window-inherit-working-directory|tab-inherit-working-directory|split-inherit-working-directory|window-inherit-font-size|window-decoration|window-title-font-family|window-subtitle|window-theme|window-colorspace|window-height|window-width|window-position-x|window-position-y|window-save-state|window-step-resize|window-new-tab-position|window-show-tab-bar|window-titlebar-background|window-titlebar-foreground|resize-overlay|resize-overlay-position|resize-overlay-duration|focus-follows-mouse|clipboard-read|clipboard-write|clipboard-trim-trailing-spaces|clipboard-paste-protection|clipboard-paste-bracketed-safe|title-report|image-storage-limit|copy-on-select|right-click-action|click-repeat-interval|config-file|config-default-files|confirm-close-surface|quit-after-last-window-closed|quit-after-last-window-closed-delay|initial-window|undo-timeout|quick-terminal-position|quick-terminal-size|gtk-quick-terminal-layer|gtk-quick-terminal-namespace|quick-terminal-screen|quick-terminal-animation-duration|quick-terminal-autohide|quick-terminal-space-behavior|quick-terminal-keyboard-interactivity|shell-integration|shell-integration-features|command-palette-entry|osc-color-report-format|vt-kam-allowed|custom-shader|custom-shader-animation|bell-features|bell-audio-path|bell-audio-volume|app-notifications|macos-non-native-fullscreen|macos-window-buttons|macos-titlebar-style|macos-titlebar-proxy-icon|macos-dock-drop-behavior|macos-option-as-alt|macos-window-shadow|macos-hidden|macos-auto-secure-input|macos-secure-input-indication|macos-applescript|macos-icon|macos-custom-icon|macos-icon-frame|macos-icon-ghost-color|macos-icon-screen-color|macos-shortcuts|linux-cgroup|linux-cgroup-memory-limit|linux-cgroup-processes-limit|linux-cgroup-hard-fail|gtk-opengl-debug|gtk-single-instance|gtk-titlebar|gtk-tabs-location|gtk-titlebar-hide-when-maximized|gtk-toolbar-style|gtk-titlebar-style|gtk-wide-tabs|gtk-custom-css|desktop-notifications|progress-style|bold-color|faint-opacity|term|enquiry-response|async-backend|auto-update|auto-update-channel)\b'
scope: keyword.other.ghostty
@@ -0,0 +1,233 @@
set -l commands "+version +help +list-fonts +list-keybinds +list-themes +list-colors +list-actions +ssh-cache +edit-config +show-config +validate-config +show-face +crash-report +boo +new-window"
complete -c ghostty -f
complete -c ghostty -s e -l help -f
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l version -f
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l language -r -f -d "Set Ghostty's graphical user interface language to a language other than the system default language."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l font-family -r -f -a "(ghostty +list-fonts | grep '^[A-Z]')" -d "The font families to use."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l font-family-bold -r -f -a "(ghostty +list-fonts | grep '^[A-Z]')"
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l font-family-italic -r -f -a "(ghostty +list-fonts | grep '^[A-Z]')"
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l font-family-bold-italic -r -f -a "(ghostty +list-fonts | grep '^[A-Z]')"
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l font-style -r -f -d "The named font style to use for each of the requested terminal font styles."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l font-style-bold -r -f
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l font-style-italic -r -f
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l font-style-bold-italic -r -f
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l font-synthetic-style -r -f -a "bold no-bold italic no-italic bold-italic no-bold-italic" -d "Control whether Ghostty should synthesize a style if the requested style is not available in the specified font-family."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l font-feature -r -f -d "Apply a font feature."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l font-size -r -f -d "Font size in points."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l font-variation -r -f -d "A repeatable configuration to set one or more font variations values for a variable font."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l font-variation-bold -r -f
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l font-variation-italic -r -f
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l font-variation-bold-italic -r -f
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l font-codepoint-map -r -f -d "Force one or a range of Unicode codepoints to map to a specific named font."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l clipboard-codepoint-map -r -f -d "Map specific Unicode codepoints to replacement values when copying text to clipboard."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l font-thicken -f -d "Draw fonts with a thicker stroke, if supported."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l font-thicken-strength -r -f -d "Strength of thickening when `font-thicken` is enabled."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l font-shaping-break -r -f -a "cursor no-cursor" -d "Locations to break font shaping into multiple runs."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l alpha-blending -r -f -a "native linear linear-corrected" -d "What color space to use when performing alpha blending."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l adjust-cell-width -r -f -d "All of the configurations behavior adjust various metrics determined by the font."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l adjust-cell-height -r -f
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l adjust-font-baseline -r -f -d "Distance in pixels or percentage adjustment from the bottom of the cell to the text baseline."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l adjust-underline-position -r -f -d "Distance in pixels or percentage adjustment from the top of the cell to the top of the underline."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l adjust-underline-thickness -r -f -d "Thickness in pixels of the underline."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l adjust-strikethrough-position -r -f -d "Distance in pixels or percentage adjustment from the top of the cell to the top of the strikethrough."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l adjust-strikethrough-thickness -r -f -d "Thickness in pixels or percentage adjustment of the strikethrough."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l adjust-overline-position -r -f -d "Distance in pixels or percentage adjustment from the top of the cell to the top of the overline."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l adjust-overline-thickness -r -f -d "Thickness in pixels or percentage adjustment of the overline."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l adjust-cursor-thickness -r -f -d "Thickness in pixels or percentage adjustment of the bar cursor and outlined rect cursor."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l adjust-cursor-height -r -f -d "Height in pixels or percentage adjustment of the cursor."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l adjust-box-thickness -r -f -d "Thickness in pixels or percentage adjustment of box drawing characters."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l adjust-icon-height -r -f -d "Height in pixels or percentage adjustment of maximum height for nerd font icons."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l grapheme-width-method -r -f -a "legacy unicode" -d "The method to use for calculating the cell width of a grapheme cluster."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l freetype-load-flags -r -f -a "hinting no-hinting force-autohint no-force-autohint monochrome no-monochrome autohint no-autohint light no-light" -d "FreeType load flags to enable."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l theme -r -f -a "(ghostty +list-themes | sed -E 's/^(.*) \(.*\$/\1/')" -d "A theme to use."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l background -r -f -d "Background color for the window."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l foreground -r -f -d "Foreground color for the window."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l background-image -r -f -d "Background image for the terminal."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l background-image-opacity -r -f -d "Background image opacity."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l background-image-position -r -f -a "top-left top-center top-right center-left center-center center-right bottom-left bottom-center bottom-right center" -d "Background image position."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l background-image-fit -r -f -a "contain cover stretch none" -d "Background image fit."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l background-image-repeat -f -d "Whether to repeat the background image or not."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l selection-foreground -r -f -d "The foreground and background color for selection."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l selection-background -r -f
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l selection-clear-on-typing -f -d "Whether to clear selected text when typing."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l selection-clear-on-copy -f -d "Whether to clear selected text after copying."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l selection-word-chars -r -f -d "Characters that mark word boundaries during text selection operations such as double-clicking."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l minimum-contrast -r -f -d "The minimum contrast ratio between the foreground and background colors."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l palette -r -f -d "Color palette for the 256 color form that many terminal applications use."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l palette-generate -f -d "Whether to automatically generate the extended 256 color palette (indices 16255) from the base 16 ANSI colors."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l palette-harmonious -f -d "Invert the palette colors generated when `palette-generate` is enabled, so that the colors go in reverse order."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l cursor-color -r -f -d "The color of the cursor."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l cursor-opacity -r -f -d "The opacity level (opposite of transparency) of the cursor."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l cursor-style -r -f -a "bar block underline block_hollow" -d "The style of the cursor."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l cursor-style-blink -r -f -d "Sets the default blinking state of the cursor."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l cursor-text -r -f -d "The color of the text under the cursor."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l cursor-click-to-move -f -d "Enables the ability to move the cursor at prompts by clicking on a location in the prompt text."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l mouse-hide-while-typing -f -d "Hide the mouse immediately when typing."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l scroll-to-bottom -r -f -a "keystroke no-keystroke output no-output" -d "When to scroll the surface to the bottom."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l mouse-shift-capture -r -f -a "false true always never" -d "Determines whether running programs can detect the shift key pressed with a mouse click."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l mouse-reporting -f -d "Enable or disable mouse reporting."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l mouse-scroll-multiplier -r -f -d "Multiplier for scrolling distance with the mouse wheel."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l background-opacity -r -f -d "The opacity level (opposite of transparency) of the background."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l background-opacity-cells -f -d "Applies background opacity to cells with an explicit background color set."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l background-blur -r -f -d "Whether to blur the background when `background-opacity` is less than 1."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l unfocused-split-opacity -r -f -d "The opacity level (opposite of transparency) of an unfocused split."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l unfocused-split-fill -r -f -d "The color to dim the unfocused split."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l split-divider-color -r -f -d "The color of the split divider."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l split-preserve-zoom -r -f -a "navigation no-navigation" -d "Control when Ghostty preserves a zoomed split."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l search-foreground -r -f -d "The foreground and background color for search matches."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l search-background -r -f
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l search-selected-foreground -r -f -d "The foreground and background color for the currently selected search match."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l search-selected-background -r -f
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l command -r -f -d "The command to run, usually a shell."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l initial-command -r -f -d "This is the same as \"command\", but only applies to the first terminal surface created when Ghostty starts."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l notify-on-command-finish -r -f -a "never unfocused always" -d "Controls when command finished notifications are sent."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l notify-on-command-finish-action -r -f -a "bell no-bell notify no-notify" -d "If command finished notifications are enabled, this controls how the user is notified."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l notify-on-command-finish-after -r -f -d "If command finished notifications are enabled, this controls how long a command must have been running before a notification will be sent."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l env -r -f -d "Extra environment variables to pass to commands launched in a terminal surface."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l input -r -f -d "Data to send as input to the command on startup."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l wait-after-command -f -d "If true, keep the terminal open after the command exits."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l abnormal-command-exit-runtime -r -f -d "The number of milliseconds of runtime below which we consider a process exit to be abnormal."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l scrollback-limit -r -f -d "The size of the scrollback buffer in bytes."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l scrollbar -r -f -a "system never" -d "Control when the scrollbar is shown to scroll the scrollback buffer."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l link -r -f -d "Match a regular expression against the terminal text and associate clicking it with an action."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l link-url -f -d "Enable URL matching."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l link-previews -r -f -a "false true osc8" -d "Show link previews for a matched URL."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l maximize -f -d "Whether to start the window in a maximized state."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l fullscreen -r -f -a "false true non-native non-native-visible-menu non-native-padded-notch" -d "Start new windows in fullscreen."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l title -r -f -d "The title Ghostty will use for the window."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l class -r -f -d "The setting that will change the application class value."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l x11-instance-name -r -f -d "This controls the instance name field of the `WM_CLASS` X11 property when running under X11."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l working-directory -r -f -k -a "(__fish_complete_directories)" -d "The directory to change to after starting the command."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l keybind -r -f -d "Key bindings."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l key-remap -r -f -d "Remap modifier keys within Ghostty."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l window-padding-x -r -f -d "Horizontal window padding."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l window-padding-y -r -f -d "Vertical window padding."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l window-padding-balance -f -d "The viewport dimensions are usually not perfectly divisible by the cell size."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l window-padding-color -r -f -a "background extend extend-always" -d "The color of the padding area of the window."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l window-vsync -f -d "Synchronize rendering with the screen refresh rate."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l window-inherit-working-directory -f -d "If true, new windows will inherit the working directory of the previously focused window."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l tab-inherit-working-directory -f -d "If true, new tabs will inherit the working directory of the previously focused tab."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l split-inherit-working-directory -f -d "If true, new split panes will inherit the working directory of the previously focused split."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l window-inherit-font-size -f -d "If true, new windows and tabs will inherit the font size of the previously focused window."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l window-decoration -r -f -a "auto client server none" -d "Configure a preference for window decorations."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l window-title-font-family -r -f -d "The font that will be used for the application's window and tab titles."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l window-subtitle -r -f -a "false working-directory" -d "The text that will be displayed in the subtitle of the window."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l window-theme -r -f -a "auto system light dark ghostty" -d "The theme to use for the windows."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l window-colorspace -r -f -a "srgb display-p3" -d "The color space to use when interpreting terminal colors."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l window-height -r -f -d "The initial window size."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l window-width -r -f
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l window-position-x -r -f -d "The starting window position."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l window-position-y -r -f
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l window-save-state -r -f -a "default never always" -d "Whether to enable saving and restoring window state."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l window-step-resize -f -d "Resize the window in discrete increments of the focused surface's cell size."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l window-new-tab-position -r -f -a "current end" -d "The position where new tabs are created."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l window-show-tab-bar -r -f -a "always auto never" -d "Whether to show the tab bar."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l window-titlebar-background -r -f -d "Background color for the window titlebar."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l window-titlebar-foreground -r -f -d "Foreground color for the window titlebar."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l resize-overlay -r -f -a "always never after-first" -d "This controls when resize overlays are shown."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l resize-overlay-position -r -f -a "center top-left top-center top-right bottom-left bottom-center bottom-right" -d "If resize overlays are enabled, this controls the position of the overlay."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l resize-overlay-duration -r -f -d "If resize overlays are enabled, this controls how long the overlay is visible on the screen before it is hidden."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l focus-follows-mouse -f -d "If true, when there are multiple split panes, the mouse selects the pane that is focused."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l clipboard-read -r -f -a "allow deny ask" -d "Whether to allow programs running in the terminal to read/write to the system clipboard (OSC 52, for googling)."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l clipboard-write -r -f -a "allow deny ask"
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l clipboard-trim-trailing-spaces -f -d "Trims trailing whitespace on data that is copied to the clipboard."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l clipboard-paste-protection -f -d "Require confirmation before pasting text that appears unsafe."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l clipboard-paste-bracketed-safe -f -d "If true, bracketed pastes will be considered safe."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l title-report -f -d "Enables or disabled title reporting (CSI 21 t)."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l image-storage-limit -r -f -d "The total amount of bytes that can be used for image data (e.g."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l copy-on-select -r -f -a "false true clipboard" -d "Whether to automatically copy selected text to the clipboard."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l right-click-action -r -f -a "ignore paste copy copy-or-paste context-menu" -d "The action to take when the user right-clicks on the terminal surface."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l click-repeat-interval -r -f -d "The time in milliseconds between clicks to consider a click a repeat (double, triple, etc.) or an entirely new single click."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l config-file -r -F -d "Additional configuration files to read."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l config-default-files -f -d "When this is true, the default configuration file paths will be loaded."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l confirm-close-surface -r -f -a "false true always" -d "Confirms that a surface should be closed before closing it."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l quit-after-last-window-closed -f -d "Whether or not to quit after the last surface is closed."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l quit-after-last-window-closed-delay -r -f -d "Controls how long Ghostty will stay running after the last open surface has been closed."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l initial-window -f -d "This controls whether an initial window is created when Ghostty is run."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l undo-timeout -r -f -d "The duration that undo operations remain available."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l quick-terminal-position -r -f -a "top bottom left right center" -d "The position of the \"quick\" terminal window."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l quick-terminal-size -r -f -d "The size of the quick terminal."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l gtk-quick-terminal-layer -r -f -a "overlay top bottom background" -d "The layer of the quick terminal window."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l gtk-quick-terminal-namespace -r -f -d "The namespace for the quick terminal window."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l quick-terminal-screen -r -f -a "main mouse macos-menu-bar" -d "The screen where the quick terminal should show up."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l quick-terminal-animation-duration -r -f -d "Duration (in seconds) of the quick terminal enter and exit animation."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l quick-terminal-autohide -f -d "Automatically hide the quick terminal when focus shifts to another window."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l quick-terminal-space-behavior -r -f -a "remain move" -d "This configuration option determines the behavior of the quick terminal when switching between macOS spaces."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l quick-terminal-keyboard-interactivity -r -f -a "none on-demand exclusive" -d "Determines under which circumstances that the quick terminal should receive keyboard input."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l shell-integration -r -f -a "none detect bash elvish fish nushell zsh" -d "Whether to enable shell integration auto-injection or not."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l shell-integration-features -r -f -a "cursor no-cursor sudo no-sudo title no-title ssh-env no-ssh-env ssh-terminfo no-ssh-terminfo path no-path" -d "Shell integration features to enable."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l command-palette-entry -r -f -d "Custom entries into the command palette."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l osc-color-report-format -r -f -a "none 8-bit 16-bit" -d "Sets the reporting format for OSC sequences that request color information."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l vt-kam-allowed -f -d "If true, allows the \"KAM\" mode (ANSI mode 2) to be used within the terminal."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l custom-shader -r -F -d "Custom shaders to run after the default shaders."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l custom-shader-animation -r -f -a "false true always" -d "If `true` (default), the focused terminal surface will run an animation loop when custom shaders are used."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l bell-features -r -f -a "system no-system audio no-audio attention no-attention title no-title border no-border" -d "Bell features to enable if bell support is available in your runtime."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l bell-audio-path -r -f -d "If `audio` is an enabled bell feature, this is a path to an audio file."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l bell-audio-volume -r -f -d "If `audio` is an enabled bell feature, this is the volume to play the audio file at (relative to the system volume)."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l app-notifications -r -f -a "clipboard-copy no-clipboard-copy config-reload no-config-reload" -d "Control the in-app notifications that Ghostty shows."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l macos-non-native-fullscreen -r -f -a "false true visible-menu padded-notch" -d "If anything other than false, fullscreen mode on macOS will not use the native fullscreen, but make the window fullscreen without animations and using a new space."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l macos-window-buttons -r -f -a "visible hidden" -d "Whether the window buttons in the macOS titlebar are visible."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l macos-titlebar-style -r -f -a "native transparent tabs hidden" -d "The style of the macOS titlebar."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l macos-titlebar-proxy-icon -r -f -a "visible hidden" -d "Whether the proxy icon in the macOS titlebar is visible."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l macos-dock-drop-behavior -r -f -a "new-tab new-window" -d "Controls the windowing behavior when dropping a file or folder onto the Ghostty icon in the macOS dock."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l macos-option-as-alt -r -f -d "macOS doesn't have a distinct \"alt\" key and instead has the \"option\" key which behaves slightly differently."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l macos-window-shadow -f -d "Whether to enable the macOS window shadow."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l macos-hidden -r -f -a "never always" -d "If true, the macOS icon in the dock and app switcher will be hidden."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l macos-auto-secure-input -f -d "If true, Ghostty on macOS will automatically enable the \"Secure Input\" feature when it detects that a password prompt is being displayed."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l macos-secure-input-indication -f -d "If true, Ghostty will show a graphical indication when secure input is enabled."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l macos-applescript -f -d "If true, Ghostty exposes and handles the built-in AppleScript dictionary on macOS."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l macos-icon -r -f -a "official blueprint chalkboard microchip glass holographic paper retro xray custom custom-style" -d "Customize the macOS app icon."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l macos-custom-icon -r -f -d "The absolute path to the custom icon file."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l macos-icon-frame -r -f -a "aluminum beige plastic chrome" -d "The material to use for the frame of the macOS app icon."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l macos-icon-ghost-color -r -f -d "The color of the ghost in the macOS app icon."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l macos-icon-screen-color -r -f -d "The color of the screen in the macOS app icon."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l macos-shortcuts -r -f -a "allow deny ask" -d "Whether macOS Shortcuts are allowed to control Ghostty."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l linux-cgroup -r -f -a "never always single-instance" -d "Put every surface (tab, split, window) into a transient `systemd` scope."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l linux-cgroup-memory-limit -r -f -d "Memory limit for any individual terminal process (tab, split, window, etc.) in bytes."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l linux-cgroup-processes-limit -r -f -d "Number of processes limit for any individual terminal process (tab, split, window, etc.)."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l linux-cgroup-hard-fail -f -d "If this is false, then creating a transient `systemd` scope (for `linux-cgroup`) will be allowed to fail and the failure is ignored."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l gtk-opengl-debug -f -d "Enable or disable GTK's OpenGL debugging logs."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l gtk-single-instance -r -f -a "false true detect" -d "If `true`, the Ghostty GTK application will run in single-instance mode: each new `ghostty` process launched will result in a new window if there is already a running process."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l gtk-titlebar -f -d "When enabled, the full GTK titlebar is displayed instead of your window manager's simple titlebar."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l gtk-tabs-location -r -f -a "top bottom" -d "Determines the side of the screen that the GTK tab bar will stick to."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l gtk-titlebar-hide-when-maximized -f -d "If this is `true`, the titlebar will be hidden when the window is maximized, and shown when the titlebar is unmaximized."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l gtk-toolbar-style -r -f -a "flat raised raised-border" -d "Determines the appearance of the top and bottom bars tab bar."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l gtk-titlebar-style -r -f -a "native tabs" -d "The style of the GTK titlebar."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l gtk-wide-tabs -f -d "If `true` (default), then the Ghostty GTK tabs will be \"wide.\" Wide tabs are the new typical Gnome style where tabs fill their available space."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l gtk-custom-css -r -F -d "Custom CSS files to be loaded."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l desktop-notifications -f -d "If `true` (default), applications running in the terminal can show desktop notifications using certain escape sequences such as OSC 9 or OSC 777."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l progress-style -f -d "If `true` (default), applications running in the terminal can show graphical progress bars using the ConEmu OSC 9;4 escape sequence."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l bold-color -r -f -d "Modifies the color used for bold text in the terminal."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l faint-opacity -r -f -d "The opacity level (opposite of transparency) of the faint text."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l term -r -f -d "This will be used to set the `TERM` environment variable."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l enquiry-response -r -f -d "String to send when we receive `ENQ` (`0x05`) from the command that we are running."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l async-backend -r -f -a "auto epoll io_uring" -d "Configures the low-level API to use for async IO, eventing, etc."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l auto-update -r -f -d "Control the auto-update functionality of Ghostty."
complete -c ghostty -n "not __fish_seen_subcommand_from $commands" -l auto-update-channel -r -f -d "The release channel to use for auto-updates."
complete -c ghostty -n "string match -q -- '+*' (commandline -pt)" -f -a "+version +help +list-fonts +list-keybinds +list-themes +list-colors +list-actions +ssh-cache +edit-config +show-config +validate-config +show-face +crash-report +boo +new-window"
complete -c ghostty -n "__fish_seen_subcommand_from +list-fonts" -l family -r -f
complete -c ghostty -n "__fish_seen_subcommand_from +list-fonts" -l style -r -f
complete -c ghostty -n "__fish_seen_subcommand_from +list-fonts" -l bold -f
complete -c ghostty -n "__fish_seen_subcommand_from +list-fonts" -l italic -f
complete -c ghostty -n "__fish_seen_subcommand_from +list-keybinds" -l default -f
complete -c ghostty -n "__fish_seen_subcommand_from +list-keybinds" -l docs -f
complete -c ghostty -n "__fish_seen_subcommand_from +list-keybinds" -l plain -f
complete -c ghostty -n "__fish_seen_subcommand_from +list-themes" -l path -f
complete -c ghostty -n "__fish_seen_subcommand_from +list-themes" -l plain -f
complete -c ghostty -n "__fish_seen_subcommand_from +list-themes" -l color -r -f -a "all dark light"
complete -c ghostty -n "__fish_seen_subcommand_from +list-colors" -l plain -f
complete -c ghostty -n "__fish_seen_subcommand_from +list-actions" -l docs -f
complete -c ghostty -n "__fish_seen_subcommand_from +ssh-cache" -l clear -f
complete -c ghostty -n "__fish_seen_subcommand_from +ssh-cache" -l add -r -f
complete -c ghostty -n "__fish_seen_subcommand_from +ssh-cache" -l remove -r -f
complete -c ghostty -n "__fish_seen_subcommand_from +ssh-cache" -l host -r -f
complete -c ghostty -n "__fish_seen_subcommand_from +ssh-cache" -l expire-days -r -f
complete -c ghostty -n "__fish_seen_subcommand_from +show-config" -l default -f
complete -c ghostty -n "__fish_seen_subcommand_from +show-config" -l changes-only -f
complete -c ghostty -n "__fish_seen_subcommand_from +show-config" -l docs -f
complete -c ghostty -n "__fish_seen_subcommand_from +validate-config" -l config-file -r -F
complete -c ghostty -n "__fish_seen_subcommand_from +show-face" -l cp -r -f
complete -c ghostty -n "__fish_seen_subcommand_from +show-face" -l string -r -f
complete -c ghostty -n "__fish_seen_subcommand_from +show-face" -l style -r -f -a "regular bold italic bold_italic"
complete -c ghostty -n "__fish_seen_subcommand_from +show-face" -l presentation -r -f -a "text emoji"
complete -c ghostty -n "__fish_seen_subcommand_from +new-window" -l class -r -f
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,382 @@
# bash-preexec.sh -- Bash support for ZSH-like 'preexec' and 'precmd' functions.
# https://github.com/rcaloras/bash-preexec
#
#
# 'preexec' functions are executed before each interactive command is
# executed, with the interactive command as its argument. The 'precmd'
# function is executed before each prompt is displayed.
#
# Author: Ryan Caloras (ryan@bashhub.com)
# Forked from Original Author: Glyph Lefkowitz
#
# V0.6.0
#
# General Usage:
#
# 1. Source this file at the end of your bash profile so as not to interfere
# with anything else that's using PROMPT_COMMAND.
#
# 2. Add any precmd or preexec functions by appending them to their arrays:
# e.g.
# precmd_functions+=(my_precmd_function)
# precmd_functions+=(some_other_precmd_function)
#
# preexec_functions+=(my_preexec_function)
#
# 3. Consider changing anything using the DEBUG trap or PROMPT_COMMAND
# to use preexec and precmd instead. Preexisting usages will be
# preserved, but doing so manually may be less surprising.
#
# Note: This module requires two Bash features which you must not otherwise be
# using: the "DEBUG" trap, and the "PROMPT_COMMAND" variable. If you override
# either of these after bash-preexec has been installed it will most likely break.
# Tell shellcheck what kind of file this is.
# shellcheck shell=bash
# Make sure this is bash that's running and return otherwise.
# Use POSIX syntax for this line:
if [ -z "${BASH_VERSION-}" ]; then
return 1
fi
# We only support Bash 3.1+.
# Note: BASH_VERSINFO is first available in Bash-2.0.
if [[ -z "${BASH_VERSINFO-}" ]] || (( BASH_VERSINFO[0] < 3 || (BASH_VERSINFO[0] == 3 && BASH_VERSINFO[1] < 1) )); then
return 1
fi
# Avoid duplicate inclusion
if [[ -n "${bash_preexec_imported:-}" || -n "${__bp_imported:-}" ]]; then
return 0
fi
bash_preexec_imported="defined"
# WARNING: This variable is no longer used and should not be relied upon.
# Use ${bash_preexec_imported} instead.
# shellcheck disable=SC2034
__bp_imported="${bash_preexec_imported}"
# Should be available to each precmd and preexec
# functions, should they want it. $? and $_ are available as $? and $_, but
# $PIPESTATUS is available only in a copy, $BP_PIPESTATUS.
# TODO: Figure out how to restore PIPESTATUS before each precmd or preexec
# function.
__bp_last_ret_value="$?"
BP_PIPESTATUS=("${PIPESTATUS[@]}")
__bp_last_argument_prev_command="$_"
__bp_inside_precmd=0
__bp_inside_preexec=0
# Initial PROMPT_COMMAND string that is removed from PROMPT_COMMAND post __bp_install
__bp_install_string=$'__bp_trap_string="$(trap -p DEBUG)"\ntrap - DEBUG\n__bp_install'
# Fails if any of the given variables are readonly
# Reference https://stackoverflow.com/a/4441178
__bp_require_not_readonly() {
local var
for var; do
if ! ( unset "$var" 2> /dev/null ); then
echo "bash-preexec requires write access to ${var}" >&2
return 1
fi
done
}
# Remove ignorespace and or replace ignoreboth from HISTCONTROL
# so we can accurately invoke preexec with a command from our
# history even if it starts with a space.
__bp_adjust_histcontrol() {
local histcontrol
histcontrol="${HISTCONTROL:-}"
histcontrol="${histcontrol//ignorespace}"
# Replace ignoreboth with ignoredups
if [[ "$histcontrol" == *"ignoreboth"* ]]; then
histcontrol="ignoredups:${histcontrol//ignoreboth}"
fi
export HISTCONTROL="$histcontrol"
}
# This variable describes whether we are currently in "interactive mode";
# i.e. whether this shell has just executed a prompt and is waiting for user
# input. It documents whether the current command invoked by the trace hook is
# run interactively by the user; it's set immediately after the prompt hook,
# and unset as soon as the trace hook is run.
__bp_preexec_interactive_mode=""
# These arrays are used to add functions to be run before, or after, prompts.
declare -a precmd_functions
declare -a preexec_functions
# Trims leading and trailing whitespace from $2 and writes it to the variable
# name passed as $1
__bp_trim_whitespace() {
local var=${1:?} text=${2:-}
text="${text#"${text%%[![:space:]]*}"}" # remove leading whitespace characters
text="${text%"${text##*[![:space:]]}"}" # remove trailing whitespace characters
printf -v "$var" '%s' "$text"
}
# Trims whitespace and removes any leading or trailing semicolons from $2 and
# writes the resulting string to the variable name passed as $1. Used for
# manipulating substrings in PROMPT_COMMAND
__bp_sanitize_string() {
local var=${1:?} text=${2:-} sanitized
__bp_trim_whitespace sanitized "$text"
sanitized=${sanitized%;}
sanitized=${sanitized#;}
__bp_trim_whitespace sanitized "$sanitized"
printf -v "$var" '%s' "$sanitized"
}
# This function is installed as part of the PROMPT_COMMAND;
# It sets a variable to indicate that the prompt was just displayed,
# to allow the DEBUG trap to know that the next command is likely interactive.
__bp_interactive_mode() {
__bp_preexec_interactive_mode="on"
}
# This function is installed as part of the PROMPT_COMMAND.
# It will invoke any functions defined in the precmd_functions array.
__bp_precmd_invoke_cmd() {
# Save the returned value from our last command, and from each process in
# its pipeline. Note: this MUST be the first thing done in this function.
# BP_PIPESTATUS may be unused, ignore
# shellcheck disable=SC2034
__bp_last_ret_value="$?" BP_PIPESTATUS=("${PIPESTATUS[@]}")
# Don't invoke precmds if we are inside an execution of an "original
# prompt command" by another precmd execution loop. This avoids infinite
# recursion.
if (( __bp_inside_precmd > 0 )); then
return
fi
local __bp_inside_precmd=1
# Invoke every function defined in our function array.
local precmd_function
for precmd_function in "${precmd_functions[@]}"; do
# Only execute this function if it actually exists.
# Test existence of functions with: declare -[Ff]
if type -t "$precmd_function" 1>/dev/null; then
__bp_set_ret_value "$__bp_last_ret_value" "$__bp_last_argument_prev_command"
# Quote our function invocation to prevent issues with IFS
"$precmd_function"
fi
done
__bp_set_ret_value "$__bp_last_ret_value"
}
# Sets a return value in $?. We may want to get access to the $? variable in our
# precmd functions. This is available for instance in zsh. We can simulate it in bash
# by setting the value here.
__bp_set_ret_value() {
return ${1:+"$1"}
}
__bp_in_prompt_command() {
local prompt_command_array IFS=$'\n;'
read -rd '' -a prompt_command_array <<< "${PROMPT_COMMAND[*]:-}"
local trimmed_arg
__bp_trim_whitespace trimmed_arg "${1:-}"
local command trimmed_command
for command in "${prompt_command_array[@]:-}"; do
__bp_trim_whitespace trimmed_command "$command"
if [[ "$trimmed_command" == "$trimmed_arg" ]]; then
return 0
fi
done
return 1
}
# This function is installed as the DEBUG trap. It is invoked before each
# interactive prompt display. Its purpose is to inspect the current
# environment to attempt to detect if the current command is being invoked
# interactively, and invoke 'preexec' if so.
__bp_preexec_invoke_exec() {
# Save the contents of $_ so that it can be restored later on.
# https://stackoverflow.com/questions/40944532/bash-preserve-in-a-debug-trap#40944702
__bp_last_argument_prev_command="${1:-}"
# Don't invoke preexecs if we are inside of another preexec.
if (( __bp_inside_preexec > 0 )); then
return
fi
local __bp_inside_preexec=1
# Checks if the file descriptor is not standard out (i.e. '1')
# __bp_delay_install checks if we're in test. Needed for bats to run.
# Prevents preexec from being invoked for functions in PS1
if [[ ! -t 1 && -z "${__bp_delay_install:-}" ]]; then
return
fi
if [[ -n "${COMP_POINT:-}" || -n "${READLINE_POINT:-}" ]]; then
# We're in the middle of a completer or a keybinding set up by "bind
# -x". This obviously can't be an interactively issued command.
return
fi
if [[ -z "${__bp_preexec_interactive_mode:-}" ]]; then
# We're doing something related to displaying the prompt. Let the
# prompt set the title instead of me.
return
else
# If we're in a subshell, then the prompt won't be re-displayed to put
# us back into interactive mode, so let's not set the variable back.
# In other words, if you have a subshell like
# (sleep 1; sleep 2)
# You want to see the 'sleep 2' as a set_command_title as well.
if [[ 0 -eq "${BASH_SUBSHELL:-}" ]]; then
__bp_preexec_interactive_mode=""
fi
fi
if __bp_in_prompt_command "${BASH_COMMAND:-}"; then
# If we're executing something inside our prompt_command then we don't
# want to call preexec. Bash prior to 3.1 can't detect this at all :/
__bp_preexec_interactive_mode=""
return
fi
local this_command
this_command=$(LC_ALL=C HISTTIMEFORMAT='' builtin history 1)
this_command="${this_command#*[[:digit:]][* ] }"
# Sanity check to make sure we have something to invoke our function with.
if [[ -z "$this_command" ]]; then
return
fi
# Invoke every function defined in our function array.
local preexec_function
local preexec_function_ret_value
local preexec_ret_value=0
for preexec_function in "${preexec_functions[@]:-}"; do
# Only execute each function if it actually exists.
# Test existence of function with: declare -[fF]
if type -t "$preexec_function" 1>/dev/null; then
__bp_set_ret_value "${__bp_last_ret_value:-}"
# Quote our function invocation to prevent issues with IFS
"$preexec_function" "$this_command"
preexec_function_ret_value="$?"
if [[ "$preexec_function_ret_value" != 0 ]]; then
preexec_ret_value="$preexec_function_ret_value"
fi
fi
done
# Restore the last argument of the last executed command, and set the return
# value of the DEBUG trap to be the return code of the last preexec function
# to return an error.
# If `extdebug` is enabled a non-zero return value from any preexec function
# will cause the user's command not to execute.
# Run `shopt -s extdebug` to enable
__bp_set_ret_value "$preexec_ret_value" "$__bp_last_argument_prev_command"
}
__bp_install() {
# Exit if we already have this installed.
if [[ "${PROMPT_COMMAND[*]:-}" == *"__bp_precmd_invoke_cmd"* ]]; then
return 1
fi
trap '__bp_preexec_invoke_exec "$_"' DEBUG
# Preserve any prior DEBUG trap as a preexec function
eval "local trap_argv=(${__bp_trap_string:-})"
local prior_trap=${trap_argv[2]:-}
unset __bp_trap_string
if [[ -n "$prior_trap" ]]; then
eval '__bp_original_debug_trap() {
'"$prior_trap"'
}'
preexec_functions+=(__bp_original_debug_trap)
fi
# Adjust our HISTCONTROL Variable if needed.
#
# GHOSTTY: Don't modify HISTCONTROL. This hack is only needed to improve the
# accuracy of the command argument passed to the preexec functions, and we
# don't use that argument in our bash shell integration script (and nor does
# the __bp_original_debug_trap function above, which is the only other active
# preexec function).
#__bp_adjust_histcontrol
# Issue #25. Setting debug trap for subshells causes sessions to exit for
# backgrounded subshell commands (e.g. (pwd)& ). Believe this is a bug in Bash.
#
# Disabling this by default. It can be enabled by setting this variable.
if [[ -n "${__bp_enable_subshells:-}" ]]; then
# Set so debug trap will work be invoked in subshells.
set -o functrace > /dev/null 2>&1
shopt -s extdebug > /dev/null 2>&1
fi
local existing_prompt_command
# Remove setting our trap install string and sanitize the existing prompt command string
existing_prompt_command="${PROMPT_COMMAND:-}"
# Edge case of appending to PROMPT_COMMAND
existing_prompt_command="${existing_prompt_command//$__bp_install_string/:}" # no-op
existing_prompt_command="${existing_prompt_command//$'\n':$'\n'/$'\n'}" # remove known-token only
existing_prompt_command="${existing_prompt_command//$'\n':;/$'\n'}" # remove known-token only
__bp_sanitize_string existing_prompt_command "$existing_prompt_command"
if [[ "${existing_prompt_command:-:}" == ":" ]]; then
existing_prompt_command=
fi
# Install our hooks in PROMPT_COMMAND to allow our trap to know when we've
# actually entered something.
PROMPT_COMMAND='__bp_precmd_invoke_cmd'
PROMPT_COMMAND+=${existing_prompt_command:+$'\n'$existing_prompt_command}
if (( BASH_VERSINFO[0] > 5 || (BASH_VERSINFO[0] == 5 && BASH_VERSINFO[1] >= 1) )); then
PROMPT_COMMAND+=('__bp_interactive_mode')
else
# shellcheck disable=SC2179 # PROMPT_COMMAND is not an array in bash <= 5.0
PROMPT_COMMAND+=$'\n__bp_interactive_mode'
fi
# Add two functions to our arrays for convenience
# of definition.
precmd_functions+=(precmd)
preexec_functions+=(preexec)
# Invoke our two functions manually that were added to $PROMPT_COMMAND
__bp_precmd_invoke_cmd
__bp_interactive_mode
}
# Sets an installation string as part of our PROMPT_COMMAND to install
# after our session has started. This allows bash-preexec to be included
# at any point in our bash profile.
__bp_install_after_session_init() {
# bash-preexec needs to modify these variables in order to work correctly
# if it can't, just stop the installation
__bp_require_not_readonly PROMPT_COMMAND HISTCONTROL HISTTIMEFORMAT || return
local sanitized_prompt_command
__bp_sanitize_string sanitized_prompt_command "${PROMPT_COMMAND:-}"
if [[ -n "$sanitized_prompt_command" ]]; then
# shellcheck disable=SC2178 # PROMPT_COMMAND is not an array in bash <= 5.0
PROMPT_COMMAND=${sanitized_prompt_command}$'\n'
fi
# shellcheck disable=SC2179 # PROMPT_COMMAND is not an array in bash <= 5.0
PROMPT_COMMAND+=${__bp_install_string}
}
# Run our install so long as we're not delaying it.
if [[ -z "${__bp_delay_install:-}" ]]; then
__bp_install_after_session_init
fi
@@ -0,0 +1,315 @@
# Parts of this script are based on Kitty's bash integration. Kitty is
# distributed under GPLv3, so this file is also distributed under GPLv3.
# The license header is reproduced below:
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# We need to be in interactive mode to proceed.
if [[ "$-" != *i* ]]; then builtin return; fi
# When automatic shell integration is active, we were started in POSIX
# mode and need to manually recreate the bash startup sequence.
if [ -n "$GHOSTTY_BASH_INJECT" ]; then
# Store a temporary copy of our startup flags and unset these global
# environment variables so we can safely handle reentrancy.
builtin declare __ghostty_bash_flags="$GHOSTTY_BASH_INJECT"
builtin unset ENV GHOSTTY_BASH_INJECT
# Restore an existing ENV that was replaced by the shell integration code.
if [[ -n "$GHOSTTY_BASH_ENV" ]]; then
builtin export ENV=$GHOSTTY_BASH_ENV
builtin unset GHOSTTY_BASH_ENV
fi
# Restore bash's default 'posix' behavior. Also reset 'inherit_errexit',
# which doesn't happen as part of the 'posix' reset.
builtin set +o posix
builtin shopt -u inherit_errexit 2>/dev/null
# Unexport HISTFILE if it was set by the shell integration code.
if [[ -n "$GHOSTTY_BASH_UNEXPORT_HISTFILE" ]]; then
builtin export -n HISTFILE
builtin unset GHOSTTY_BASH_UNEXPORT_HISTFILE
fi
# Manually source the startup files. See INVOCATION in bash(1) and
# run_startup_files() in shell.c in the Bash source code.
if builtin shopt -q login_shell; then
if [[ $__ghostty_bash_flags != *"--noprofile"* ]]; then
[ -r /etc/profile ] && builtin source "/etc/profile"
for __ghostty_rcfile in "$HOME/.bash_profile" "$HOME/.bash_login" "$HOME/.profile"; do
[ -r "$__ghostty_rcfile" ] && {
builtin source "$__ghostty_rcfile"
break
}
done
fi
else
if [[ $__ghostty_bash_flags != *"--norc"* ]]; then
# The location of the system bashrc is determined at bash build
# time via -DSYS_BASHRC and can therefore vary across distros:
# Arch, Debian, Ubuntu use /etc/bash.bashrc
# Fedora uses /etc/bashrc sourced from ~/.bashrc instead of SYS_BASHRC
# Void Linux uses /etc/bash/bashrc
# Nixos uses /etc/bashrc
for __ghostty_rcfile in /etc/bash.bashrc /etc/bash/bashrc /etc/bashrc; do
[ -r "$__ghostty_rcfile" ] && {
builtin source "$__ghostty_rcfile"
break
}
done
if [[ -z "$GHOSTTY_BASH_RCFILE" ]]; then GHOSTTY_BASH_RCFILE="$HOME/.bashrc"; fi
[ -r "$GHOSTTY_BASH_RCFILE" ] && builtin source "$GHOSTTY_BASH_RCFILE"
fi
fi
builtin unset __ghostty_rcfile
builtin unset __ghostty_bash_flags
builtin unset GHOSTTY_BASH_RCFILE
fi
# Add Ghostty binary to PATH if the path feature is enabled
if [[ "$GHOSTTY_SHELL_FEATURES" == *"path"* && -n "$GHOSTTY_BIN_DIR" ]]; then
if [[ ":$PATH:" != *":$GHOSTTY_BIN_DIR:"* ]]; then
export PATH="$PATH:$GHOSTTY_BIN_DIR"
fi
fi
# Sudo
if [[ "$GHOSTTY_SHELL_FEATURES" == *"sudo"* && -n "$TERMINFO" ]]; then
# Wrap `sudo` command to ensure Ghostty terminfo is preserved.
#
# This approach supports wrapping a `sudo` alias, but the alias definition
# must come _after_ this function is defined. Otherwise, the alias expansion
# will take precedence over this function, and it won't be wrapped.
function sudo {
builtin local sudo_has_sudoedit_flags="no"
for arg in "$@"; do
# Check if argument is '-e' or '--edit' (sudoedit flags)
if [[ "$arg" == "-e" || $arg == "--edit" ]]; then
sudo_has_sudoedit_flags="yes"
builtin break
fi
# Check if argument is neither an option nor a key-value pair
if [[ "$arg" != -* && "$arg" != *=* ]]; then
builtin break
fi
done
if [[ "$sudo_has_sudoedit_flags" == "yes" ]]; then
builtin command sudo "$@"
else
builtin command sudo --preserve-env=TERMINFO "$@"
fi
}
fi
# SSH Integration
if [[ "$GHOSTTY_SHELL_FEATURES" == *ssh-* ]]; then
function ssh() {
builtin local ssh_term ssh_opts
ssh_term="xterm-256color"
ssh_opts=()
# Configure environment variables for remote session
if [[ "$GHOSTTY_SHELL_FEATURES" == *ssh-env* ]]; then
ssh_opts+=(-o "SetEnv COLORTERM=truecolor")
ssh_opts+=(-o "SendEnv TERM_PROGRAM TERM_PROGRAM_VERSION")
fi
# Install terminfo on remote host if needed
if [[ "$GHOSTTY_SHELL_FEATURES" == *ssh-terminfo* ]]; then
builtin local ssh_user ssh_hostname
while IFS=' ' read -r ssh_key ssh_value; do
case "$ssh_key" in
user) ssh_user="$ssh_value" ;;
hostname) ssh_hostname="$ssh_value" ;;
esac
[[ -n "$ssh_user" && -n "$ssh_hostname" ]] && break
done < <(builtin command ssh -G "$@" 2>/dev/null)
if [[ -n "$ssh_hostname" ]]; then
builtin local ssh_target="${ssh_user}@${ssh_hostname}"
# Check if terminfo is already cached
if "$GHOSTTY_BIN_DIR/ghostty" +ssh-cache --host="$ssh_target" >/dev/null 2>&1; then
ssh_term="xterm-ghostty"
elif builtin command -v infocmp >/dev/null 2>&1; then
builtin local ssh_terminfo ssh_cpath_dir ssh_cpath
ssh_terminfo=$(infocmp -0 -x xterm-ghostty 2>/dev/null)
if [[ -n "$ssh_terminfo" ]]; then
builtin echo "Setting up xterm-ghostty terminfo on $ssh_hostname..." >&2
ssh_cpath_dir=$(mktemp -d "/tmp/ghostty-ssh-$ssh_user.XXXXXX" 2>/dev/null) || ssh_cpath_dir="/tmp/ghostty-ssh-$ssh_user.$$"
ssh_cpath="$ssh_cpath_dir/socket"
if builtin echo "$ssh_terminfo" | builtin command ssh -o ControlMaster=yes -o ControlPath="$ssh_cpath" -o ControlPersist=60s "$@" '
infocmp xterm-ghostty >/dev/null 2>&1 && exit 0
command -v tic >/dev/null 2>&1 || exit 1
mkdir -p ~/.terminfo 2>/dev/null && tic -x - 2>/dev/null && exit 0
exit 1
' 2>/dev/null; then
ssh_term="xterm-ghostty"
ssh_opts+=(-o "ControlPath=$ssh_cpath")
# Cache successful installation
"$GHOSTTY_BIN_DIR/ghostty" +ssh-cache --add="$ssh_target" >/dev/null 2>&1 || true
else
builtin echo "Warning: Failed to install terminfo." >&2
fi
else
builtin echo "Warning: Could not generate terminfo data." >&2
fi
else
builtin echo "Warning: ghostty command not available for cache management." >&2
fi
fi
fi
# Execute SSH with TERM environment variable
TERM="$ssh_term" builtin command ssh "${ssh_opts[@]}" "$@"
}
fi
# This is set to 1 when we're executing a command so that we don't
# send prompt marks multiple times.
_ghostty_executing=""
_ghostty_last_reported_cwd=""
function __ghostty_precmd() {
local ret="$?"
if test "$_ghostty_executing" != "0"; then
_GHOSTTY_SAVE_PS1="$PS1"
_GHOSTTY_SAVE_PS2="$PS2"
# Use 133;P (not 133;A) inside PS1 to avoid fresh-line behavior on
# readline redraws (e.g., vi mode switches, Ctrl-L). The initial
# 133;A with fresh-line is emitted once via printf below.
PS1='\[\e]133;P;k=i\a\]'$PS1'\[\e]133;B\a\]'
PS2='\[\e]133;P;k=s\a\]'$PS2'\[\e]133;B\a\]'
# Bash doesn't redraw the leading lines in a multiline prompt so we mark
# the start of each line (after each newline) as a secondary prompt. This
# correctly handles multiline prompts by setting the first to primary and
# the subsequent lines to secondary.
#
# We only replace the \n prompt escape, not literal newlines ($'\n'),
# because literal newlines may appear inside $(...) command substitutions
# where inserting escape sequences would break shell syntax.
if [[ "$PS1" == *"\n"* ]]; then
PS1="${PS1//\\n/\\n$'\\[\\e]133;P;k=s\\a\\]'}"
fi
# Cursor
if [[ "$GHOSTTY_SHELL_FEATURES" == *"cursor"* ]]; then
builtin local cursor=5 # blinking bar
[[ "$GHOSTTY_SHELL_FEATURES" == *"cursor:steady"* ]] && cursor=6 # steady bar
[[ "$PS1" != *"\[\e[${cursor} q\]"* ]] && PS1=$PS1"\[\e[${cursor} q\]"
[[ "$PS0" != *'\[\e[0 q\]'* ]] && PS0=$PS0'\[\e[0 q\]' # reset
fi
# Title (working directory)
if [[ "$GHOSTTY_SHELL_FEATURES" == *"title"* ]]; then
PS1=$PS1'\[\e]2;\w\a\]'
fi
fi
if test "$_ghostty_executing" != ""; then
# End of current command. Report its status.
builtin printf "\e]133;D;%s;aid=%s\a" "$ret" "$BASHPID"
fi
# Fresh line and start of prompt.
builtin printf "\e]133;A;redraw=last;cl=line;aid=%s\a" "$BASHPID"
# unfortunately bash provides no hooks to detect cwd changes
# in particular this means cwd reporting will not happen for a
# command like cd /test && cat. PS0 is evaluated before cd is run.
if [[ "$_ghostty_last_reported_cwd" != "$PWD" ]]; then
_ghostty_last_reported_cwd="$PWD"
builtin printf "\e]7;kitty-shell-cwd://%s%s\a" "$HOSTNAME" "$PWD"
fi
_ghostty_executing=0
}
function __ghostty_preexec() {
builtin local cmd="$1"
PS1="$_GHOSTTY_SAVE_PS1"
PS2="$_GHOSTTY_SAVE_PS2"
# Title (current command)
if [[ -n $cmd && "$GHOSTTY_SHELL_FEATURES" == *"title"* ]]; then
builtin printf "\e]2;%s\a" "${cmd//[[:cntrl:]]/}"
fi
# End of input, start of output.
builtin printf "\e]133;C;\a"
_ghostty_executing=1
}
if (( BASH_VERSINFO[0] > 4 || (BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] >= 4) )); then
__ghostty_preexec_hook() {
builtin local cmd
cmd=$(LC_ALL=C HISTTIMEFORMAT='' builtin history 1)
cmd="${cmd#*[[:digit:]][* ] }" # remove leading history number
[[ -n "$cmd" ]] && __ghostty_preexec "$cmd"
}
# Use function substitution in 5.3+. Otherwise, use command substitution.
# Any output (including escape sequences) goes to the terminal.
# Only define if not already set (allows re-sourcing).
if [[ -z "${__ghostty_ps0+x}" ]]; then
if (( BASH_VERSINFO[0] > 5 || (BASH_VERSINFO[0] == 5 && BASH_VERSINFO[1] >= 3) )); then
# shellcheck disable=SC2016
builtin readonly __ghostty_ps0='${ __ghostty_preexec_hook; }'
else
# shellcheck disable=SC2016
builtin readonly __ghostty_ps0='$(__ghostty_preexec_hook >/dev/tty)'
fi
fi
__ghostty_hook() {
builtin local ret=$?
__ghostty_precmd "$ret"
if [[ "$PS0" != *"$__ghostty_ps0"* ]]; then
PS0=$PS0"${__ghostty_ps0}"
fi
}
# Append our hook to PROMPT_COMMAND, preserving its existing type.
# shellcheck disable=SC2128,SC2178,SC2179
if [[ ";${PROMPT_COMMAND[*]:-};" != *";__ghostty_hook;"* ]]; then
if [[ -z "${PROMPT_COMMAND[*]}" ]]; then
if (( BASH_VERSINFO[0] > 5 || (BASH_VERSINFO[0] == 5 && BASH_VERSINFO[1] >= 1) )); then
PROMPT_COMMAND=(__ghostty_hook)
else
PROMPT_COMMAND="__ghostty_hook"
fi
elif [[ $(builtin declare -p PROMPT_COMMAND 2>/dev/null) == "declare -a "* ]]; then
PROMPT_COMMAND+=(__ghostty_hook)
else
[[ "${PROMPT_COMMAND}" =~ \;[[:space:]]*$ ]] || PROMPT_COMMAND+=";"
PROMPT_COMMAND+=" __ghostty_hook"
fi
fi
else
builtin source "$(dirname -- "${BASH_SOURCE[0]}")/bash-preexec.sh"
preexec_functions+=(__ghostty_preexec)
precmd_functions+=(__ghostty_precmd)
fi
@@ -0,0 +1,191 @@
{
use platform
use str
# Clean up XDG_DATA_DIRS by removing GHOSTTY_SHELL_INTEGRATION_XDG_DIR
if (and (has-env GHOSTTY_SHELL_INTEGRATION_XDG_DIR) (has-env XDG_DATA_DIRS)) {
set-env XDG_DATA_DIRS (str:replace $E:GHOSTTY_SHELL_INTEGRATION_XDG_DIR":" "" $E:XDG_DATA_DIRS)
unset-env GHOSTTY_SHELL_INTEGRATION_XDG_DIR
}
# List of enabled shell integration features
var features = [(str:split ',' $E:GHOSTTY_SHELL_FEATURES)]
# State tracking for semantic prompt sequences
# Values: 'prompt-start', 'pre-exec', 'post-exec'
fn set-prompt-state {|new| set-env __ghostty_prompt_state $new }
fn mark-prompt-start {
if (not-eq $E:__ghostty_prompt_state 'prompt-start') {
printf "\e]133;D;aid="$pid"\a"
}
set-prompt-state 'prompt-start'
printf "\e]133;A;aid="$pid"\a"
}
fn mark-output-start {|_|
set-prompt-state 'pre-exec'
printf "\e]133;C\a"
}
fn mark-output-end {|cmd-info|
set-prompt-state 'post-exec'
var exit-status = 0
# in case of error: retrieve exit status,
# unless does not exist (= builtin function failure), then default to 1
if (not-eq $nil $cmd-info[error]) {
set exit-status = 1
if (has-key $cmd-info[error] reason) {
if (has-key $cmd-info[error][reason] exit-status) {
set exit-status = $cmd-info[error][reason][exit-status]
}
}
}
printf "\e]133;D;"$exit-status";aid="$pid"\a"
}
# NOTE: OSC 133;B (end of prompt, start of input) cannot be reliably
# implemented at the script level in Elvish. The prompt function's output is
# escaped, and writing to /dev/tty has timing issues because Elvish renders
# its prompts on a background thread. Full semantic prompt support requires a
# native implementation: https://github.com/elves/elvish/pull/1917
fn sudo-with-terminfo {|@args|
var sudoedit = $false
for arg $args {
if (str:has-prefix $arg --) {
if (eq $arg --edit) {
set sudoedit = $true
break
}
} elif (str:has-prefix $arg -) {
if (str:contains (str:trim-prefix $arg -) e) {
set sudoedit = $true
break
}
} elif (not (str:contains $arg =)) {
break
}
}
if (not $sudoedit) { set args = [ --preserve-env=TERMINFO $@args ] }
(external sudo) $@args
}
fn ssh-integration {|@args|
var ssh-term = "xterm-256color"
var ssh-opts = []
# Configure environment variables for remote session
if (has-value $features ssh-env) {
set ssh-opts = (conj $ssh-opts ^
-o "SetEnv COLORTERM=truecolor" ^
-o "SendEnv TERM_PROGRAM TERM_PROGRAM_VERSION")
}
if (has-value $features ssh-terminfo) {
var ssh-user = ""
var ssh-hostname = ""
# Parse ssh config
for line [((external ssh) -G $@args)] {
var parts = [(str:fields $line)]
if (> (count $parts) 1) {
var ssh-key = $parts[0]
var ssh-value = $parts[1]
if (eq $ssh-key user) {
set ssh-user = $ssh-value
} elif (eq $ssh-key hostname) {
set ssh-hostname = $ssh-value
}
if (and (not-eq $ssh-user "") (not-eq $ssh-hostname "")) {
break
}
}
}
if (not-eq $ssh-hostname "") {
var ghostty = $E:GHOSTTY_BIN_DIR/"ghostty"
var ssh-target = $ssh-user"@"$ssh-hostname
# Check if terminfo is already cached
if (bool ?($ghostty +ssh-cache --host=$ssh-target)) {
set ssh-term = "xterm-ghostty"
} elif (has-external infocmp) {
var ssh-terminfo = ((external infocmp) -0 -x xterm-ghostty 2>/dev/null | slurp)
if (not-eq $ssh-terminfo "") {
echo "Setting up xterm-ghostty terminfo on "$ssh-hostname"..." >&2
use os
var ssh-cpath-dir = (os:temp-dir "ghostty-ssh-"$ssh-user".*")
var ssh-cpath = $ssh-cpath-dir"/socket"
if (bool ?(echo $ssh-terminfo | (external ssh) $@ssh-opts -o ControlMaster=yes -o ControlPath=$ssh-cpath -o ControlPersist=60s $@args '
infocmp xterm-ghostty >/dev/null 2>&1 && exit 0
command -v tic >/dev/null 2>&1 || exit 1
mkdir -p ~/.terminfo 2>/dev/null && tic -x - 2>/dev/null && exit 0
exit 1
' 2>/dev/null)) {
set ssh-term = "xterm-ghostty"
set ssh-opts = (conj $ssh-opts -o ControlPath=$ssh-cpath)
# Cache successful installation
$ghostty +ssh-cache --add=$ssh-target >/dev/null
} else {
echo "Warning: Failed to install terminfo." >&2
}
} else {
echo "Warning: Could not generate terminfo data." >&2
}
} else {
echo "Warning: ghostty command not available for cache management." >&2
}
}
}
with [E:TERM = $ssh-term] {
(external ssh) $@ssh-opts $@args
}
}
defer {
mark-prompt-start
}
set edit:before-readline = (conj $edit:before-readline $mark-prompt-start~)
set edit:after-readline = (conj $edit:after-readline $mark-output-start~)
set edit:after-command = (conj $edit:after-command $mark-output-end~)
if (str:contains $E:GHOSTTY_SHELL_FEATURES "cursor") {
var cursor = "5" # blinking bar
if (has-value $features cursor:steady) {
set cursor = "6" # steady bar
}
fn beam { printf "\e["$cursor" q" }
fn reset { printf "\e[0 q" }
set edit:before-readline = (conj $edit:before-readline $beam~)
set edit:after-readline = (conj $edit:after-readline {|_| reset })
}
if (and (has-value $features path) (has-env GHOSTTY_BIN_DIR)) {
if (not (has-value $paths $E:GHOSTTY_BIN_DIR)) {
set paths = [$@paths $E:GHOSTTY_BIN_DIR]
}
}
if (and (has-value $features sudo) (not-eq "" $E:TERMINFO) (has-external sudo)) {
edit:add-var sudo~ $sudo-with-terminfo~
}
if (and (str:contains $E:GHOSTTY_SHELL_FEATURES ssh-) (has-external ssh)) {
edit:add-var ssh~ $ssh-integration~
}
# Report changes to the current directory.
fn report-pwd { printf "\e]7;kitty-shell-cwd://%s%s\a" (platform:hostname) $pwd }
set after-chdir = (conj $after-chdir {|_| report-pwd })
report-pwd
}
@@ -0,0 +1,246 @@
# This shell script aims to be written in a way where it can't really fail
# or all failure scenarios are handled, so that we never leave the shell in
# a weird state. If you find a way to break this, please report a bug!
function ghostty_restore_xdg_data_dir -d "restore the original XDG_DATA_DIR value"
# If we don't have our own data dir then we don't need to do anything.
if not set -q GHOSTTY_SHELL_INTEGRATION_XDG_DIR
return
end
# If the data dir isn't set at all then we don't need to do anything.
if not set -q XDG_DATA_DIRS
return
end
# We need to do this so that XDG_DATA_DIRS turns into an array.
set --function --path xdg_data_dirs "$XDG_DATA_DIRS"
# If our data dir is in the list then remove it.
if set --function index (contains --index "$GHOSTTY_SHELL_INTEGRATION_XDG_DIR" $xdg_data_dirs)
set --erase --function xdg_data_dirs[$index]
end
# Re-export our data dir
if set -q xdg_data_dirs[1]
set --global --export --unpath XDG_DATA_DIRS "$xdg_data_dirs"
else
set --erase --global XDG_DATA_DIRS
end
set --erase GHOSTTY_SHELL_INTEGRATION_XDG_DIR
end
function ghostty_exit -d "exit the shell integration setup"
functions -e ghostty_restore_xdg_data_dir
functions -e ghostty_exit
exit 0
end
# We always try to restore the XDG data dir
ghostty_restore_xdg_data_dir
# If we aren't interactive or we've already run, don't run.
status --is-interactive || ghostty_exit
# We do the full setup on the first prompt render. We do this so that other
# shell integrations that setup the prompt and modify things are able to run
# first. We want to run _last_.
function __ghostty_setup --on-event fish_prompt -d "Setup ghostty integration"
functions -e __ghostty_setup
set --local features (string split , $GHOSTTY_SHELL_FEATURES)
# Parse the fish version for feature detection.
# Default to 0.0 if version is unavailable or malformed.
set -l fish_major 0
set -l fish_minor 0
if set -q version[1]
set -l fish_ver (string match -r '(\d+)\.(\d+)' -- $version[1])
if set -q fish_ver[2]; and test -n "$fish_ver[2]"
set fish_major "$fish_ver[2]"
end
if set -q fish_ver[3]; and test -n "$fish_ver[3]"
set fish_minor "$fish_ver[3]"
end
end
# Our OSC133A (prompt start) sequence. If we're using Fish >= 4.1
# then it supports click_events so we enable that.
set -g __ghostty_prompt_start_mark "\e]133;A\a"
if test "$fish_major" -gt 4; or test "$fish_major" -eq 4 -a "$fish_minor" -ge 1
set -g __ghostty_prompt_start_mark "\e]133;A;click_events=1\a"
end
if string match -q 'cursor*' -- $features
set -l cursor 5 # blinking bar
contains cursor:steady $features && set cursor 6 # steady bar
# Change the cursor to a beam on prompt.
function __ghostty_set_cursor_beam --on-event fish_prompt -V cursor -d "Set cursor shape"
if not functions -q fish_vi_cursor_handle
echo -en "\e[$cursor q"
end
end
function __ghostty_reset_cursor --on-event fish_preexec -d "Reset cursor shape"
if not functions -q fish_vi_cursor_handle
echo -en "\e[0 q"
end
end
end
# Add Ghostty binary to PATH if the path feature is enabled
if contains path $features; and test -n "$GHOSTTY_BIN_DIR"
fish_add_path --global --path --append "$GHOSTTY_BIN_DIR"
end
# When using sudo shell integration feature, ensure $TERMINFO is set
# and `sudo` is not already a function or alias
if contains sudo $features; and test -n "$TERMINFO"; and test file = (type -t sudo 2> /dev/null; or echo "x")
# Wrap `sudo` command to ensure Ghostty terminfo is preserved
function sudo -d "Wrap sudo to preserve terminfo"
set --function sudo_has_sudoedit_flags no
for arg in $argv
# Check if argument is '-e' or '--edit' (sudoedit flags)
if string match -q -- -e "$arg"; or string match -q -- --edit "$arg"
set --function sudo_has_sudoedit_flags yes
break
end
# Check if argument is neither an option nor a key-value pair
if not string match -r -q -- "^-" "$arg"; and not string match -r -q -- "=" "$arg"
break
end
end
if test "$sudo_has_sudoedit_flags" = yes
command sudo $argv
else
command sudo --preserve-env=TERMINFO $argv
end
end
end
# SSH Integration
set -l features (string split ',' -- "$GHOSTTY_SHELL_FEATURES")
if contains ssh-env $features; or contains ssh-terminfo $features
function ssh --wraps=ssh --description "SSH wrapper with Ghostty integration"
set -l features (string split ',' -- "$GHOSTTY_SHELL_FEATURES")
set -l ssh_term xterm-256color
set -l ssh_opts
# Configure environment variables for remote session
if contains ssh-env $features
set -a ssh_opts -o "SetEnv COLORTERM=truecolor"
set -a ssh_opts -o "SendEnv TERM_PROGRAM TERM_PROGRAM_VERSION"
end
# Install terminfo on remote host if needed
if contains ssh-terminfo $features
set -l ssh_user
set -l ssh_hostname
for line in (command ssh -G $argv 2>/dev/null)
set -l parts (string split ' ' -- $line)
if test (count $parts) -ge 2
switch $parts[1]
case user
set ssh_user $parts[2]
case hostname
set ssh_hostname $parts[2]
end
if test -n "$ssh_user"; and test -n "$ssh_hostname"
break
end
end
end
if test -n "$ssh_hostname"
set -l ssh_target "$ssh_user@$ssh_hostname"
# Check if terminfo is already cached
if test -x "$GHOSTTY_BIN_DIR/ghostty"; and "$GHOSTTY_BIN_DIR/ghostty" +ssh-cache --host="$ssh_target" >/dev/null 2>&1
set ssh_term xterm-ghostty
else if command -q infocmp
set -l ssh_terminfo
set -l ssh_cpath_dir
set -l ssh_cpath
set ssh_terminfo "$(infocmp -0 -x xterm-ghostty 2>/dev/null)"
if test -n "$ssh_terminfo"
echo "Setting up xterm-ghostty terminfo on $ssh_hostname..." >&2
set ssh_cpath_dir (mktemp -d "/tmp/ghostty-ssh-$ssh_user.XXXXXX" 2>/dev/null; or echo "/tmp/ghostty-ssh-$ssh_user."(random))
set ssh_cpath "$ssh_cpath_dir/socket"
if echo "$ssh_terminfo" | command ssh $ssh_opts -o ControlMaster=yes -o ControlPath="$ssh_cpath" -o ControlPersist=60s $argv '
infocmp xterm-ghostty >/dev/null 2>&1 && exit 0
command -v tic >/dev/null 2>&1 || exit 1
mkdir -p ~/.terminfo 2>/dev/null && tic -x - 2>/dev/null && exit 0
exit 1
' 2>/dev/null
set ssh_term xterm-ghostty
set -a ssh_opts -o "ControlPath=$ssh_cpath"
# Cache successful installation
if test -x "$GHOSTTY_BIN_DIR/ghostty"
"$GHOSTTY_BIN_DIR/ghostty" +ssh-cache --add="$ssh_target" >/dev/null 2>&1; or true
end
else
echo "Warning: Failed to install terminfo." >&2
end
else
echo "Warning: Could not generate terminfo data." >&2
end
else
echo "Warning: ghostty command not available for cache management." >&2
end
end
end
# Execute SSH with TERM environment variable
TERM="$ssh_term" command ssh $ssh_opts $argv
end
end
# Setup prompt marking
function __ghostty_mark_prompt_start --on-event fish_prompt --on-event fish_posterror
# If we never got the output end event, then we need to send it now.
if test "$__ghostty_prompt_state" != prompt-start
echo -en "\e]133;D\a"
end
set --global __ghostty_prompt_state prompt-start
echo -en $__ghostty_prompt_start_mark
end
function __ghostty_mark_output_start --on-event fish_preexec
set --global __ghostty_prompt_state pre-exec
echo -en "\e]133;C\a"
end
function __ghostty_mark_output_end --on-event fish_postexec
set --global __ghostty_prompt_state post-exec
echo -en "\e]133;D;$status\a"
end
# Report pwd. This is actually built-in to fish but only for terminals
# that match an allowlist and that isn't us.
function __update_cwd_osc --on-variable PWD -d 'Notify capable terminals when $PWD changes'
if status --is-command-substitution || set -q INSIDE_EMACS
return
end
printf \e\]7\;file://%s%s\a $hostname (string escape --style=url $PWD)
end
# Enable fish to handle reflow because Ghostty clears the prompt on resize.
set --global fish_handle_reflow 1
# Initial calls for first prompt
if string match -q 'cursor*' -- $features
__ghostty_set_cursor_beam
end
__ghostty_mark_prompt_start
__update_cwd_osc
end
ghostty_exit
@@ -0,0 +1,110 @@
# Ghostty shell integration
export module ghostty {
def has_feature [feature: string] {
$feature in ($env.GHOSTTY_SHELL_FEATURES | default "" | split row ',')
}
# Wrap `ssh` with Ghostty TERMINFO support
export def --wrapped ssh [...args] {
mut ssh_env = {}
mut ssh_opts = []
# `ssh-env`: use xterm-256color and propagate COLORTERM/TERM_PROGRAM vars
if (has_feature "ssh-env") {
$ssh_env.TERM = "xterm-256color"
$ssh_opts = [
"-o" "SetEnv COLORTERM=truecolor"
"-o" "SendEnv TERM_PROGRAM TERM_PROGRAM_VERSION"
]
}
# `ssh-terminfo`: auto-install xterm-ghostty terminfo on remote hosts
if (has_feature "ssh-terminfo") {
let ghostty = ($env.GHOSTTY_BIN_DIR? | default "") | path join "ghostty"
let ssh_cfg = ^ssh -G ...$args
| lines
| parse "{key} {value}"
| where key in ["user" "hostname"]
| select key value
| transpose -rd
| default {user: $env.USER hostname: "localhost"}
let ssh_id = $"($ssh_cfg.user)@($ssh_cfg.hostname)"
if (^$ghostty "+ssh-cache" $"--host=($ssh_id)" | complete | $in.exit_code == 0) {
$ssh_env.TERM = "xterm-ghostty"
} else {
$ssh_env.TERM = "xterm-256color"
let terminfo = try {
^infocmp -0 -x xterm-ghostty
} catch {
print -e "infocmp failed, using xterm-256color"
}
if ($terminfo | is-not-empty) {
print $"Setting up xterm-ghostty terminfo on ($ssh_cfg.hostname)..."
let ctrl_path = (
mktemp -td $"ghostty-ssh-($ssh_cfg.user).XXXXXX"
| path join "socket"
)
let remote_args = $ssh_opts ++ [
"-o" "ControlMaster=yes"
"-o" $"ControlPath=($ctrl_path)"
"-o" "ControlPersist=60s"
] ++ $args
$terminfo | ^ssh ...$remote_args '
infocmp xterm-ghostty >/dev/null 2>&1 && exit 0
command -v tic >/dev/null 2>&1 || exit 1
mkdir -p ~/.terminfo 2>/dev/null && tic -x - 2>/dev/null && exit 0
exit 1'
| complete
| if $in.exit_code == 0 {
^$ghostty "+ssh-cache" $"--add=($ssh_id)" e>| print -e
$ssh_env.TERM = "xterm-ghostty"
$ssh_opts = ($ssh_opts ++ ["-o" $"ControlPath=($ctrl_path)"])
} else {
print -e "terminfo install failed, using xterm-256color"
}
}
}
}
let ssh_args = $ssh_opts ++ $args
with-env $ssh_env {
^ssh ...$ssh_args
}
}
# Wrap `sudo` to preserve Ghostty's TERMINFO environment variable
export def --wrapped sudo [...args] {
mut sudo_args = $args
if (has_feature "sudo") {
# Extract just the sudo options (before the command)
let sudo_options = (
$args | take until {|arg|
not (($arg | str starts-with "-") or ($arg | str contains "="))
}
)
# Prepend TERMINFO preservation flag if not using sudoedit
if (not ("-e" in $sudo_options or "--edit" in $sudo_options)) {
$sudo_args = ($args | prepend "--preserve-env=TERMINFO")
}
}
^sudo ...$sudo_args
}
}
# Clean up XDG_DATA_DIRS by removing GHOSTTY_SHELL_INTEGRATION_XDG_DIR
if 'GHOSTTY_SHELL_INTEGRATION_XDG_DIR' in $env {
if 'XDG_DATA_DIRS' in $env {
$env.XDG_DATA_DIRS = ($env.XDG_DATA_DIRS | str replace $"($env.GHOSTTY_SHELL_INTEGRATION_XDG_DIR):" "")
}
hide-env GHOSTTY_SHELL_INTEGRATION_XDG_DIR
}
@@ -0,0 +1,61 @@
# Based on (started as) a copy of Kitty's zsh integration. Kitty is
# distributed under GPLv3, so this file is also distributed under GPLv3.
# The license header is reproduced below:
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This script is sourced automatically by zsh when ZDOTDIR is set to this
# directory. It therefore assumes it's running within our shell integration
# environment and should not be sourced manually (unlike ghostty-integration).
#
# This file can get sourced with aliases enabled. To avoid alias expansion
# we quote everything that can be quoted. Some aliases will still break us
# though.
# Restore the original ZDOTDIR value if GHOSTTY_ZSH_ZDOTDIR is set.
# Otherwise, unset the ZDOTDIR that was set during shell injection.
if [[ -n "${GHOSTTY_ZSH_ZDOTDIR+X}" ]]; then
'builtin' 'export' ZDOTDIR="$GHOSTTY_ZSH_ZDOTDIR"
'builtin' 'unset' 'GHOSTTY_ZSH_ZDOTDIR'
else
'builtin' 'unset' 'ZDOTDIR'
fi
# Use try-always to have the right error code.
{
# Zsh treats unset ZDOTDIR as if it was HOME. We do the same.
#
# Source the user's .zshenv before sourcing ghostty-integration because the
# former might set fpath and other things without which ghostty-integration
# won't work.
#
# Use typeset in case we are in a function with warn_create_global in
# effect. Unlikely but better safe than sorry.
'builtin' 'typeset' _ghostty_file=${ZDOTDIR-$HOME}"/.zshenv"
# Zsh ignores unreadable rc files. We do the same.
# Zsh ignores rc files that are directories, and so does source.
[[ ! -r "$_ghostty_file" ]] || 'builtin' 'source' '--' "$_ghostty_file"
} always {
if [[ -o 'interactive' ]]; then
# ${(%):-%x} is the path to the current file.
# On top of it we add :A:h to get the directory.
'builtin' 'typeset' _ghostty_file="${${(%):-%x}:A:h}"/ghostty-integration
if [[ -r "$_ghostty_file" ]]; then
'builtin' 'autoload' '-Uz' '--' "$_ghostty_file"
"${_ghostty_file:t}"
'builtin' 'unfunction' '--' "${_ghostty_file:t}"
fi
fi
'builtin' 'unset' '_ghostty_file'
}
@@ -0,0 +1,458 @@
# vim:ft=zsh
#
# Based on (started as) a copy of Kitty's zsh integration. Kitty is
# distributed under GPLv3, so this file is also distributed under GPLv3.
# The license header is reproduced below:
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Enables integration between zsh and ghostty.
#
# This is an autoloadable function. It's invoked automatically in shells
# directly spawned by Ghostty but not in any other shells. For example, running
# `exec zsh`, `sudo -E zsh`, `tmux`, or plain `zsh` will create a shell where
# ghostty-integration won't automatically run. Zsh users who want integration with
# Ghostty in all shells should add the following lines to their .zshrc:
#
# if [[ -n $GHOSTTY_RESOURCES_DIR ]]; then
# source "$GHOSTTY_RESOURCES_DIR"/shell-integration/zsh/ghostty-integration
# fi
#
# Implementation note: We can assume that alias expansion is disabled in this
# file, so no need to quote defensively. We still have to defensively prefix all
# builtins with `builtin` to avoid accidentally invoking user-defined functions.
# We avoid `function` reserved word as an additional defensive measure.
# Note that updating options with `builtin emulate -L zsh` affects the global options
# if it's called outside of a function. So nearly all code has to be in functions.
_entrypoint() {
builtin emulate -L zsh -o no_warn_create_global -o no_aliases
[[ -o interactive ]] || builtin return 0 # non-interactive shell
(( ! $+_ghostty_state )) || builtin return 0 # already initialized
# We require zsh 5.1+ (released Sept 2015) for features like functions_source,
# introspection arrays, and array pattern substitution.
if ! { builtin autoload -- is-at-least 2>/dev/null && is-at-least 5.1; }; then
builtin echo "Zsh ${ZSH_VERSION} is too old for ghostty shell integration (5.1+ required)" >&2
builtin return 1
fi
# 0: no OSC 133 [AC] marks have been written yet.
# 1: the last written OSC 133 C has not been closed with D yet.
# 2: none of the above.
builtin typeset -gi _ghostty_state
# Attempt to create a writable file descriptor to the TTY so that we can print
# to the TTY later even when STDOUT is redirected. This code is fairly subtle.
#
# - It's tempting to do `[[ -t 1 ]] && exec {_ghostty_state}>&1` but we cannot do this
# because it'll create a file descriptor >= 10 without O_CLOEXEC. This file
# descriptor will leak to child processes.
# - If we do `exec {3}>&1`, the file descriptor won't leak to the child processes
# but it'll still leak if the current process is replaced with another. In
# addition, it'll break user code that relies on fd 3 being available.
# - Zsh doesn't expose dup3, which would have allowed us to copy STDOUT with
# O_CLOEXEC. The only way to create a file descriptor with O_CLOEXEC is via
# sysopen.
# - `zmodload zsh/system` and `sysopen -o cloexec -wu _ghostty_fd -- /dev/tty` can
# fail with an error message to STDERR (the latter can happen even if /dev/tty
# is writable), hence the redirection of STDERR. We do it for the whole block
# for performance reasons (redirections are slow).
# - We must open the file descriptor right here rather than in _ghostty_deferred_init
# because there are broken zsh plugins out there that run `exec {fd}< <(cmd)`
# and then close the file descriptor more than once while suppressing errors.
# This could end up closing our file descriptor if we opened it in
# _ghostty_deferred_init.
typeset -gi _ghostty_fd
{
builtin zmodload zsh/system && (( $+builtins[sysopen] )) && {
{ [[ -w $TTY ]] && builtin sysopen -o cloexec -wu _ghostty_fd -- $TTY } ||
{ [[ -w /dev/tty ]] && builtin sysopen -o cloexec -wu _ghostty_fd -- /dev/tty }
}
} 2>/dev/null || (( _ghostty_fd = 1 ))
# Defer initialization so that other zsh init files can be configure
# the integration.
builtin typeset -ag precmd_functions
precmd_functions+=(_ghostty_deferred_init)
}
_ghostty_deferred_init() {
builtin emulate -L zsh -o no_warn_create_global -o no_aliases
# Enable semantic markup with OSC 133.
_ghostty_precmd() {
builtin local -i cmd_status=$?
builtin emulate -L zsh -o no_warn_create_global -o no_aliases
# Don't write OSC 133 D when our precmd handler is invoked from zle.
# Some plugins do that to update prompt on cd.
if ! builtin zle; then
# This code works incorrectly in the presence of a precmd or chpwd
# hook that prints. For example, sindresorhus/pure prints an empty
# line on precmd and marlonrichert/zsh-snap prints $PWD on chpwd.
# We'll end up writing our OSC 133 D mark too late.
#
# Another failure mode is when the output of a command doesn't end
# with LF and prompst_sp is set (it is by default). In this case
# we'll incorrectly state that '%' from prompt_sp is a part of the
# command's output.
if (( _ghostty_state == 1 )); then
# The last written OSC 133 C has not been closed with D yet.
# Close it and supply status.
builtin print -nu $_ghostty_fd '\e]133;D;'$cmd_status'\a'
(( _ghostty_state = 2 ))
elif (( _ghostty_state == 2 )); then
# There might be an unclosed OSC 133 C. Close that.
builtin print -nu $_ghostty_fd '\e]133;D\a'
fi
fi
builtin local mark1=$'%{\e]133;A;cl=line\a%}'
if [[ -o prompt_percent ]]; then
builtin typeset -g precmd_functions
if [[ ${precmd_functions[-1]} == _ghostty_precmd ]]; then
# This is the best case for us: we can add our marks to PS1 and
# PS2. This way our marks will be printed whenever zsh
# redisplays prompt: on reset-prompt, on SIGWINCH, and on
# SIGCHLD if notify is set. Themes that update prompt
# asynchronously from a `zle -F` handler might still remove our
# marks. Oh well.
# Restore PS1/PS2 to their pre-mark state if nothing else has
# modified them since we last added marks. This avoids exposing
# PS1 with our marks to other hooks (which can break themes like
# Pure that use pattern matching to strip/rebuild the prompt).
# If PS1 was modified (by a theme, async update, etc.), we
# keep the modified version, prioritizing the theme's changes.
builtin local ps1_changed=0
if [[ -n ${_ghostty_saved_ps1+x} ]]; then
if [[ $PS1 == $_ghostty_marked_ps1 ]]; then
PS1=$_ghostty_saved_ps1
PS2=$_ghostty_saved_ps2
elif [[ $PS1 != $_ghostty_saved_ps1 ]]; then
ps1_changed=1
fi
fi
# Save the clean PS1/PS2 before we add marks.
_ghostty_saved_ps1=$PS1
_ghostty_saved_ps2=$PS2
# Add our marks. Since we always start from a clean PS1
# (either restored above or freshly set by a theme), we can
# unconditionally add mark1 and markB.
builtin local mark2=$'%{\e]133;A;k=s\a%}'
builtin local markB=$'%{\e]133;B\a%}'
PS1=${mark1}${PS1}${markB}
# Handle multiline prompts by marking newline-separated
# continuation lines with k=s (mark2). We skip the newline
# immediately after mark1 to avoid introducing a double
# newline due to OSC 133;A's fresh-line behavior.
#
# We skip this when PS1 changed because injecting marks into
# newlines can break pattern matching in themes that
# strip/rebuild the prompt dynamically (e.g., Pure).
if (( ! ps1_changed )) && [[ $PS1 == *$'\n'* ]]; then
if [[ $PS1 == ${mark1}$'\n'* ]]; then
builtin local rest=${PS1#${mark1}$'\n'}
if [[ $rest == *$'\n'* ]]; then
PS1=${mark1}$'\n'${rest//$'\n'/$'\n'${mark2}}
fi
else
PS1=${PS1//$'\n'/$'\n'${mark2}}
fi
fi
# PS2 mark is needed when clearing the prompt on resize
PS2=${mark2}${PS2}${markB}
# Save the marked PS1 so we can detect modifications
# by other hooks in the next cycle.
_ghostty_marked_ps1=$PS1
(( _ghostty_state = 2 ))
else
# If our precmd hook is not the last, we cannot rely on prompt
# changes to stick, so we don't even try. At least we can move
# our hook to the end to have better luck next time. If there is
# another piece of code that wants to take this privileged
# position, this won't work well. We'll break them as much as
# they are breaking us.
precmd_functions=(${precmd_functions:#_ghostty_precmd} _ghostty_precmd)
# Plugins that invoke precmd hooks from zle do that before zle
# is trashed. This means that the cursor is in the middle of
# BUFFER and we cannot print our mark there. Prompt might
# already have a mark, so the following reset-prompt will write
# it. If it doesn't, there is nothing we can do.
if ! builtin zle; then
builtin print -rnu $_ghostty_fd -- $mark1[3,-3]
(( _ghostty_state = 2 ))
fi
fi
elif ! builtin zle; then
# Without prompt_percent we cannot patch prompt. Just print the
# mark, except when we are invoked from zle. In the latter case we
# cannot do anything.
builtin print -rnu $_ghostty_fd -- $mark1[3,-3]
(( _ghostty_state = 2 ))
fi
}
_ghostty_preexec() {
builtin emulate -L zsh -o no_warn_create_global -o no_aliases
# Restore the original PS1/PS2 if nothing else has modified them
# since our precmd added marks. This ensures other preexec hooks
# see a clean PS1 without our marks. If PS1 was modified (e.g.,
# by an async theme update), we leave it alone.
if [[ -n ${_ghostty_saved_ps1+x} && $PS1 == $_ghostty_marked_ps1 ]]; then
PS1=$_ghostty_saved_ps1
PS2=$_ghostty_saved_ps2
fi
# This will work incorrectly in the presence of a preexec hook that
# prints. For example, if MichaelAquilina/zsh-you-should-use installs
# its preexec hook before us, we'll incorrectly mark its output as
# belonging to the command (as if the user typed it into zle) rather
# than command output.
builtin print -nu $_ghostty_fd '\e]133;C\a'
(( _ghostty_state = 1 ))
}
# Enable reporting current working dir to terminal. Ghostty supports
# the kitty-shell-cwd format.
_ghostty_report_pwd() { builtin print -nu $_ghostty_fd '\e]7;kitty-shell-cwd://'"$HOST""$PWD"'\a'; }
chpwd_functions=(${chpwd_functions[@]} "_ghostty_report_pwd")
# An executed program could change cwd and report the changed cwd, so also report cwd at each new prompt
# as in this case chpwd_functions is insufficient. chpwd_functions is still needed for things like: cd x && something
functions[_ghostty_precmd]+="
_ghostty_report_pwd"
_ghostty_report_pwd
if [[ "$GHOSTTY_SHELL_FEATURES" == *"title"* ]]; then
# Enable terminal title changes, formatted for user-friendly display.
functions[_ghostty_precmd]+="
builtin print -rnu $_ghostty_fd \$'\\e]2;'\"\${(%):-%(4~|…/%3~|%~)}\"\$'\\a'"
functions[_ghostty_preexec]+="
builtin print -rnu $_ghostty_fd \$'\\e]2;'\"\${1//[[:cntrl:]]}\"\$'\\a'"
fi
if [[ "$GHOSTTY_SHELL_FEATURES" == *"cursor"* ]]; then
# Enable cursor shape changes depending on the current keymap.
# This implementation leaks blinking block cursor into external commands
# executed from zle. For example, users of fzf-based widgets may find
# themselves with a blinking block cursor within fzf.
_ghostty_zle_line_init _ghostty_zle_line_finish _ghostty_zle_keymap_select() {
builtin local steady=0
[[ "$GHOSTTY_SHELL_FEATURES" == *"cursor:steady"* ]] && steady=1
case ${KEYMAP-} in
vicmd|visual) builtin print -nu "$_ghostty_fd" "\e[$(( 1 + steady )) q" ;; # block
*) builtin print -nu "$_ghostty_fd" "\e[$(( 5 + steady )) q" ;; # bar
esac
}
# Restore the default shape before executing an external command
functions[_ghostty_preexec]+="
builtin print -rnu $_ghostty_fd \$'\\e[0 q'"
fi
# Emit semantic prompt markers at line-init if PS1 doesn't contain our
# marks. This ensures the terminal sees prompt markers even if another
# plugin (like zinit or oh-my-posh) regenerated PS1 after our precmd ran.
# We use 133;P instead of 133;A to avoid fresh-line behavior which would
# disrupt the display since the prompt has already been drawn. We also
# emit 133;B to mark the input area, which is needed for click-to-move.
(( $+functions[_ghostty_zle_line_init] )) || _ghostty_zle_line_init() { builtin true; }
functions[_ghostty_zle_line_init]="
if [[ \$PS1 != *$'%{\\e]133;A'* ]]; then
builtin print -nu \$_ghostty_fd '\\e]133;P;k=i\\a\\e]133;B\\a'
fi
"${functions[_ghostty_zle_line_init]}
# Add Ghostty binary to PATH if the path feature is enabled
if [[ "$GHOSTTY_SHELL_FEATURES" == *"path"* ]] && [[ -n "$GHOSTTY_BIN_DIR" ]]; then
if [[ ":$PATH:" != *":$GHOSTTY_BIN_DIR:"* ]]; then
builtin export PATH="$PATH:$GHOSTTY_BIN_DIR"
fi
fi
# Sudo
if [[ "$GHOSTTY_SHELL_FEATURES" == *"sudo"* ]] && [[ -n "$TERMINFO" ]]; then
# Wrap `sudo` command to ensure Ghostty terminfo is preserved
function sudo() {
builtin local sudo_has_sudoedit_flags="no"
for arg in "$@"; do
# Check if argument is '-e' or '--edit' (sudoedit flags)
if [[ "$arg" == "-e" || $arg == "--edit" ]]; then
sudo_has_sudoedit_flags="yes"
builtin break
fi
# Check if argument is neither an option nor a key-value pair
if [[ "$arg" != -* && "$arg" != *=* ]]; then
builtin break
fi
done
if [[ "$sudo_has_sudoedit_flags" == "yes" ]]; then
builtin command sudo "$@";
else
builtin command sudo --preserve-env=TERMINFO "$@";
fi
}
fi
# SSH Integration
if [[ "$GHOSTTY_SHELL_FEATURES" == *ssh-* ]]; then
function ssh() {
emulate -L zsh
setopt local_options no_glob_subst
local ssh_term ssh_opts
ssh_term="xterm-256color"
ssh_opts=()
# Configure environment variables for remote session
if [[ "$GHOSTTY_SHELL_FEATURES" == *ssh-env* ]]; then
ssh_opts+=(-o "SetEnv COLORTERM=truecolor")
ssh_opts+=(-o "SendEnv TERM_PROGRAM TERM_PROGRAM_VERSION")
fi
# Install terminfo on remote host if needed
if [[ "$GHOSTTY_SHELL_FEATURES" == *ssh-terminfo* ]]; then
local ssh_user ssh_hostname
while IFS=' ' read -r ssh_key ssh_value; do
case "$ssh_key" in
user) ssh_user="$ssh_value" ;;
hostname) ssh_hostname="$ssh_value" ;;
esac
[[ -n "$ssh_user" && -n "$ssh_hostname" ]] && break
done < <(command ssh -G "$@" 2>/dev/null)
if [[ -n "$ssh_hostname" ]]; then
local ssh_target="${ssh_user}@${ssh_hostname}"
# Check if terminfo is already cached
if "$GHOSTTY_BIN_DIR/ghostty" +ssh-cache --host="$ssh_target" >/dev/null 2>&1; then
ssh_term="xterm-ghostty"
elif (( $+commands[infocmp] )); then
local ssh_terminfo ssh_cpath_dir ssh_cpath
ssh_terminfo=$(infocmp -0 -x xterm-ghostty 2>/dev/null)
if [[ -n "$ssh_terminfo" ]]; then
print "Setting up xterm-ghostty terminfo on $ssh_hostname..." >&2
ssh_cpath_dir=$(mktemp -d "/tmp/ghostty-ssh-$ssh_user.XXXXXX" 2>/dev/null) || ssh_cpath_dir="/tmp/ghostty-ssh-$ssh_user.$$"
ssh_cpath="$ssh_cpath_dir/socket"
if builtin print -r "$ssh_terminfo" | command ssh "${ssh_opts[@]}" -o ControlMaster=yes -o ControlPath="$ssh_cpath" -o ControlPersist=60s "$@" '
infocmp xterm-ghostty >/dev/null 2>&1 && exit 0
command -v tic >/dev/null 2>&1 || exit 1
mkdir -p ~/.terminfo 2>/dev/null && tic -x - 2>/dev/null && exit 0
exit 1
' 2>/dev/null; then
ssh_term="xterm-ghostty"
ssh_opts+=(-o "ControlPath=$ssh_cpath")
# Cache successful installation
"$GHOSTTY_BIN_DIR/ghostty" +ssh-cache --add="$ssh_target" >/dev/null 2>&1 || true
else
print "Warning: Failed to install terminfo." >&2
fi
else
print "Warning: Could not generate terminfo data." >&2
fi
else
print "Warning: ghostty command not available for cache management." >&2
fi
fi
fi
# Execute SSH with TERM environment variable
TERM="$ssh_term" command ssh "${ssh_opts[@]}" "$@"
}
fi
# Some zsh users manually run `source ~/.zshrc` in order to apply rc file
# changes to the current shell. This is a terrible practice that breaks many
# things, including our shell integration. For example, Oh My Zsh and Prezto
# (both very popular among zsh users) will remove zle-line-init and
# zle-line-finish hooks if .zshrc is manually sourced. Prezto will also remove
# zle-keymap-select.
#
# Another common (and much more robust) way to apply rc file changes to the
# current shell is `exec zsh`. This will remove our integration from the shell
# unless it's explicitly invoked from .zshrc. This is not an issue with
# `exec zsh` but rather with our implementation of automatic shell integration.
# In the ideal world we would use add-zle-hook-widget to hook zle-line-init
# and similar widget. This breaks user configs though, so we have do this
# horrible thing instead.
builtin local hook func widget orig_widget flag
for hook in line-init line-finish keymap-select; do
func=_ghostty_zle_${hook/-/_}
(( $+functions[$func] )) || builtin continue
widget=zle-$hook
if [[ $widgets[$widget] == user:azhw:* &&
$+functions[add-zle-hook-widget] -eq 1 ]]; then
# If the widget is already hooked by add-zle-hook-widget at the top
# level, add our hook at the end. We MUST do it this way. We cannot
# just wrap the widget ourselves in this case because it would
# trigger bugs in add-zle-hook-widget.
add-zle-hook-widget $hook $func
else
if (( $+widgets[$widget] )); then
# There is a widget but it's not from add-zle-hook-widget. We
# can rename the original widget, install our own and invoke
# the original when we are called.
#
# Note: The leading dot is to work around bugs in
# zsh-syntax-highlighting.
orig_widget=._ghostty_orig_$widget
builtin zle -A $widget $orig_widget
if [[ $widgets[$widget] == user:* ]]; then
# No -w here to preserve $WIDGET within the original widget.
flag=
else
flag=w
fi
functions[$func]+="
builtin zle $orig_widget -N$flag -- \"\$@\""
fi
builtin zle -N $widget $func
fi
done
if (( $+functions[_ghostty_preexec] )); then
builtin typeset -ag preexec_functions
preexec_functions+=(_ghostty_preexec)
fi
builtin typeset -ag precmd_functions
if (( $+functions[_ghostty_precmd] )); then
precmd_functions=(${precmd_functions:#_ghostty_deferred_init} _ghostty_precmd)
_ghostty_precmd
else
precmd_functions=(${precmd_functions:#_ghostty_deferred_init})
fi
# Unfunction _ghostty_deferred_init to save memory. Don't unfunction
# ghostty-integration though because decent public functions aren't supposed to
# to unfunction themselves when invoked. Unfunctioning is done by calling code.
builtin unfunction _ghostty_deferred_init
}
_entrypoint
@@ -0,0 +1,22 @@
palette = 0=#262427
palette = 1=#ff666d
palette = 2=#b3e03a
palette = 3=#ffc739
palette = 4=#00cde8
palette = 5=#a392e8
palette = 6=#9deaf6
palette = 7=#fcfcfa
palette = 8=#545452
palette = 9=#ff7e83
palette = 10=#bee55e
palette = 11=#ffd05e
palette = 12=#1bd5eb
palette = 13=#b0a3eb
palette = 14=#acedf8
palette = 15=#fcfcfa
background = #262427
foreground = #fcfcfa
cursor-color = #fcfcfa
cursor-text = #000000
selection-background = #fcfcfa
selection-foreground = #262427
@@ -0,0 +1,22 @@
palette = 0=#000000
palette = 1=#a03050
palette = 2=#40d080
palette = 3=#e09040
palette = 4=#3060b0
palette = 5=#603090
palette = 6=#0090c0
palette = 7=#dbded8
palette = 8=#685656
palette = 9=#c06060
palette = 10=#90d050
palette = 11=#e0d000
palette = 12=#00b0c0
palette = 13=#801070
palette = 14=#20b0c0
palette = 15=#ffffff
background = #040404
foreground = #feffff
cursor-color = #e0d000
cursor-text = #000000
selection-background = #606060
selection-foreground = #ffffff
@@ -0,0 +1,22 @@
palette = 0=#090300
palette = 1=#db2d20
palette = 2=#01a252
palette = 3=#caba00
palette = 4=#01a0e4
palette = 5=#a16a94
palette = 6=#8fbece
palette = 7=#a5a2a2
palette = 8=#5c5855
palette = 9=#dbaec3
palette = 10=#3a3432
palette = 11=#4a4543
palette = 12=#807d7c
palette = 13=#bcbbba
palette = 14=#cdab53
palette = 15=#f7f7f7
background = #f7f7f7
foreground = #4a4543
cursor-color = #4a4543
cursor-text = #f7f7f7
selection-background = #a5a2a2
selection-foreground = #4a4543

Some files were not shown because too many files have changed in this diff Show More