update blocks

This commit is contained in:
Simon Vieille 2021-03-03 21:31:06 +01:00
parent 2cb77ae8c0
commit 0b227719b4
16 changed files with 94 additions and 38 deletions

View File

@ -1,35 +1,47 @@
[bandwidth_eth0]
command=/home/simon/.i3/bar/src/bandwidth.php eth0
command=/home/simon/.i3/bar/src/bandwidth.php eth0 inet eth
format=json
markup=pango
interval=5
[bandwidth_eth1]
command=/home/simon/.i3/bar/src/bandwidth.php eth1
[bandwidth_enx00e04cf69b06]
command=/home/simon/.i3/bar/src/bandwidth.php enx00e04cf69b06 inet eth
format=json
markup=pango
interval=5
[bandwidth_wlan0]
command=/home/simon/.i3/bar/src/bandwidth.php wlan0
[bandwidth_enx00e04c68022c]
command=/home/simon/.i3/bar/src/bandwidth.php enx00e04c68022c inet eth
format=json
markup=pango
interval=5
[bandwidth_wlp59s0]
command=/home/simon/.i3/bar/src/bandwidth.php wlp59s0 inet wifi
format=json
markup=pango
interval=1
[ip_eth0_inet]
command=/home/simon/.i3/bar/src/ip.php eth0
command=/home/simon/.i3/bar/src/ip.php eth0 inet eth
format=json
markup=pango
interval=10
[ip_eth1_inet]
command=/home/simon/.i3/bar/src/ip.php eth1
[ip_enx00e04cf69b06_inet]
command=/home/simon/.i3/bar/src/ip.php enx00e04cf69b06 inet eth
format=json
markup=pango
interval=10
[ip_wlan0_inet]
command=/home/simon/.i3/bar/src/ip.php wlan0
[ip_enx00e04c68022c_inet]
command=/home/simon/.i3/bar/src/ip.php enx00e04c68022c inet eth
format=json
markup=pango
interval=10
[ip_wlp59s0_inet]
command=/home/simon/.i3/bar/src/ip.php wlp59s0 inet wifi
format=json
markup=pango
interval=10
@ -70,26 +82,38 @@ format=json
markup=pango
interval=1
[i3remote]
command=/home/simon/.i3/bar/src/i3remote.php
format=json
markup=pango
interval=3
[screensaver]
command=/home/simon/.i3/bar/src/screensaver.php
format=json
markup=pango
interval=3
[meteo]
command=/home/simon/.i3/bar/src/meteo.php
format=json
markup=pango
interval=3600
#[meteo]
#command=/home/simon/.i3/bar/src/meteo.php
#format=json
#markup=pango
#interval=3600
[app_passwords]
command=/home/simon/.i3/bar/src/app.php app_passwords P "/home/simon/bin/deblan-passwords" '#444444' '#ffc337'
#[app_passwords]
#command=/home/simon/.i3/bar/src/app.php app_passwords P "/home/simon/bin/deblan-passwords" '#444444' '#ffc337'
#format=json
#markup=pango
#interval=1000
[app_otp]
command=/home/simon/.i3/bar/src/app.php app_otp "🔐" "/home/simon/bin/otpclient" '#363636' '#ffc337'
format=json
markup=pango
interval=1000
[app_cloud]
command=/home/simon/.i3/bar/src/app.php app_cloud C "xdg-open https://deblan.cloud/" '#5d5d7d' '#fff'
command=/home/simon/.i3/bar/src/app.php app_cloud C "xdg-open https://deblan.cloud/" '#3c4e74' '#fff'
format=json
markup=pango
interval=1000
@ -107,7 +131,7 @@ markup=pango
interval=1000
[time]
command=/home/simon/.i3/bar/src/time.php "H:i:s d/m/Y"
command=/home/simon/.i3/bar/src/time.php "H:i:s d/m"
format=json
markup=pango
interval=1

View File

@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
require __DIR__.'/base/block.php';

View File

@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
require __DIR__.'/base/block.php';

View File

@ -1,10 +1,11 @@
#!/usr/bin/php7.1
#!/usr/bin/env php
<?php
require __DIR__.'/base/block.php';
$iface = $argv[1] ?? 'eth0';
$inet = ($argv[2] ?? 'inet').' ';
$name = ($argv[3] ?? $iface);
$command = sprintf(
'ip address show %s | grep %s | awk \'{ print $2 }\' | cut -d/ -f1',
@ -27,7 +28,7 @@ if (empty($bwidth)) {
$down = pemoji(0xf0ab).$bwidth[0].'Ko/s ';
$up = $bwidth[1].'Ko/s'.pemoji(0xf0aa);
$fullText = pspan($iface, '#ccc', '#222').span($down.$up, '#ddd', '#000');
$fullText = pspan($name, '#ccc', '#222').span($down.$up, '#ddd', '#000');
echo block(
'bandwidth_'.$iface,

View File

@ -55,6 +55,35 @@ function pspan($text, $foreground = null, $background = null)
return span(sprintf(' %s ', $text), $foreground, $background);
}
/**
* Creates span with right padding.
*
* @param string $text
* @param string $foreground
* @param string $background
*
* @return string
*/
function rpspan($text, $foreground = null, $background = null)
{
return span(sprintf('%s ', $text), $foreground, $background);
}
/**
* Creates span with left padding.
*
* @param string $text
* @param string $foreground
* @param string $background
*
* @return string
*/
function lpspan($text, $foreground = null, $background = null)
{
return span(sprintf(' %s', $text), $foreground, $background);
}
/**
* Creates span.
*

View File

@ -1,4 +1,4 @@
#!/usr/bin/php7.1
#!/usr/bin/env php
<?php
require __DIR__.'/base/block.php';

View File

@ -1,13 +1,14 @@
#!/usr/bin/php7.1
#!/usr/bin/env php
<?php
require __DIR__.'/base/block.php';
$iface = $argv[1] ?? 'eth0';
$inet = ($argv[2] ?? 'inet').' ';
$name = ($argv[3] ?? $iface);
$command = sprintf(
'ip address show %s | grep %s | awk \'{ print $2 }\' | cut -d/ -f1 | head -n 1',
'ip address show %s | grep %s | awk \'{ print $2 }\' | tail -n 1 | cut -d/ -f1 | head -n 1',
escapeshellarg($iface),
escapeshellarg($inet)
);
@ -18,7 +19,7 @@ if (empty($ip)) {
die;
}
$fullText = pspan($iface, '#ccc', '#222').pspan($ip, '#ddd', '#000');
$fullText = pspan($name, '#ccc', '#222').pspan($ip, '#ddd', '#000');
if (getenv('BLOCK_BUTTON') === '1') {
shell_exec('

View File

@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
require __DIR__.'/base/block.php';

View File

@ -1,4 +1,4 @@
#!/usr/bin/php7.1
#!/usr/bin/env php
<?php
require __DIR__.'/base/block.php';
@ -31,7 +31,8 @@ if (!empty($output)) {
}
if (getenv('BLOCK_BUTTON') === '1') {
$url = 'https://fr.wttr.in/';
$command = sprintf('xdg-open %s', escapeshellarg($url));
// $url = 'https://fr.wttr.in/';
// $command = sprintf('xdg-open %s', escapeshellarg($url));
$command = 'gnome-weather --class="gnome-weather"&';
shell_exec($command);
}

View File

@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
require __DIR__.'/base/block.php';

View File

@ -1,4 +1,4 @@
#!/usr/bin/php7.1
#!/usr/bin/env php
<?php
require __DIR__.'/base/block.php';

View File

@ -1,4 +1,4 @@
#!/usr/bin/php7.1
#!/usr/bin/env php
<?php
require __DIR__.'/base/block.php';

View File

@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
require __DIR__.'/base/block.php';

View File

@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
require __DIR__.'/base/block.php';

View File

@ -1,4 +1,4 @@
#!/usr/bin/php7.1
#!/usr/bin/env php
<?php
require __DIR__.'/base/block.php';

View File

@ -1,4 +1,4 @@
#!/usr/bin/php7.3
#!/usr/bin/env php
<?php
require __DIR__.'/base/block.php';