evolutions

This commit is contained in:
Simon Vieille 2017-12-15 17:43:15 +01:00
parent ced98dd1c1
commit b9e4a512a7
No known key found for this signature in database
GPG key ID: 919533E2B946EA10
5 changed files with 28 additions and 16 deletions

View file

@ -48,13 +48,11 @@ interval=100
command=/home/simon/.i3/bar/src/mount_point_space.php root /
format=json
interval=5
min_width=button=1
[mount_point_space_home]
command=/home/simon/.i3/bar/src/mount_point_space.php home /home 90 95
format=json
interval=5
min_width=button=1
[memory]
command=memory
@ -63,27 +61,31 @@ command=memory
command=/home/simon/.i3/bar/src/spotify.php
format=json
interval=1
min_width=button=1
[app_S]
command=/home/simon/.i3/bar/src/app.php S "i3-msg workspace '6. MEDIA'" '#1db954' 0
format=json
interval=1000
[app_Y]
command=/home/simon/.i3/bar/src/app.php Y "xdg-open https://www.youtube.com/feed/subscriptions" '#f00' 0
format=json
interval=100
interval=1000
[app_F]
command=/home/simon/.i3/bar/src/app.php F "xdg-open https://www.facebook.com/" '#598df3' 0
format=json
interval=100
interval=1000
[app_C]
command=/home/simon/.i3/bar/src/app.php C "xdg-open https://choualbox.com/new" '#eeb819' 0
format=json
interval=100
interval=1000
[app_R]
command=/home/simon/.i3/bar/src/app.php R "xdg-open https://redmine.like-inn-developpement.com/client" '#ff4e51'
format=json
interval=100
interval=1000
[volume]
command=/home/simon/.i3/bar/src/volume.php
@ -100,13 +102,14 @@ command=/home/simon/.i3/bar/src/date.php
format=json
interval=30
[ttr_news]
[rss]
command=/home/simon/.i3/bar/src/rss.php "https://tiny.deblan.org/public.php?op=rss&id=-3&key=17c659af1ad27f30941a724fcf48421d1e83081a" "RSS"
min_width=button=1
align=left
interval=30
format=json
[acpi]
command=/home/simon/.i3/bar/src/acpi.php
format=json
interval=1
interval=20

View file

@ -9,7 +9,11 @@ if (!preg_match('`Discharging`', $acpi)) {
preg_match('`([0-9]+%)`', $acpi, $values);
if (!empty($values)) {
$charging = $values[1];
$charging = (int) $values[1];
if ($charging === 100) {
return;
}
if ($charging < 20) {
$color = color('critical');

View file

@ -5,14 +5,13 @@ function color($label)
$colors = [
'music' => '#C3D4FF',
'date' => '#E9F1FF',
//'date' => '#ffffff',
'info' => '#E9F1FF',
'critical' => '#FF474A',
'warning' => '#FF6836',
'normal' => '#B3FF6C',
];
return $colors[$label] ?? '#ffffff';
return $colors[$label] ?? $colors['info'];
}
function block(string $name, array $options = [])

View file

@ -7,7 +7,7 @@ $iface = $argv[1] ?? 'eth0';
$inet = ($argv[2] ?? 'inet').' ';
$command = sprintf(
'ip address show %s | grep %s | awk \'{ print $2 }\'',
'ip address show %s | grep %s | awk \'{ print $2 }\' | cut -d/ -f1',
escapeshellarg($iface),
escapeshellarg($inet)
);
@ -22,7 +22,7 @@ $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('echo '.escapeshellarg($ip).' | xclip');
}
echo block(

View file

@ -18,7 +18,7 @@ if (empty($content)) {
preg_match_all('/<entry/isU', $content, $matches, PREG_SET_ORDER);
$fullText = sprintf('[%s] %s', $title, count($matches));
$fullText = sprintf('[%s] %s', $title, $count = count($matches));
$blockButton = (int) getenv('BLOCK_BUTTON');
@ -26,4 +26,10 @@ if ($blockButton === 1) {
shell_exec('xdg-open https://tiny.deblan.org/index.php');
}
echo $fullText;
echo block(
'rss',
[
'full_text' => $fullText,
'color' => $count ? color('normal') : color('info'),
]
);