diff --git a/kittens/command_palette/main.go b/kittens/command_palette/main.go index ee84bf52a..bb1b59cab 100644 --- a/kittens/command_palette/main.go +++ b/kittens/command_palette/main.go @@ -12,6 +12,7 @@ import ( "github.com/kovidgoyal/kitty/tools/cli" "github.com/kovidgoyal/kitty/tools/fzf" + "github.com/kovidgoyal/kitty/tools/tty" "github.com/kovidgoyal/kitty/tools/tui" "github.com/kovidgoyal/kitty/tools/tui/loop" "github.com/kovidgoyal/kitty/tools/wcswidth" @@ -621,6 +622,9 @@ func (h *Handler) triggerSelected() { } func main(cmd *cli.Command, opts *Options, args []string) (rc int, err error) { + if tty.IsTerminal(os.Stdin.Fd()) { + return 1, fmt.Errorf("This kitten must only be run via a mapping in kitty.conf") + } output := tui.KittenOutputSerializer() lp, err := loop.New() if err != nil { diff --git a/kittens/command_palette/main.py b/kittens/command_palette/main.py index 86e5b81b1..2dfe389d5 100644 --- a/kittens/command_palette/main.py +++ b/kittens/command_palette/main.py @@ -119,7 +119,7 @@ def collect_keys_data(opts: Any) -> dict[str, Any]: def main(args: list[str]) -> None: - raise SystemExit('This must be run as kitten command-palette') + raise SystemExit('This kitten must be used only from a kitty.conf mapping') @result_handler(has_ready_notification=True)