mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-26 18:22:09 +02:00
Use a logo for the kitty shell window
This commit is contained in:
@@ -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 .config import common_opts_as_dict, prepare_config_file_for_editing
|
||||||
from .constants import (
|
from .constants import (
|
||||||
appname, config_dir, is_macos, is_wayland, kitty_exe,
|
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 (
|
from .fast_data_types import (
|
||||||
CLOSE_BEING_CONFIRMED, GLFW_MOD_ALT, GLFW_MOD_CONTROL, GLFW_MOD_SHIFT,
|
CLOSE_BEING_CONFIRMED, GLFW_MOD_ALT, GLFW_MOD_CONTROL, GLFW_MOD_SHIFT,
|
||||||
@@ -1453,20 +1453,25 @@ class Boss:
|
|||||||
if tab is not None:
|
if tab is not None:
|
||||||
for w in tab:
|
for w in tab:
|
||||||
w.allow_remote_control = True
|
w.allow_remote_control = True
|
||||||
|
window = w
|
||||||
elif window_type == 'os_window':
|
elif window_type == 'os_window':
|
||||||
os_window_id = self._new_os_window(SpecialWindow(cmd, **kw))
|
os_window_id = self._new_os_window(SpecialWindow(cmd, **kw))
|
||||||
for tab in self.os_window_map[os_window_id]:
|
for tab in self.os_window_map[os_window_id]:
|
||||||
for w in tab:
|
for w in tab:
|
||||||
w.allow_remote_control = True
|
w.allow_remote_control = True
|
||||||
|
window = w
|
||||||
elif window_type == 'overlay':
|
elif window_type == 'overlay':
|
||||||
tab = self.active_tab
|
tab = self.active_tab
|
||||||
if aw is not None and tab is not None:
|
if aw is not None and tab is not None:
|
||||||
kw['overlay_for'] = aw.id
|
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:
|
else:
|
||||||
tab = self.active_tab
|
tab = self.active_tab
|
||||||
if tab is not None:
|
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:
|
def switch_focus_to(self, window_id: int) -> None:
|
||||||
tab = self.active_tab
|
tab = self.active_tab
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ from .fast_data_types import (
|
|||||||
click_mouse_url, compile_program, encode_key_for_tty, get_boss,
|
click_mouse_url, compile_program, encode_key_for_tty, get_boss,
|
||||||
get_clipboard_string, get_options, init_cell_program, mark_os_window_dirty,
|
get_clipboard_string, get_options, init_cell_program, mark_os_window_dirty,
|
||||||
mouse_selection, move_cursor_to_mouse_if_in_prompt, pt_to_px,
|
mouse_selection, move_cursor_to_mouse_if_in_prompt, pt_to_px,
|
||||||
set_clipboard_string, set_titlebar_color, set_window_padding,
|
set_clipboard_string, set_titlebar_color, set_window_logo,
|
||||||
set_window_render_data, update_ime_position_for_window, update_window_title,
|
set_window_padding, set_window_render_data, update_ime_position_for_window,
|
||||||
update_window_visibility, viewport_for_window
|
update_window_title, update_window_visibility, viewport_for_window
|
||||||
)
|
)
|
||||||
from .keys import keyboard_mode_name, mod_mask
|
from .keys import keyboard_mode_name, mod_mask
|
||||||
from .notify import NotificationCommand, handle_notification_cmd
|
from .notify import NotificationCommand, handle_notification_cmd
|
||||||
@@ -1090,6 +1090,9 @@ class Window:
|
|||||||
'text': text
|
'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 {{{
|
# actions {{{
|
||||||
|
|
||||||
@ac('cp', 'Show scrollback in a pager like less')
|
@ac('cp', 'Show scrollback in a pager like less')
|
||||||
|
|||||||
Reference in New Issue
Block a user