Skip to content

@ close-tab does not close a tab #3510

@salmankhilji

Description

@salmankhilji

Describe the bug
When controlling kitty externally from a script, close-tab fails to close the target tab.

To Reproduce
Steps to reproduce the behavior:

  1. Run the following script:
  #!/bin/sh
  kitty -o allow_remote_control=yes --listen-on unix:@mykitty --detach
  sleep 0.2
  kitty @ --to=unix:@mykitty set-tab-title setup
  kitty @ --to=unix:@mykitty launch --no-response --tab-title=tab1 --type=tab --keep-focus --location=last bash
  kitty @ --to=unix:@mykitty launch --no-response --tab-title=tab2 --type=tab --keep-focus --location=last bash
  kitty @ --to=unix:@mykitty launch --no-response --tab-title=tab3 --type=tab --keep-focus --location=last bash
  kitty @ --to=unix:@mykitty focus-tab --match title:tab1
  kitty @ --to=unix:@mykitty close-tab --match title:tab3
  kitty @ --to=unix:@mykitty close-tab --match title:setup

Expected behavior
setup and tab3 shall close, and tab1 shall have focus.

Observed behavior
All tabs are there, and tab1 has focus. (So yes, focus-tab worked but close-tab did not.)

Environment details
OS: Name and version of operating system(s)

Ubuntu 20.04 LTS.

$ kitty --debug-config
kitty 0.20.1 (f3726023c2) created by Kovid Goyal
Linux byteevo-scm 5.8.0-50-generic #56~20.04.1-Ubuntu SMP Mon Apr 12 21:46:35 UTC 2021 x86_64
Ubuntu 20.04.2 LTS \n \l
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.2 LTS"
Running under: X11

Config options different from defaults:

Additional context
I do not have a kitty.conf file, so everything is at defaults.

P.S
I am not sure if there is a way to avoid the sleep 0.2 delay within the script above. Without this, I see:

$ ./kitty-bug.sh 
Traceback (most recent call last):
  File "runpy.py", line 197, in _run_module_as_main
  File "runpy.py", line 87, in _run_code
  File "kitty_main.py", line 133, in <module>
  File "kitty_main.py", line 129, in main
  File "kitty_main.py", line 23, in remote_control
  File "kitty/remote_control.py", line 188, in main
  File "kitty/remote_control.py", line 132, in do_io
  File "kitty/remote_control.py", line 79, in __enter__
ConnectionRefusedError: [Errno 111] Connection refused
No matching tabs for expression: title:setup

Is there a way to avoid this delay?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions