initial commit [141.14.140.180,mike]
This commit is contained in:
commit
156bb18c91
50 files changed
+13466
No files matched your search
@@ -0,0 +1,38 @@
|
||||
package ghostty
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
)
|
||||
|
||||
// ErrNotRunning is returned by Reload when no Ghostty instance was found.
|
||||
var ErrNotRunning = errors.New("Ghostty is not running")
|
||||
|
||||
// ErrReloadUnsupported is returned by Reload on platforms where Ghostty
|
||||
// cannot be asked to reload from outside.
|
||||
var ErrReloadUnsupported = errors.New("automatic reload is not supported on this platform")
|
||||
|
||||
// Reload asks every running Ghostty instance to reload its configuration,
|
||||
// as if the reload_config action (⌘⇧, / ctrl+shift+,) had been triggered.
|
||||
//
|
||||
// On macOS this uses Ghostty's AppleScript "perform action" command, on
|
||||
// Linux the SIGUSR2 handler of the GTK app.
|
||||
func Reload() error {
|
||||
return reload()
|
||||
}
|
||||
|
||||
// isCLIAction reports whether a NUL-separated command line runs a Ghostty
|
||||
// CLI action ("ghostty +validate-config", …) rather than the app. Like
|
||||
// Ghostty, it only looks at arguments before "-e".
|
||||
func isCLIAction(cmdline []byte) bool {
|
||||
args := bytes.Split(bytes.TrimRight(cmdline, "\x00"), []byte{0})
|
||||
for _, a := range args[1:] {
|
||||
if string(a) == "-e" {
|
||||
break
|
||||
}
|
||||
if bytes.HasPrefix(a, []byte("+")) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
Reference in new issue
Block a user