From 1fb131ee3d1489c74445e8b47743de9967334cda Mon Sep 17 00:00:00 2001 From: nadrad Date: Mon, 4 Dec 2023 06:43:00 +0100 Subject: [PATCH] added klipper support --- h-m-m | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/h-m-m b/h-m-m index 07d7167..f639dc7 100755 --- a/h-m-m +++ b/h-m-m @@ -466,12 +466,12 @@ function check_the_available_clipboard_tool(&$mm) // now, the main OS ;) - exec('command -v xclip xsel wl-copy', $result); + exec('command -v xclip xsel wl-copy klipper', $result); $tool = basename($result[0] ?? ''); if (trim($tool)==='') { - echo "Can't find your clipboard tool! I expected to find xclip, xsel, or wl-clipboard.".PHP_EOL; + echo "Can't find your clipboard tool! I expected to find xclip, xsel, wl-clipboard, or Klipper.".PHP_EOL; exit(1); } @@ -492,6 +492,12 @@ function check_the_available_clipboard_tool(&$mm) $mm['os_clipboard']['read'] = 'wl-paste'; break; + case 'klipper': + $mm['clipboard'] = 'command'; + $mm['clipboard_in_command'] = 'qdbus org.kde.klipper /klipper setClipboardContents %text%'; + $mm['clipboard_out_command'] = 'qdbus org.kde.klipper /klipper getClipboardContents'; + break; + default: echo "I can't find your clipboard tool!".PHP_EOL; exit(1); @@ -2864,7 +2870,8 @@ function copy_to_clipboard(&$mm, $text) { case 'os': $clip = popen($mm['os_clipboard']['write'],'wb'); - if (!isset($clip)) return; + if (!isset($clip)) + return; fwrite($clip,$text); pclose($clip); break;