Compare commits
No commits in common. "38281315f7d22d81e33f3a04d90b23be0aa58b6b" and "c666b582f6bb9460170db2c197d692ed174892cd" have entirely different histories.
38281315f7
...
c666b582f6
3 changed files with 0 additions and 1135 deletions
|
|
@ -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
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -49,16 +49,6 @@ in {
|
||||||
../kde/patches/libplasma-pr1214.patch
|
../kde/patches/libplasma-pr1214.patch
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
kwin = kPrev.kwin.overrideAttrs {
|
|
||||||
patches = kPrev.kwin.patches ++ [
|
|
||||||
../kde/patches/kwin-pr6406.patch
|
|
||||||
];
|
|
||||||
};
|
|
||||||
konsole = kPrev.konsole.overrideAttrs {
|
|
||||||
patches = [
|
|
||||||
../kde/patches/konsole-pr767.patch
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue