This commit is contained in:
Simon Vieille 2020-01-14 11:35:27 +01:00
commit fcc31cdba8
Signed by: deblan
GPG key ID: 03383D15A1D31745
13 changed files with 127 additions and 69 deletions

View file

@ -16,12 +16,6 @@ format=json
markup=pango
interval=1
[inet_eth0]
command=/home/simon/.i3/bar/src/ip.php eth0
format=json
markup=pango
interval=10
[ip_eth0_inet]
command=/home/simon/.i3/bar/src/ip.php eth0
format=json
@ -40,12 +34,6 @@ format=json
markup=pango
interval=10
[ip_easytether0_inet]
command=/home/simon/.i3/bar/src/ip.php easytether0
format=json
markup=pango
interval=100
[ip_wan]
command=/home/simon/.i3/bar/src/ip_wan.php
format=json
@ -88,14 +76,32 @@ format=json
markup=pango
interval=3
[app_C]
command=/home/simon/.i3/bar/src/app.php C "xdg-open https://cloud.deblan.org/nc/" '#5d5d7d' '#fff'
[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'
format=json
markup=pango
interval=1000
[app_Y]
command=/home/simon/.i3/bar/src/app.php Y "xdg-open https://www.youtube.com/feed/subscriptions" '#c74a42' '#fff'
[app_cloud]
command=/home/simon/.i3/bar/src/app.php app_cloud C "xdg-open https://deblan.cloud/" '#5d5d7d' '#fff'
format=json
markup=pango
interval=1000
[app_youtube]
command=/home/simon/.i3/bar/src/app.php app_youtube Y "xdg-open https://www.youtube.com/feed/subscriptions" '#c74a42' '#fff'
format=json
markup=pango
interval=1000
[app_netflix]
command=/home/simon/.i3/bar/src/app.php app_netflix N "xdg-open https://www.netflix.com/browse" '#363636' '#e50914'
format=json
markup=pango
interval=1000
@ -106,14 +112,15 @@ format=json
markup=pango
interval=1
#[date]
#command=/home/simon/.i3/bar/src/date.php
#format=json
#markup=pango
#interval=30
[rss_tts]
command=/home/simon/.i3/bar/src/rss.php "rss_tts" "https://tiny.deblan.org/public.php?op=rss&id=-3&key=17c659af1ad27f30941a724fcf48421d1e83081a" "https://tiny.deblan.org/"
align=left
interval=30
format=json
markup=pango
[rss]
command=/home/simon/.i3/bar/src/rss.php "https://tiny.deblan.org/public.php?op=rss&id=-3&key=17c659af1ad27f30941a724fcf48421d1e83081a" "https://tiny.deblan.org/"
[rss_wallabag]
command=/home/simon/.i3/bar/src/rss.php "rss_wallabag" "https://wallabag.deblan.org/simon/AMHCUowxsRPdNiz/unread.xml" "https://wallabag.deblan.org/" "#00d8f0" "#aabfc1"
align=left
interval=30
format=json

View file

@ -3,10 +3,11 @@
require __DIR__.'/base/block.php';
$name = $argv[1] ?? null;
$app = $argv[2] ?? null;
$background = $argv[3] ?? '#333';
$foreground = $argv[4] ?? '#fff';
$blockName = $argv[1] ?? null;
$name = $argv[2] ?? null;
$app = $argv[3] ?? null;
$background = $argv[4] ?? '#333';
$foreground = $argv[5] ?? '#fff';
if (empty($name) && empty($app)) {
die;
@ -17,7 +18,7 @@ if (getenv('BLOCK_BUTTON') === '1') {
}
echo block(
'app_'.$name,
$blockName,
[
'full_text' => pspan($name, $foreground, $background),
]

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)
);
@ -24,10 +24,10 @@ if (empty($bwidth)) {
die;
}
$up = $bwidth[1].'Ko/s'.pemoji(0xf0aa);
$down = pemoji(0xf0ab).$bwidth[0].'Ko/s ';
$up = $bwidth[1].'Ko/s'.pemoji(0xf0aa);
$fullText = pspan($iface, '#ccc', '#222').pspan($down.$up, '#ddd', '#000');
$fullText = pspan($iface, '#ccc', '#222').span($down.$up, '#ddd', '#000');
echo block(
'bandwidth_'.$iface,

View file

@ -28,7 +28,7 @@ function color($label)
*/
function pemoji($char)
{
return '<span font=\'FontAwesome\'> '.IntlChar::chr($char).' </span>';
return ' <span font=\'FontAwesome\'>'.IntlChar::chr($char).'</span> ';
}
/**

View file

@ -5,10 +5,11 @@ require __DIR__.'/base/block.php';
$format = $argv[1] ?? 'd/m/Y';
$fullText = span(' '.emoji(0xf073).' '.date($format).' ', color('date'), '#444');
$fullText = pspan(emoji(0xf073).' '.date($format), color('date'), '#444').' ';
if (getenv('BLOCK_BUTTON') === '1') {
shell_exec('i3-msg \'workspace "3. MAIL"\'');
$command = 'export DISPLAY=:0; gnome-calendar';
pclose(popen($command, 'r'));
}
echo block(

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 }\' | cut -d/ -f1',
'ip address show %s | grep %s | awk \'{ print $2 }\' | cut -d/ -f1 | head -n 1',
escapeshellarg($iface),
escapeshellarg($inet)
);
@ -21,8 +21,11 @@ if (empty($ip)) {
$fullText = pspan($iface, '#ccc', '#222').pspan($ip, '#ddd', '#000');
if (getenv('BLOCK_BUTTON') === '1') {
shell_exec('export DISPLAY=:0; echo '.escapeshellarg($ip).' | xclip');
shell_exec('export DISPLAY=:0; echo '.escapeshellarg($ip).' | xclip --selection clip');
shell_exec('
export DISPLAY=:0
printf '.escapeshellarg($ip).' | xclip -sel clip
notify-send "Valeur copiée" '.escapeshellarg($ip).'
');
}
echo block(

View file

@ -4,22 +4,36 @@
require __DIR__.'/base/block.php';
$ipv6 = !empty($argv[1]);
$iface = 'wan';
$command = sprintf(
'dig +short myip.opendns.com @resolver1.opendns.com',
'dig +short %s myip.opendns.com @resolver1.opendns.com',
$ipv6 ? '-6' : null
);
$ip = trim(shell_exec($command));
if (empty($ip)) {
$command = sprintf(
'dig +short %s TXT o-o.myaddr.l.google.com @ns1.google.com',
$ipv6 ? '-6' : '-4'
);
$ip = trim(shell_exec($command));
$ip = trim($ip, '"');
}
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 clip');
shell_exec('
export DISPLAY=:0
printf '.escapeshellarg($ip).' | xclip -sel clip
notify-send "Valeur copiée" '.escapeshellarg($ip).'
');
}
$fullText = pspan($iface, '#ccc', '#222').pspan($ip, '#ddd', '#000');

View file

@ -32,7 +32,7 @@ if ($percent < $range1) {
}
if (getenv('BLOCK_BUTTON') === '1') {
$command = 'export DISPLAY=:0; pcmanfm '.escapeshellarg('file://'.$mountPoint).'&';
$command = 'export DISPLAY=:0; xdg-open '.escapeshellarg('file://'.$mountPoint).'&';
pclose(popen($command, 'r'));
}

View file

@ -3,8 +3,11 @@
require __DIR__.'/base/block.php';
$rss = $argv[1] ?? null;
$client = $argv[2] ?? null;
$blockName = $argv[1] ?? 'rss';
$rss = $argv[2] ?? null;
$client = $argv[3] ?? null;
$color1 = $argv[4] ?? color('normal');
$color2 = $argv[5] ?? color('info');
if (empty($rss)) {
die;
@ -16,23 +19,26 @@ if (empty($content)) {
die;
}
preg_match_all('/<entry/isU', $content, $matches, PREG_SET_ORDER);
preg_match_all('/<entry/isU', $content, $matches1, PREG_SET_ORDER);
preg_match_all('/<item/isU', $content, $matches2, PREG_SET_ORDER);
$title = pemoji(0xf09e);
$count = count($matches);
$count1 = count($matches1);
$count2 = count($matches2);
$count = $count1 ? $count1 : $count2;
if ($count > 0) {
$title .= ' +'.$count;
$title .= '+'.$count.' ';
}
$fullText = span($title, $count ? color('normal') : color('info'), '#333');
$fullText = span($title, $count ? $color1 : $color2, '#333');
if ($client && (int) getenv('BLOCK_BUTTON') === 1) {
shell_exec(sprintf('xdg-open %s', escapeshellarg($client)));
}
echo block(
'rss',
$blockName,
[
'full_text' => $fullText,
]

View file

@ -12,6 +12,7 @@ if (!in_array($status, ['Playing'])) {
function cleanUp($d, $max = 20)
{
$string = trim(str_replace(['"', "'"], ' ', $d));
$string = str_replace('&', 'et', $string);
if (mb_strlen($string) > $max) {
$string = substr($string, 0, $max).'…';

View file

@ -5,17 +5,18 @@ require __DIR__.'/base/block.php';
$format = $argv[1] ?? 'H:i:s';
$fullText = date($format);
$fullText = ' '.date($format);
if (getenv('BLOCK_BUTTON') === '1') {
shell_exec('i3-msg \'workspace "3. MAIL"\'');
$command = 'export DISPLAY=:0; gnome-calendar';
pclose(popen($command, 'r'));
}
if (date('H:i:s') === '13:37:00') {
shell_exec('notify-send "1337" "Powaaaa" --icon=/home/simon/Images/if_geek_zombie_60815.png');
}
$fullText = span(pemoji(0xf073).$fullText, color('date'), '#444');
$fullText = pspan(emoji(0xf073).$fullText, color('date'), '#444');
echo block(
'time',

View file

@ -1,16 +1,17 @@
#!/usr/bin/php7.1
#!/usr/bin/php7.3
<?php
require __DIR__.'/base/block.php';
$volume = shell_exec('amixer get Master | grep Mono:');
$volume = trim(shell_exec('/usr/bin/amixer get Master'));
if ($volume) {
preg_match('/\[([0-9%]+)\]/', $volume, $mach);
if (isset($mach[1])) {
$v = (int) str_replace('%', '', $mach[1]);
$fullText = ' '.$mach[1].' ';
if (!empty($volume)) {
preg_match('/\[([0-9%]+)\]/', $volume, $match);
if ($match[1]) {
$v = (int) str_replace('%', '', $match[1]);
$fullText = ' '.$match[1].' ';
if ($v === 0) {
$fullText.= emoji(0xf026);
@ -30,5 +31,7 @@ if ($volume) {
'separator_block_width' => 0,
]
);
die(0);
}
}