Option to copy to clipboard on mouse select

This commit is contained in:
Kovid Goyal 2018-01-12 07:33:21 +05:30
parent d43d6ab0a9
commit 81b5d2c4f2
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 15 additions and 2 deletions

View File

@ -14,6 +14,8 @@ version 0.7.0 [future]
- Sessions: Allow setting titles and working directories for individual windows - Sessions: Allow setting titles and working directories for individual windows
- Option to copy to clipboard on mouse select
- Fix incorrect reporting of mouse move events when using the SGR protocol - Fix incorrect reporting of mouse move events when using the SGR protocol
- Make alt+backspace delete the previous word - Make alt+backspace delete the previous word

View File

@ -12,8 +12,9 @@ from .constants import appname, set_boss, wakeup
from .fast_data_types import ( from .fast_data_types import (
ChildMonitor, create_os_window, current_os_window, destroy_global_data, ChildMonitor, create_os_window, current_os_window, destroy_global_data,
destroy_sprite_map, get_clipboard_string, glfw_post_empty_event, destroy_sprite_map, get_clipboard_string, glfw_post_empty_event,
layout_sprite_map, mark_os_window_for_close, set_dpi_from_os_window, layout_sprite_map, mark_os_window_for_close, set_clipboard_string,
show_window, toggle_fullscreen, viewport_for_window set_dpi_from_os_window, show_window, toggle_fullscreen,
viewport_for_window
) )
from .fonts.render import prerender, resize_fonts, set_font_family from .fonts.render import prerender, resize_fonts, set_font_family
from .keys import get_shortcut from .keys import get_shortcut
@ -415,6 +416,8 @@ class Boss:
text = w.text_for_selection() text = w.text_for_selection()
if text: if text:
set_primary_selection(text) set_primary_selection(text)
if self.opts.copy_on_select:
set_clipboard_string(text)
def goto_tab(self, tab_num): def goto_tab(self, tab_num):
tm = self.active_tab_manager tm = self.active_tab_manager

View File

@ -281,6 +281,7 @@ type_map = {
'inactive_text_alpha': unit_float, 'inactive_text_alpha': unit_float,
'url_style': url_style, 'url_style': url_style,
'prefer_color_emoji': to_bool, 'prefer_color_emoji': to_bool,
'copy_on_select': to_bool,
} }
for name in ( for name in (

View File

@ -369,6 +369,13 @@ map ctrl+shift+f11 toggle_fullscreen
# OS specific tweaks # OS specific tweaks
# Copy to clipboard on select. With this enabled, simply selecting text with
# the mouse will cause the text to be copied to clipboard. Useful on platforms
# such as macOS/Wayland that do not have the concept of primary selections. Note
# that this is a security risk, as all programs, including websites open in your
# browser can read the contents of the clipboard.
copy_on_select no
# Hide the kitty window's title bar on macOS. # Hide the kitty window's title bar on macOS.
macos_hide_titlebar no macos_hide_titlebar no