Allow using the pipe command to send screen and scrollback contents directly to the clipboard
See #1693
This commit is contained in:
parent
9dc410c9fd
commit
84fcabe5cf
@ -29,6 +29,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
||||
option to have the kitten wait till copying to clipboard is complete
|
||||
(:iss:`1693`)
|
||||
|
||||
- Allow using the :doc:`pipe <pipe>` command to send screen and scrollback
|
||||
contents directly to the clipboard (:iss:`1693`)
|
||||
|
||||
- Linux: Disable the Wayland backend on GNOME by default as GNOME has no
|
||||
support for server side decorations. Can be controlled by
|
||||
:opt:`linux_display_server`.
|
||||
|
||||
@ -43,6 +43,10 @@ You can choose where to run the pipe program:
|
||||
``tab``
|
||||
A new window in a new tab
|
||||
|
||||
``clipboard, primary``
|
||||
Copy the text directly to the clipboard. In this case the specified program
|
||||
is not run, so use some dummy program name for it.
|
||||
|
||||
``none``
|
||||
Run it in the background
|
||||
|
||||
|
||||
@ -910,6 +910,11 @@ class Boss:
|
||||
tm.new_tab(special_window=create_window(), cwd_from=cwd_from)
|
||||
elif dest == 'os_window':
|
||||
self._new_os_window(create_window(), cwd_from=cwd_from)
|
||||
elif dest in ('clipboard', 'primary'):
|
||||
env, stdin = self.process_stdin_source(stdin=source, window=window)
|
||||
if stdin:
|
||||
func = set_clipboard_string if dest == 'clipboard' else set_primary_selection
|
||||
func(stdin)
|
||||
else:
|
||||
import subprocess
|
||||
env, stdin = self.process_stdin_source(stdin=source, window=window)
|
||||
|
||||
@ -843,7 +843,8 @@ get_content_scale_for_window(PYNOARG) {
|
||||
static PyObject*
|
||||
set_clipboard_string(PyObject UNUSED *self, PyObject *args) {
|
||||
char *title;
|
||||
if(!PyArg_ParseTuple(args, "s", &title)) return NULL;
|
||||
Py_ssize_t sz;
|
||||
if(!PyArg_ParseTuple(args, "s#", &title, &sz)) return NULL;
|
||||
OSWindow *w = current_os_window();
|
||||
if (w) glfwSetClipboardString(w->handle, title);
|
||||
Py_RETURN_NONE;
|
||||
@ -987,7 +988,8 @@ get_primary_selection(PYNOARG) {
|
||||
static PyObject*
|
||||
set_primary_selection(PyObject UNUSED *self, PyObject *args) {
|
||||
char *text;
|
||||
if (!PyArg_ParseTuple(args, "s", &text)) return NULL;
|
||||
Py_ssize_t sz;
|
||||
if (!PyArg_ParseTuple(args, "s#", &text, &sz)) return NULL;
|
||||
if (glfwSetPrimarySelectionString) {
|
||||
OSWindow *w = current_os_window();
|
||||
if (w) glfwSetPrimarySelectionString(w->handle, text);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user