Have the paste_from_selection action paste from the clipboard on platforms that do not have a primary selection such as Wayland and macOS. Fixes #529

This commit is contained in:
Kovid Goyal 2018-05-10 07:42:03 +05:30
parent 5e8e141fb5
commit 9710282d22
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 7 additions and 2 deletions

View File

@ -15,7 +15,9 @@ from .config import (
MINIMUM_FONT_SIZE, initial_window_size, prepare_config_file_for_editing
)
from .config_utils import to_cmdline
from .constants import appname, config_dir, editor, set_boss
from .constants import (
appname, config_dir, editor, set_boss, supports_primary_selection
)
from .fast_data_types import (
ChildMonitor, create_os_window, current_os_window, destroy_global_data,
destroy_sprite_map, get_clipboard_string, glfw_post_empty_event,
@ -603,7 +605,7 @@ class Boss:
self.paste_to_active_window(text)
def paste_from_selection(self):
text = get_primary_selection()
text = get_primary_selection() if supports_primary_selection else get_clipboard_string()
self.paste_to_active_window(text)
def set_primary_selection(self):

View File

@ -105,3 +105,6 @@ def glfw_path(module):
is_wayland = False
if os.environ.get('WAYLAND_DISPLAY') and 'KITTY_ENABLE_WAYLAND' in os.environ and os.path.exists(glfw_path('wayland')):
is_wayland = True
supports_primary_selection = not is_macos and not is_wayland