38 lines
843 B
PHP
Executable file
38 lines
843 B
PHP
Executable file
#!/usr/bin/env php
|
|
<?php
|
|
|
|
require __DIR__.'/base/block.php';
|
|
|
|
$command = 'ps aux | grep no-screensaver | grep -v grep';
|
|
|
|
$output = trim(shell_exec($command));
|
|
|
|
if (empty($output)) {
|
|
echo block(
|
|
'screensaver',
|
|
[
|
|
'full_text' => pspan(emoji(0xf108), color('normal'), '#000'),
|
|
'color' => color('normal'),
|
|
]
|
|
);
|
|
|
|
if (getenv('BLOCK_BUTTON') === '1') {
|
|
$command = '/home/simon/bin/no-screensaver >/dev/null 2>/dev/null &';
|
|
pclose(popen($command, 'r'));
|
|
}
|
|
} else {
|
|
echo block(
|
|
'screensaver',
|
|
[
|
|
'full_text' => pspan(emoji(0xf108), color('warning'), '#000'),
|
|
'color' => color('warning'),
|
|
]
|
|
);
|
|
|
|
if (getenv('BLOCK_BUTTON') === '1') {
|
|
$command = 'pkill no-screensaver';
|
|
shell_exec($command);
|
|
}
|
|
}
|
|
|