mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-28 11:11:47 +02:00
Cleanup previous PR
This commit is contained in:
@@ -111,6 +111,10 @@ Detailed list of changes
|
|||||||
|
|
||||||
- A new :ref:`protocol extension <mouse_leave_window>` to notify terminal programs that have turned on SGR Pixel mouse reporting when the mouse leaves the window (:disc:`8808`)
|
- A new :ref:`protocol extension <mouse_leave_window>` to notify terminal programs that have turned on SGR Pixel mouse reporting when the mouse leaves the window (:disc:`8808`)
|
||||||
|
|
||||||
|
- A new :option:`launch --hold-after-ssh` to not close a launched window
|
||||||
|
that connects directly to a remote host because of
|
||||||
|
:option:`launch --cwd`:code:`=current` when the connection ends (:pull:`8807`)
|
||||||
|
|
||||||
- Fix :opt:`remember_window_position` not working because of a stupid typo (:iss:`8646`)
|
- Fix :opt:`remember_window_position` not working because of a stupid typo (:iss:`8646`)
|
||||||
|
|
||||||
- A new :option:`kitty --grab-keyboard` that can be used to grab the keyboard so that global shortcuts are sent to kitty instead
|
- A new :option:`kitty --grab-keyboard` that can be used to grab the keyboard so that global shortcuts are sent to kitty instead
|
||||||
|
|||||||
@@ -140,8 +140,10 @@ by the shell (needs :ref:`shell_integration` to work). The special value
|
|||||||
oldest foreground process associated with the currently active window rather
|
oldest foreground process associated with the currently active window rather
|
||||||
than the newest foreground process. Finally, the special value :code:`root`
|
than the newest foreground process. Finally, the special value :code:`root`
|
||||||
refers to the process that was originally started when the window was created.
|
refers to the process that was originally started when the window was created.
|
||||||
When running :code:`kitten ssh`, using :option:`--hold-after-ssh` will cause a shell
|
|
||||||
in the working directory that started the :code:`kitten ssh` to be opened after disconnecting.
|
When opening in the same working directory as the current window causes the new
|
||||||
|
window to connect to a remote host, you can use the :option:`--hold-after-ssh`
|
||||||
|
flag to prevent the new window from closing when the connection is terminated.
|
||||||
|
|
||||||
|
|
||||||
--env
|
--env
|
||||||
@@ -399,7 +401,9 @@ For example, to create a desktop panel at the bottom of the screen two lines hig
|
|||||||
|
|
||||||
--hold-after-ssh
|
--hold-after-ssh
|
||||||
type=bool-set
|
type=bool-set
|
||||||
When using :option:`--cwd=current` from a kitten ssh session, after disconnecting from the session on the new window, a shell will spawn.
|
When using :option:`--cwd`:code:`=current` or similar from a window that is running the ssh kitten,
|
||||||
|
the new window will run a local shell after disconnecting from the remote host, when this option
|
||||||
|
is specified.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@@ -668,8 +672,8 @@ def _launch(
|
|||||||
else:
|
else:
|
||||||
kw['cwd'] = opts.cwd
|
kw['cwd'] = opts.cwd
|
||||||
if opts.hold_after_ssh:
|
if opts.hold_after_ssh:
|
||||||
if opts.cwd != 'current':
|
if opts.cwd not in ('current', 'last_reported', 'oldest'):
|
||||||
raise ValueError("--hold_after_ssh can only be supplied if --cwd=current is also supplied")
|
raise ValueError("--hold-after-ssh can only be supplied if --cwd=current or similar is also supplied")
|
||||||
kw['hold_after_ssh'] = True
|
kw['hold_after_ssh'] = True
|
||||||
|
|
||||||
if opts.location != 'default':
|
if opts.location != 'default':
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class Launch(RemoteCommand):
|
|||||||
watcher/list.str: list of paths to watcher files
|
watcher/list.str: list of paths to watcher files
|
||||||
bias/float: The bias with which to create the new window in the current layout
|
bias/float: The bias with which to create the new window in the current layout
|
||||||
wait_for_child_to_exit/bool: Boolean indicating whether to wait and return child exit code
|
wait_for_child_to_exit/bool: Boolean indicating whether to wait and return child exit code
|
||||||
hold_after_ssh/bool: Boolean indicating whether to spawn a shell after exiting a kitten ssh opened by this launch, requires --cwd=current to also be supplied
|
hold_after_ssh/bool: Boolean indicating whether to run a local shell after exiting the ssh session cloned via cwd=current or similar
|
||||||
'''
|
'''
|
||||||
|
|
||||||
short_desc = 'Run an arbitrary process in a new window/tab'
|
short_desc = 'Run an arbitrary process in a new window/tab'
|
||||||
|
|||||||
@@ -167,14 +167,12 @@ class CwdRequest:
|
|||||||
server_args = [] if run_shell else list(argv)
|
server_args = [] if run_shell else list(argv)
|
||||||
from kittens.ssh.utils import set_cwd_in_cmdline, set_env_in_cmdline, set_server_args_in_cmdline
|
from kittens.ssh.utils import set_cwd_in_cmdline, set_env_in_cmdline, set_server_args_in_cmdline
|
||||||
if ssh_kitten_cmdline and ssh_kitten_cmdline[0] == 'kitten':
|
if ssh_kitten_cmdline and ssh_kitten_cmdline[0] == 'kitten':
|
||||||
if hold_after_ssh:
|
ssh_kitten_cmdline[0] = kitten_exe()
|
||||||
argv[:] = [kitten_exe(), "run-shell", kitten_exe()] +ssh_kitten_cmdline[1:]
|
argv[:] = ssh_kitten_cmdline
|
||||||
else:
|
|
||||||
argv[:] = [kitten_exe()]+ssh_kitten_cmdline[1:]
|
|
||||||
else:
|
|
||||||
argv[:] = ssh_kitten_cmdline
|
|
||||||
set_cwd_in_cmdline(reported_cwd, argv)
|
set_cwd_in_cmdline(reported_cwd, argv)
|
||||||
set_server_args_in_cmdline(server_args, argv, allocate_tty=not run_shell)
|
set_server_args_in_cmdline(server_args, argv, allocate_tty=not run_shell)
|
||||||
|
if hold_after_ssh:
|
||||||
|
argv[:0] = [kitten_exe(), "run-shell"]
|
||||||
if env is not None:
|
if env is not None:
|
||||||
# Assume env is coming from a local process so drop env
|
# Assume env is coming from a local process so drop env
|
||||||
# vars that can cause issues when set on the remote host
|
# vars that can cause issues when set on the remote host
|
||||||
@@ -1784,6 +1782,8 @@ class Window:
|
|||||||
from kittens.ssh.utils import is_kitten_cmdline
|
from kittens.ssh.utils import is_kitten_cmdline
|
||||||
for p in self.child.foreground_processes:
|
for p in self.child.foreground_processes:
|
||||||
q = list(p['cmdline'] or ())
|
q = list(p['cmdline'] or ())
|
||||||
|
if len(q) > 3 and os.path.basename(q[0]) == 'kitten' and q[1] == 'run-shell':
|
||||||
|
q = q[2:] # --hold-after-ssh causes kitten run-shell wrapper to be added
|
||||||
if is_kitten_cmdline(q):
|
if is_kitten_cmdline(q):
|
||||||
return q
|
return q
|
||||||
return []
|
return []
|
||||||
|
|||||||
Reference in New Issue
Block a user