Compare commits

...

2 commits

Author SHA1 Message Date
nadrad 1fb131ee3d added klipper support 2023-12-04 06:43:00 +01:00
nadrad 2c061c965b switched ${var} to {$var} 2023-12-04 06:24:43 +01:00

25
h-m-m
View file

@ -466,12 +466,12 @@ function check_the_available_clipboard_tool(&$mm)
// now, the main OS ;) // 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] ?? ''); $tool = basename($result[0] ?? '');
if (trim($tool)==='') 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); exit(1);
} }
@ -492,6 +492,12 @@ function check_the_available_clipboard_tool(&$mm)
$mm['os_clipboard']['read'] = 'wl-paste'; $mm['os_clipboard']['read'] = 'wl-paste';
break; 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: default:
echo "I can't find your clipboard tool!".PHP_EOL; echo "I can't find your clipboard tool!".PHP_EOL;
exit(1); exit(1);
@ -2864,7 +2870,8 @@ function copy_to_clipboard(&$mm, $text)
{ {
case 'os': case 'os':
$clip = popen($mm['os_clipboard']['write'],'wb'); $clip = popen($mm['os_clipboard']['write'],'wb');
if (!isset($clip)) return; if (!isset($clip))
return;
fwrite($clip,$text); fwrite($clip,$text);
pclose($clip); pclose($clip);
break; break;
@ -3468,12 +3475,11 @@ function display(&$mm, $force_center = false)
if ($mm['show_logo']) if ($mm['show_logo'])
{ {
$ll = $mm['terminal_width'] - 14; $ll = $mm['terminal_width'] - 14;
echo "\033[1;${ll}f\033[38;5;237m ┌────────────┐ "; echo "\033[1;{$ll}f\033[38;5;237m ┌────────────┐ ";
echo "\033[2;${ll}f\033[38;5;237m │ ╭─ m │ "; echo "\033[2;{$ll}f\033[38;5;237m │ ╭─ m │ ";
echo "\033[3;${ll}f\033[38;5;237m │ h ──┤ │ "; echo "\033[3;{$ll}f\033[38;5;237m │ h ──┤ │ ";
echo "\033[4;${ll}f\033[38;5;237m │ ╰─── m │ "; echo "\033[4;{$ll}f\033[38;5;237m │ ╰─── m │ ";
echo "\033[5;${ll}f\033[38;5;237m └────────────┘ "; echo "\033[5;{$ll}f\033[38;5;237m └────────────┘ ";
$mm['show_logo'] = false;
} }
} }
@ -3638,6 +3644,7 @@ load_file($mm);
collapse_all($mm); collapse_all($mm);
collapse_level($mm, $mm['initial_depth'], false); collapse_level($mm, $mm['initial_depth'], false);
$mm['show_logo'] = false;
monitor_key_presses($mm); monitor_key_presses($mm);
// }}} // }}}