diff --git a/kitty/boss.py b/kitty/boss.py index 81fbd32a4..8ac74e0e4 100755 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -23,7 +23,7 @@ from .conf.utils import BadLine, KeyAction, to_cmdline from .config import common_opts_as_dict, prepare_config_file_for_editing from .constants import ( appname, config_dir, is_macos, is_wayland, kitty_exe, - supports_primary_selection, website_url + supports_primary_selection, website_url, logo_png_file ) from .fast_data_types import ( CLOSE_BEING_CONFIRMED, GLFW_MOD_ALT, GLFW_MOD_CONTROL, GLFW_MOD_SHIFT, @@ -1453,20 +1453,25 @@ class Boss: if tab is not None: for w in tab: w.allow_remote_control = True + window = w elif window_type == 'os_window': os_window_id = self._new_os_window(SpecialWindow(cmd, **kw)) for tab in self.os_window_map[os_window_id]: for w in tab: w.allow_remote_control = True + window = w elif window_type == 'overlay': tab = self.active_tab if aw is not None and tab is not None: kw['overlay_for'] = aw.id - tab.new_special_window(SpecialWindow(cmd, **kw), allow_remote_control=True) + window = tab.new_special_window(SpecialWindow(cmd, **kw), allow_remote_control=True) else: tab = self.active_tab if tab is not None: - tab.new_special_window(SpecialWindow(cmd, **kw), allow_remote_control=True) + window = tab.new_special_window(SpecialWindow(cmd, **kw), allow_remote_control=True) + + path, ext = os.path.splitext(logo_png_file) + window.set_logo(f'{path}-128{ext}', position='bottom-right', alpha=0.25) def switch_focus_to(self, window_id: int) -> None: tab = self.active_tab diff --git a/kitty/window.py b/kitty/window.py index 9b59c5a9a..19a38f0c7 100644 --- a/kitty/window.py +++ b/kitty/window.py @@ -30,9 +30,9 @@ from .fast_data_types import ( click_mouse_url, compile_program, encode_key_for_tty, get_boss, get_clipboard_string, get_options, init_cell_program, mark_os_window_dirty, mouse_selection, move_cursor_to_mouse_if_in_prompt, pt_to_px, - set_clipboard_string, set_titlebar_color, set_window_padding, - set_window_render_data, update_ime_position_for_window, update_window_title, - update_window_visibility, viewport_for_window + set_clipboard_string, set_titlebar_color, set_window_logo, + set_window_padding, set_window_render_data, update_ime_position_for_window, + update_window_title, update_window_visibility, viewport_for_window ) from .keys import keyboard_mode_name, mod_mask from .notify import NotificationCommand, handle_notification_cmd @@ -1090,6 +1090,9 @@ class Window: 'text': text } + def set_logo(self, path: str, position: str = 'bottom-right', alpha: float = 0.5) -> None: + set_window_logo(self.os_window_id, self.tab_id, self.id, path, position, alpha) + # actions {{{ @ac('cp', 'Show scrollback in a pager like less')