aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Linford <tlinford@users.noreply.github.com>2025-07-30 11:54:40 +0200
committerGitHub <noreply@github.com>2025-07-30 11:54:40 +0200
commitaaa843eee0585598dfc7cced41897355191bc9ad (patch)
tree658c6e015cc7669896ed3f695d8a5c8a481da52a
parentfix(web-client): theme not loading (#4265) (diff)
downloadsl0ppij-aaa843eee0585598dfc7cced41897355191bc9ad.tar.gz
sl0ppij-aaa843eee0585598dfc7cced41897355191bc9ad.tar.xz
sl0ppij-aaa843eee0585598dfc7cced41897355191bc9ad.zip
fix(web): allow pasting with cmd-v (#4321)
-rw-r--r--zellij-client/assets/input.js18
-rw-r--r--zellij-client/assets/utils.js7
2 files changed, 19 insertions, 6 deletions
diff --git a/zellij-client/assets/input.js b/zellij-client/assets/input.js
index fc01a389..d878dd02 100644
--- a/zellij-client/assets/input.js
+++ b/zellij-client/assets/input.js
@@ -2,7 +2,8 @@
* Input handling for terminal events
*/
-import { encode_kitty_key } from './keyboard.js';
+import { encode_kitty_key } from "./keyboard.js";
+import { isMac } from "./utils.js";
/**
* Set up all input handlers for the terminal
@@ -13,14 +14,19 @@ export function setupInputHandlers(term, sendFunction) {
// Mouse tracking state
let prev_col = 0;
let prev_row = 0;
-
+
// Custom key event handler
term.attachCustomKeyEventHandler((ev) => {
if (ev.type === "keydown") {
if (ev.key == "V" && ev.ctrlKey && ev.shiftKey) {
- // pass ctrl-shift-v onwards so that paste is interpreted by xterm.js
- return;
+ // pass ctrl-shift-v onwards so that paste is interpreted by xterm.js
+ return;
+ }
+ if (isMac() && ev.key == "v" && ev.metaKey) {
+ // pass cmd-v onwards so that paste is interpreted by xterm.js
+ return;
}
+
let modifiers_count = 0;
let shift_keycode = 16;
let alt_keycode = 17;
@@ -107,7 +113,7 @@ export function setupInputHandlers(term, sendFunction) {
});
// Context menu handler
- document.addEventListener('contextmenu', function(event) {
+ document.addEventListener("contextmenu", function (event) {
if (event.altKey) {
// this is so that when the user does an alt-right-click to ungroup panes, the context menu will not appear
event.preventDefault();
@@ -118,7 +124,7 @@ export function setupInputHandlers(term, sendFunction) {
term.onData((data) => {
sendFunction(data);
});
-
+
term.onBinary((data) => {
const buffer = new Uint8Array(data.length);
for (let i = 0; i < data.length; ++i) {
diff --git a/zellij-client/assets/utils.js b/zellij-client/assets/utils.js
index bdb7c553..d66646cc 100644
--- a/zellij-client/assets/utils.js
+++ b/zellij-client/assets/utils.js
@@ -9,3 +9,10 @@
export function is_https() {
return document.location.protocol === "https:";
}
+
+export function isMac() {
+ if (navigator.userAgentData && navigator.userAgentData.platform) {
+ return navigator.userAgentData.platform === "macOS";
+ }
+ return navigator.platform.toUpperCase().includes("MAC");
+}