packages/konsole-osc52/osc52.patch

45 lines
1.4 KiB
Diff
Raw Normal View History

2023-09-14 20:51:07 +00:00
diff --git a/src/Vt102Emulation.cpp b/src/Vt102Emulation.cpp
index bebd5e399..a434ee4ab 100644
--- a/src/Vt102Emulation.cpp
+++ b/src/Vt102Emulation.cpp
@@ -13,7 +13,9 @@
2023-09-14 20:51:07 +00:00
// Qt
#include <QAudioOutput>
2023-09-14 20:51:07 +00:00
+#include <QApplication>
#include <QBuffer>
+#include <QClipboard>
#include <QEvent>
#include <QKeyEvent>
#include <QTimer>
@@ -1147,6 +1149,29 @@ void Vt102Emulation::processSessionAttributeRequest(const int tokenSize, const u
connect(notification, &KNotification::defaultActivated, this, [this, notification]() {
_currentScreen->currentTerminalDisplay()->notificationClicked(notification->xdgActivationToken());
});
+ }
+ if (attribute == 52) {
+ // Clipboard
+ QStringList params = value.split(QLatin1Char(';'));
+ if (params.length() == 0) {
+ return;
+ }
+
+ QClipboard::Mode mode;
+ if (params[0] == QLatin1Char('c')) {
+ mode = QClipboard::Clipboard;
+ } else if (params[0] == QLatin1Char('p')) {
+ mode = QClipboard::Selection;
+ } else {
+ return;
+ }
+
+ if (params.length() == 2) {
+ // Copy to clipboard
+ QApplication::clipboard()->setText(QString::fromUtf8(QByteArray::fromBase64(params[1].toUtf8())), mode);
+ } else {
+ QApplication::clipboard()->clear(mode);
+ }
return;
}