This commit is contained in:
Kovid Goyal 2025-04-22 07:37:42 +05:30
parent 25ae75ac13
commit 2566a79472
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 12 additions and 2 deletions

View file

@ -31,6 +31,7 @@
from kitty.os_window_size import WindowSizeData, edge_spacing
from kitty.types import LayerShellConfig
from kitty.typing import BossType, EdgeLiteral
from kitty.utils import log_error
OPTIONS = r'''
--lines
@ -302,7 +303,11 @@ def layer_shell_config(opts: PanelCLIOptions) -> LayerShellConfig:
def handle_single_instance_command(boss: BossType, sys_args: Sequence[str], environ: Mapping[str, str], notify_on_os_window_death: str | None = '') -> None:
from kitty.tabs import SpecialWindow
args, items = parse_panel_args(list(sys_args[1:]))
try:
args, items = parse_panel_args(list(sys_args[1:]))
except BaseException as e:
log_error(f'Invalid arguments received over single instance socket: {sys_args} with error: {e}')
return
if args.toggle_visibility and boss.os_window_map:
for os_window_id in boss.os_window_map:
toggle_os_window_visibility(os_window_id)

View file

@ -848,7 +848,12 @@ def peer_message_received(self, msg_bytes: bytes, peer_id: int, is_remote_contro
from .cli_stub import CLIOptions
startup_id = data['environ'].get('DESKTOP_STARTUP_ID', '')
activation_token = data['environ'].get('XDG_ACTIVATION_TOKEN', '')
args, rest = parse_args(list(data['args'][1:]), result_class=CLIOptions)
try:
args, rest = parse_args(list(data['args'][1:]), result_class=CLIOptions)
except BaseException as e:
self.show_error(_('Invalid single instance command received'), _('The command: {0} is invalid with error: {1}').format(
data['args'], e))
return None
cmdline_args_for_open = data.get('cmdline_args_for_open')
if cmdline_args_for_open:
self.launch_urls(*cmdline_args_for_open, no_replace_window=True)