From e324355c06ff8a91aaaac4700edec91744dae0d6 Mon Sep 17 00:00:00 2001 From: Kurt Hindenburg Date: Sat, 16 Jan 2021 16:43:23 -0500 Subject: [PATCH] Set parent and foreground process ids on macOS This allows sending signals to work again. Correct macos keytab so Ctrl+C and Ctrl+V work. Add warning to show sending signals require foreground process id to be set. --- data/keyboard-layouts/macos.keytab | 4 ++-- src/ProcessInfo.cpp | 4 ++++ src/session/Session.cpp | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/data/keyboard-layouts/macos.keytab b/data/keyboard-layouts/macos.keytab index 33be1b9f..08b0be84 100644 --- a/data/keyboard-layouts/macos.keytab +++ b/data/keyboard-layouts/macos.keytab @@ -12,12 +12,12 @@ keyboard "macOS" # ~/Library/Application Support/konsole/ key A+Ctrl : "\x01" # goto start of line -#key C+Ctrl : "\x03" # Does not work - Cmd+C is copy +key C+Ctrl : "\x03" # interrupt key D+Ctrl : "\x04" # logout "exit" key E+Ctrl : "\x05" # goto end of line key L+Ctrl : "\x0C" # clear terminal screen key U+Ctrl : "\x15" # clear current line -#key V+Ctrl : "\x16" # Cmd+V is paste +key V+Ctrl : "\x16" # key W+Ctrl : "\x17" # erase the word preceding to the cursor position #key Z+Ctrl : "\x1a" diff --git a/src/ProcessInfo.cpp b/src/ProcessInfo.cpp index 18f91944..fc011c37 100644 --- a/src/ProcessInfo.cpp +++ b/src/ProcessInfo.cpp @@ -793,6 +793,10 @@ private: const QString deviceNumber = QString::fromUtf8(devname(((&kInfoProc->kp_eproc)->e_tdev), S_IFCHR)); const QString fullDeviceName = QStringLiteral("/dev/") + deviceNumber.rightJustified(3, QLatin1Char('0')); + + setParentPid(kInfoProc->kp_eproc.e_ppid); + setForegroundPid(kInfoProc->kp_eproc.e_pgid); + delete [] kInfoProc; const QByteArray deviceName = fullDeviceName.toLatin1(); diff --git a/src/session/Session.cpp b/src/session/Session.cpp index 292d7557..63f74c07 100644 --- a/src/session/Session.cpp +++ b/src/session/Session.cpp @@ -790,6 +790,8 @@ void Session::sendSignal(int signal) if (ok) { ::kill(pid, signal); + } else { + qWarning()<<"foreground process id not set, unable to send signal "<