doti3/bar/src/app.php
2017-12-14 16:49:32 +01:00

31 lines
576 B
PHP
Executable file

#!/usr/bin/php
<?php
require __DIR__.'/base/block.php';
$name = $argv[1] ?? null;
$app = $argv[2] ?? null;
$color = $argv[3] ?? color('normal');
$separator = (bool) ($argv[4] ?? true);
if (empty($name) && empty($app)) {
die;
}
$fullText = sprintf('[%s]', $name);
if (getenv('BLOCK_BUTTON') === '1') {
pclose(popen($app, 'r'));
}
echo block(
'app_'.$name,
[
'full_text' => $fullText,
'short_text' => $shortText,
'color' => $color,
'separator' => $separator,
'separator_block_width' => $separator ? 20 : 0,
]
);