Fix tmp filename and generation for screenshot

This commit is contained in:
Simon Vieille 2018-02-09 17:21:15 +01:00
parent c6514a0124
commit 2e003d9dbc
No known key found for this signature in database
GPG Key ID: 919533E2B946EA10
1 changed files with 2 additions and 2 deletions

View File

@ -169,8 +169,8 @@ $server->addMessageHandler('text', function (ConnectionInterface $from, array $d
});
$server->addMessageHandler('screenshot', function (ConnectionInterface $from, array $data) use ($shell, $messageOutput) {
$tmpFilename = sprintf('%s.jpg', tempnam('/tmp', 'remote_i3wm_ws'));
$shell->exec('import -window root -quality 10 -display :0 %s', $tmpFilename);
$tmpFilename = sprintf('%s/remote_i3wm_ws_screenshot.jpg', sys_get_temp_dir());
$shell->exec('import -window root -quality 10 -display :0 %1$s && chmod 600 %1$s', $tmpFilename);
if (file_exists($tmpFilename)) {
$base64 = base64_encode(file_get_contents($tmpFilename));