mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-05 23:51:29 +02:00
DRYer
This commit is contained in:
@@ -1613,8 +1613,13 @@ class Boss:
|
||||
self.mouse_handler = self.visual_window_select_mouse_handler
|
||||
else:
|
||||
self.visual_window_select_action_trigger(self.current_visual_select.window_ids[0] if self.current_visual_select.window_ids else 0)
|
||||
if get_options().enable_audio_bell:
|
||||
ring_bell(tab.os_window_id)
|
||||
self.ring_bell_if_allowed(tab.os_window_id)
|
||||
|
||||
def ring_bell_if_allowed(self, os_window_id: int = 0) -> bool:
|
||||
if get_options().enable_audio_bell:
|
||||
ring_bell(os_window_id or getattr(self.active_tab_manager, 'os_window_id', 0))
|
||||
return True
|
||||
return False
|
||||
|
||||
def visual_window_select_action_trigger(self, window_id: int = 0) -> None:
|
||||
if self.current_visual_select:
|
||||
@@ -1657,8 +1662,7 @@ class Boss:
|
||||
selectable_windows.append((w.id, w.title))
|
||||
if len(selectable_windows) < 2:
|
||||
self.visual_window_select_action_trigger(selectable_windows[0][0] if selectable_windows else 0)
|
||||
if get_options().enable_audio_bell:
|
||||
ring_bell(tab.os_window_id)
|
||||
self.ring_bell_if_allowed(tab.os_window_id)
|
||||
return None
|
||||
cvs = self.current_visual_select
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ from typing import TYPE_CHECKING, Any, Optional, Sequence, Union
|
||||
|
||||
from .cli_stub import CLIOptions, SaveAsSessionOptions
|
||||
from .constants import config_dir, unserialize_launch_flag
|
||||
from .fast_data_types import get_options, ring_bell
|
||||
from .fast_data_types import get_options
|
||||
from .layout.interface import all_layouts
|
||||
from .options.types import Options
|
||||
from .options.utils import resize_window, to_layout_names, window_size
|
||||
@@ -467,8 +467,7 @@ def goto_session(boss: BossType, cmdline: Sequence[str]) -> None:
|
||||
if goto_session_history:
|
||||
switch_to_session(boss, goto_session_history[-1])
|
||||
return
|
||||
if get_options().enable_audio_bell:
|
||||
ring_bell(getattr(boss.active_tab_manager, 'os_window_id', 0))
|
||||
boss.ring_bell_if_allowed()
|
||||
return
|
||||
else:
|
||||
for x in cmdline:
|
||||
|
||||
Reference in New Issue
Block a user