mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-24 01:08:10 +02:00
Allow using the pipe command to send screen and scrollback contents directly to the clipboard
See #1693
This commit is contained in:
@@ -29,6 +29,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
|||||||
option to have the kitten wait till copying to clipboard is complete
|
option to have the kitten wait till copying to clipboard is complete
|
||||||
(:iss:`1693`)
|
(: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
|
- Linux: Disable the Wayland backend on GNOME by default as GNOME has no
|
||||||
support for server side decorations. Can be controlled by
|
support for server side decorations. Can be controlled by
|
||||||
:opt:`linux_display_server`.
|
:opt:`linux_display_server`.
|
||||||
|
|||||||
@@ -43,6 +43,10 @@ You can choose where to run the pipe program:
|
|||||||
``tab``
|
``tab``
|
||||||
A new window in a new 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``
|
``none``
|
||||||
Run it in the background
|
Run it in the background
|
||||||
|
|
||||||
|
|||||||
@@ -910,6 +910,11 @@ class Boss:
|
|||||||
tm.new_tab(special_window=create_window(), cwd_from=cwd_from)
|
tm.new_tab(special_window=create_window(), cwd_from=cwd_from)
|
||||||
elif dest == 'os_window':
|
elif dest == 'os_window':
|
||||||
self._new_os_window(create_window(), cwd_from=cwd_from)
|
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:
|
else:
|
||||||
import subprocess
|
import subprocess
|
||||||
env, stdin = self.process_stdin_source(stdin=source, window=window)
|
env, stdin = self.process_stdin_source(stdin=source, window=window)
|
||||||
|
|||||||
@@ -843,7 +843,8 @@ get_content_scale_for_window(PYNOARG) {
|
|||||||
static PyObject*
|
static PyObject*
|
||||||
set_clipboard_string(PyObject UNUSED *self, PyObject *args) {
|
set_clipboard_string(PyObject UNUSED *self, PyObject *args) {
|
||||||
char *title;
|
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();
|
OSWindow *w = current_os_window();
|
||||||
if (w) glfwSetClipboardString(w->handle, title);
|
if (w) glfwSetClipboardString(w->handle, title);
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
@@ -987,7 +988,8 @@ get_primary_selection(PYNOARG) {
|
|||||||
static PyObject*
|
static PyObject*
|
||||||
set_primary_selection(PyObject UNUSED *self, PyObject *args) {
|
set_primary_selection(PyObject UNUSED *self, PyObject *args) {
|
||||||
char *text;
|
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) {
|
if (glfwSetPrimarySelectionString) {
|
||||||
OSWindow *w = current_os_window();
|
OSWindow *w = current_os_window();
|
||||||
if (w) glfwSetPrimarySelectionString(w->handle, text);
|
if (w) glfwSetPrimarySelectionString(w->handle, text);
|
||||||
|
|||||||
Reference in New Issue
Block a user