Fix and notifications
This commit is contained in:
parent
9b654ba474
commit
eb7c133232
|
@ -26,7 +26,7 @@ if (!preg_match('`Discharging`', $acpi)) {
|
|||
$charging .= '↑';
|
||||
|
||||
$block = block(
|
||||
'volume',
|
||||
'acpi',
|
||||
[
|
||||
'full_text' => $charging,
|
||||
'color' => $color,
|
||||
|
@ -34,7 +34,7 @@ if (!preg_match('`Discharging`', $acpi)) {
|
|||
);
|
||||
} else {
|
||||
$block = block(
|
||||
'volume',
|
||||
'acpi',
|
||||
[
|
||||
'full_text' => '??? ↑',
|
||||
'color' => color('info'),
|
||||
|
@ -54,10 +54,10 @@ if (!preg_match('`Discharging`', $acpi)) {
|
|||
|
||||
$charging = $values[1].'↓';
|
||||
$times = str_replace(':', 'h', $values[2]);
|
||||
$text = implode(' ', array($charging, $times));
|
||||
$text = implode(' ', [$charging, $times]);
|
||||
|
||||
$block = block(
|
||||
'volume',
|
||||
'acpi',
|
||||
[
|
||||
'full_text' => $text,
|
||||
'color' => $color,
|
||||
|
|
|
@ -31,5 +31,6 @@ echo block(
|
|||
[
|
||||
'full_text' => $fullText,
|
||||
'color' => '#ffffff',
|
||||
'urgent' => 1,
|
||||
]
|
||||
);
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Get the hexa code of a color by its label.
|
||||
*
|
||||
* @param string $label
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function color($label)
|
||||
{
|
||||
$colors = [
|
||||
|
@ -14,6 +21,14 @@ function color($label)
|
|||
return $colors[$label] ?? $colors['info'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a json of a block.
|
||||
*
|
||||
* @param string $name
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function block(string $name, array $options = [])
|
||||
{
|
||||
$options = array_merge(
|
||||
|
@ -28,5 +43,5 @@ function block(string $name, array $options = [])
|
|||
$options
|
||||
);
|
||||
|
||||
echo stripslashes(json_encode($options, JSON_UNESCAPED_UNICODE));
|
||||
return stripslashes(json_encode($options, JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
|
|
|
@ -22,7 +22,8 @@ $fullText = sprintf('[%s] %s', $iface, $ip);
|
|||
$shortText = sprintf('%s: %s', $iface, $ip);
|
||||
|
||||
if (getenv('BLOCK_BUTTON') === '1') {
|
||||
shell_exec('echo '.escapeshellarg($ip).' | xclip');
|
||||
shell_exec('export DISPLAY=:0; echo '.escapeshellarg($ip).' | xclip');
|
||||
shell_exec('export DISPLAY=:0; echo '.escapeshellarg($ip).' | xclip --selection c');
|
||||
}
|
||||
|
||||
echo block(
|
||||
|
|
|
@ -17,6 +17,11 @@ if (empty($ip)) {
|
|||
die;
|
||||
}
|
||||
|
||||
if (getenv('BLOCK_BUTTON') === '1') {
|
||||
shell_exec('export DISPLAY=:0; echo '.escapeshellarg($ip).' | xclip');
|
||||
shell_exec('export DISPLAY=:0; echo '.escapeshellarg($ip).' | xclip -sel c');
|
||||
}
|
||||
|
||||
$fullText = sprintf('[%s] %s', $iface, $ip);
|
||||
$shortText = sprintf('%s: %s', $iface, $ip);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ $fullText = sprintf('[%s] %s', $title, $count = count($matches));
|
|||
$blockButton = (int) getenv('BLOCK_BUTTON');
|
||||
|
||||
if ($blockButton === 1) {
|
||||
shell_exec('xdg-open https://tiny.deblan.org/index.php');
|
||||
shell_exec('xdg-open "https://tiny.deblan.org/index.php"');
|
||||
}
|
||||
|
||||
echo block(
|
||||
|
|
|
@ -11,6 +11,10 @@ if (getenv('BLOCK_BUTTON') === '1') {
|
|||
shell_exec('i3-msg \'workspace "3. MAIL"\'');
|
||||
}
|
||||
|
||||
if (date('H:i:s') === '13:37:00') {
|
||||
shell_exec('notify-send "1337" "Powaaaa" --icon=/home/simon/Images/if_geek_zombie_60815.png');
|
||||
}
|
||||
|
||||
echo block(
|
||||
'time',
|
||||
[
|
||||
|
|
Loading…
Reference in New Issue