Kde/konsole: remove now-upstreamed patch

This commit is contained in:
Toast 2024-12-18 15:49:04 +01:00
parent fe9678388d
commit 577aa1cc33
2 changed files with 1 additions and 99 deletions

View file

@ -1,96 +0,0 @@
From fa8f6054c992f8f28781933a23bccb91b3341d6e Mon Sep 17 00:00:00 2001
From: Christian Muehlhaeuser <muesli@gmail.com>
Date: Tue, 8 Nov 2022 08:55:14 +0100
Subject: [PATCH] Add support for OSC-52 write-only clipboard access
Implements OSC-52 write-only clipboard access. Already supported by
a wide range of other terminals, including alacritty, foot, kitty,
urxvt, wezterm, xterm, and others.
I've intentionally omitted read access to the clipboard as that
comes with several security concerns, which should be discussed
first.
---
src/Vt102Emulation.cpp | 36 ++++++++++++++++++++++++++++++++++++
src/Vt102Emulation.h | 2 +-
2 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/src/Vt102Emulation.cpp b/src/Vt102Emulation.cpp
index 49b23c77d4..3b1e389106 100644
--- a/src/Vt102Emulation.cpp
+++ b/src/Vt102Emulation.cpp
@@ -12,8 +12,10 @@
#include <cstdio>
// Qt
+#include <QApplication>
#include <QAudioOutput>
#include <QBuffer>
+#include <QClipboard>
#include <QEvent>
#include <QKeyEvent>
#include <QTimer>
@@ -1153,6 +1155,40 @@ void Vt102Emulation::processSessionAttributeRequest(const int tokenSize, const u
connect(action, &KNotificationAction::activated, this, [this, notification]() {
_currentScreen->currentTerminalDisplay()->notificationClicked(notification->xdgActivationToken());
});
+ }
+ if (attribute == Clipboard) {
+ // Clipboard
+ QStringList params = value.split(QLatin1Char(';'));
+ if (params.length() == 0) {
+ return;
+ }
+
+ bool clipboard = false;
+ bool selection = false;
+ if (params[0].isEmpty() || params[0].contains(QLatin1Char('c')) || params[0].contains(QLatin1Char('s'))) {
+ clipboard = true;
+ }
+ if (params[0].contains(QLatin1Char('p'))) {
+ selection = true;
+ }
+
+ if (params.length() == 2) {
+ // Copy to clipboard
+ if (clipboard) {
+ QApplication::clipboard()->setText(QString::fromUtf8(QByteArray::fromBase64(params[1].toUtf8())), QClipboard::Clipboard);
+ }
+ if (selection) {
+ QApplication::clipboard()->setText(QString::fromUtf8(QByteArray::fromBase64(params[1].toUtf8())), QClipboard::Selection);
+ }
+ } else {
+ // Clear clipboard
+ if (clipboard) {
+ QApplication::clipboard()->clear(QClipboard::Clipboard);
+ }
+ if (selection) {
+ QApplication::clipboard()->clear(QClipboard::Selection);
+ }
+ }
return;
}
diff --git a/src/Vt102Emulation.h b/src/Vt102Emulation.h
index 665e9f026d..3456e068d3 100644
--- a/src/Vt102Emulation.h
+++ b/src/Vt102Emulation.h
@@ -126,7 +126,6 @@ private:
void resetModes();
void resetTokenizer();
-#define MAX_TOKEN_LENGTH 256 // Max length of tokens (e.g. window title)
void addToCurrentToken(uint cc);
int tokenBufferPos;
@@ -183,6 +182,7 @@ private:
enum osc {
// https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands
ReportColors = 4,
+ Clipboard = 52,
ResetColors = 104,
// https://gitlab.freedesktop.org/Per_Bothner/specifications/blob/master/proposals/semantic-prompts.md
SemanticPrompts = 133,
--
GitLab