mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 14:18:26 +02:00
Allow specifying --listen-on for panel kitten
This commit is contained in:
@@ -89,4 +89,25 @@ position of the quick access panel. In particular, the :option:`kitty +kitten pa
|
||||
making it look different from regular kitty terminal instances.
|
||||
|
||||
|
||||
Controlling panels via remote control
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
You can control panels via the kitty :doc:`remote control <remote-control>` facility. Create a panel
|
||||
with remote control enabled::
|
||||
|
||||
kitty +kitten panel -o allow_remote_control=socket-only --lines=2 \
|
||||
--listen-on=unix:/tmp/mypanel kitten run-shell
|
||||
|
||||
|
||||
Now you can control this panel using remote control, for example to show/hide
|
||||
it, use::
|
||||
|
||||
kitten @ --to=unix:/tmp/mypanel resize-os-window --action=toggle-visibility
|
||||
|
||||
To move the panel to the bottom of the screen and increase its height::
|
||||
|
||||
kitten @ --to=unix:/tmp/mypanel resize-os-window --action=os-panel \
|
||||
--incremental edge=bottom lines=4
|
||||
|
||||
|
||||
.. include:: ../generated/cli-kitten-panel.rst
|
||||
|
||||
4
glfw/wl_window.c
vendored
4
glfw/wl_window.c
vendored
@@ -1685,7 +1685,8 @@ void _glfwPlatformShowWindow(_GLFWwindow* window)
|
||||
else create_window_desktop_surface(window);
|
||||
window->wl.visible = true;
|
||||
commit_window_surface(window);
|
||||
if (is_layer_shell(window)) debug("Layer shell surface mapped waiting for configure event from compositor\n");
|
||||
debug("Window %llu show requested\n", window->id);
|
||||
if (is_layer_shell(window)) { debug("Layer shell surface mapped waiting for configure event from compositor\n"); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1706,6 +1707,7 @@ void _glfwPlatformHideWindow(_GLFWwindow* window)
|
||||
window->swaps_disallowed = true;
|
||||
window->wl.visible = false;
|
||||
commit_window_surface(window);
|
||||
debug("Window %llu hide requested\n", window->id);
|
||||
}
|
||||
|
||||
bool _glfwPlatformSetLayerShellConfig(_GLFWwindow* window, const GLFWLayerShellConfig *value) {
|
||||
|
||||
@@ -7,7 +7,7 @@ from contextlib import suppress
|
||||
from functools import partial
|
||||
from typing import Any, Mapping, Sequence
|
||||
|
||||
from kitty.cli import parse_args
|
||||
from kitty.cli import listen_on_defn, parse_args
|
||||
from kitty.cli_stub import PanelCLIOptions
|
||||
from kitty.constants import appname, is_macos, is_wayland, kitten_exe
|
||||
from kitty.fast_data_types import (
|
||||
@@ -163,6 +163,9 @@ panel invocations with the same :option:`--instance-group` will result
|
||||
in new panels being created in the first panel instance within that group.
|
||||
|
||||
|
||||
{listen_on_defn}
|
||||
|
||||
|
||||
--toggle-visibility
|
||||
type=bool-set
|
||||
When set and using :option:`--single-instance` will toggle the visibility of the
|
||||
@@ -172,7 +175,7 @@ existing panel rather than creating a new one.
|
||||
--debug-rendering
|
||||
type=bool-set
|
||||
For internal debugging use.
|
||||
'''.format(appname=appname).format
|
||||
'''.format(appname=appname, listen_on_defn=listen_on_defn).format
|
||||
|
||||
|
||||
args = PanelCLIOptions()
|
||||
@@ -341,6 +344,9 @@ def main(sys_args: list[str]) -> None:
|
||||
sys.argv.append('--override=linux_display_server=auto')
|
||||
if args.single_instance:
|
||||
sys.argv.append('--single-instance')
|
||||
if args.listen_on:
|
||||
sys.argv.append(f'--listen-on={args.listen_on}')
|
||||
|
||||
sys.argv.extend(items)
|
||||
from kitty.main import main as real_main
|
||||
from kitty.main import run_app
|
||||
|
||||
37
kitty/cli.py
37
kitty/cli.py
@@ -846,6 +846,25 @@ def parse_cmdline(oc: Options, disabled: OptionSpecSeq, ans: Any, args: list[str
|
||||
return leftover_args
|
||||
|
||||
|
||||
listen_on_defn = f'''\
|
||||
--listen-on
|
||||
completion=type:special group:complete_kitty_listen_on
|
||||
Listen on the specified socket address for control messages. For example,
|
||||
:option:`{appname} --listen-on`=unix:/tmp/mykitty or :option:`{appname}
|
||||
--listen-on`=tcp:localhost:12345. On Linux systems, you can also use abstract
|
||||
UNIX sockets, not associated with a file, like this: :option:`{appname}
|
||||
--listen-on`=unix:@mykitty. Environment variables are expanded and relative
|
||||
paths are resolved with respect to the temporary directory. To control kitty,
|
||||
you can send commands to it with :italic:`kitten @` using the
|
||||
:option:`kitten @ --to` option to specify this address. Note that if you run
|
||||
:italic:`kitten @` within a kitty window, there is no need to specify the
|
||||
:option:`kitten @ --to` option as it will automatically read from the
|
||||
environment. Note that this will be ignored unless :opt:`allow_remote_control`
|
||||
is set to either: :code:`yes`, :code:`socket` or :code:`socket-only`. This can
|
||||
also be specified in :file:`kitty.conf`.
|
||||
'''
|
||||
|
||||
|
||||
def options_spec() -> str:
|
||||
if not hasattr(options_spec, 'ans'):
|
||||
OPTIONS = '''
|
||||
@@ -940,21 +959,7 @@ previous instance is found, then :italic:`{appname}` will wait anyway,
|
||||
regardless of this option.
|
||||
|
||||
|
||||
--listen-on
|
||||
completion=type:special group:complete_kitty_listen_on
|
||||
Listen on the specified socket address for control messages. For example,
|
||||
:option:`{appname} --listen-on`=unix:/tmp/mykitty or :option:`{appname}
|
||||
--listen-on`=tcp:localhost:12345. On Linux systems, you can also use abstract
|
||||
UNIX sockets, not associated with a file, like this: :option:`{appname}
|
||||
--listen-on`=unix:@mykitty. Environment variables are expanded and relative
|
||||
paths are resolved with respect to the temporary directory. To control kitty,
|
||||
you can send commands to it with :italic:`kitten @` using the
|
||||
:option:`kitten @ --to` option to specify this address. Note that if you run
|
||||
:italic:`kitten @` within a kitty window, there is no need to specify the
|
||||
:option:`kitten @ --to` option as it will automatically read from the
|
||||
environment. Note that this will be ignored unless :opt:`allow_remote_control`
|
||||
is set to either: :code:`yes`, :code:`socket` or :code:`socket-only`. This can
|
||||
also be specified in :file:`kitty.conf`.
|
||||
{listen_on_defn}
|
||||
|
||||
|
||||
--start-as
|
||||
@@ -1018,7 +1023,7 @@ type=bool-set
|
||||
!
|
||||
'''
|
||||
setattr(options_spec, 'ans', OPTIONS.format(
|
||||
appname=appname, conf_name=appname,
|
||||
appname=appname, conf_name=appname, listen_on_defn=listen_on_defn,
|
||||
config_help=CONFIG_HELP.format(appname=appname, conf_name=appname),
|
||||
))
|
||||
ans: str = getattr(options_spec, 'ans')
|
||||
|
||||
Reference in New Issue
Block a user