Click handlers
This commit is contained in:
parent
a149460074
commit
e98c632fb0
|
@ -21,40 +21,43 @@ command=/home/simon/.i3/bar/src/ip.php eth0
|
|||
format=json
|
||||
interval=10
|
||||
|
||||
[inet_eth0]
|
||||
[ip_eth0_inet]
|
||||
command=/home/simon/.i3/bar/src/ip.php eth0
|
||||
format=json
|
||||
interval=10
|
||||
|
||||
[inet_eth1]
|
||||
[ip_eth1_inet]
|
||||
command=/home/simon/.i3/bar/src/ip.php eth1
|
||||
format=json
|
||||
interval=10
|
||||
|
||||
[inet_wlan0]
|
||||
[ip_wlan0_inet]
|
||||
command=/home/simon/.i3/bar/src/ip.php wlan0
|
||||
format=json
|
||||
interval=10
|
||||
min_width=button=1
|
||||
|
||||
[inet_easytether0]
|
||||
[ip_easytether0_inet]
|
||||
command=/home/simon/.i3/bar/src/ip.php easytether0
|
||||
format=json
|
||||
interval=100
|
||||
|
||||
[inet_wan]
|
||||
[ip_wan]
|
||||
command=/home/simon/.i3/bar/src/ip_wan.php
|
||||
format=json
|
||||
interval=100
|
||||
|
||||
[mount_point_space_root]
|
||||
command=/home/simon/.i3/bar/src/mount_point_space.php /
|
||||
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 90 95
|
||||
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,6 +66,7 @@ command=memory
|
|||
command=/home/simon/.i3/bar/src/spotify.php
|
||||
format=json
|
||||
interval=1
|
||||
min_width=button=1
|
||||
|
||||
[volume]
|
||||
command=/home/simon/.i3/bar/src/volume.php
|
||||
|
|
|
@ -7,8 +7,12 @@ $format = $argv[1] ?? 'd/m/Y';
|
|||
|
||||
$fullText = date($format);
|
||||
|
||||
if (getenv('BLOCK_BUTTON') === '1') {
|
||||
shell_exec('i3-msg \'workspace "3. MAIL"\'');
|
||||
}
|
||||
|
||||
echo block(
|
||||
'date_'.$format,
|
||||
'date',
|
||||
[
|
||||
'full_text' => $fullText,
|
||||
'color' => color('date'),
|
||||
|
|
|
@ -21,8 +21,12 @@ if (empty($ip)) {
|
|||
$fullText = sprintf('[%s] %s', $iface, $ip);
|
||||
$shortText = sprintf('%s: %s', $iface, $ip);
|
||||
|
||||
if (getenv('BLOCK_BUTTON') === '1') {
|
||||
shell_exec('echo "'.escapeshellarg($ip).'" | xclip');
|
||||
}
|
||||
|
||||
echo block(
|
||||
'ip_'.$iface.'_'.$inet,
|
||||
'ip_'.$iface.'_'.trim($inet),
|
||||
[
|
||||
'full_text' => $fullText,
|
||||
'short_text' => $shortText,
|
||||
|
|
|
@ -21,7 +21,7 @@ $fullText = sprintf('[%s] %s', $iface, $ip);
|
|||
$shortText = sprintf('%s: %s', $iface, $ip);
|
||||
|
||||
echo block(
|
||||
'ip_'.$iface,
|
||||
'ip_wan',
|
||||
[
|
||||
'full_text' => $fullText,
|
||||
'short_text' => $shortText,
|
||||
|
|
|
@ -3,9 +3,10 @@
|
|||
|
||||
require __DIR__.'/base/block.php';
|
||||
|
||||
$mountPoint = $argv[1] ?? '/';
|
||||
$range1 = $argv[2] ?? 70;
|
||||
$range2 = $argv[3] ?? 90;
|
||||
$name = $argv[1] ?? 'root';
|
||||
$mountPoint = $argv[2] ?? '/';
|
||||
$range1 = $argv[3] ?? 70;
|
||||
$range2 = $argv[4] ?? 90;
|
||||
|
||||
$command = sprintf(
|
||||
'df -h %s | tail -n 1',
|
||||
|
@ -33,8 +34,13 @@ if ($percent < $range1) {
|
|||
$fullText = sprintf('[%s] %s%%', $mountPoint, $percent);
|
||||
$shortText = sprintf('%s: %s%%', $mountPoint, $percent);
|
||||
|
||||
if (getenv('BLOCK_BUTTON') === '1') {
|
||||
$command = 'export DISPLAY=:0; pcmanfm '.escapeshellarg('file://'.$mountPoint).'&';
|
||||
pclose(popen($command, 'r'));
|
||||
}
|
||||
|
||||
echo block(
|
||||
'mount_point_space_'.$mountPoint,
|
||||
'mount_point_space_'.$name,
|
||||
[
|
||||
'full_text' => $fullText,
|
||||
'short_text' => $shortText,
|
||||
|
|
|
@ -9,12 +9,12 @@ if (!in_array($status, ['Playing'])) {
|
|||
die;
|
||||
}
|
||||
|
||||
function cleanUp($d)
|
||||
function cleanUp($d, $max = 30)
|
||||
{
|
||||
$string = trim(str_replace(['"', "'"], ' ', $d));
|
||||
|
||||
if (mb_strlen($string) > 15) {
|
||||
$string = substr($string, 0, 15).'…';
|
||||
if (mb_strlen($string) > $max) {
|
||||
$string = substr($string, 0, $max).'…';
|
||||
}
|
||||
|
||||
return $string;
|
||||
|
@ -24,9 +24,12 @@ $title = cleanUp(shell_exec('playerctl -p spotify metadata xesam:title'));
|
|||
$artist = cleanUp(shell_exec('playerctl -p spotify metadata xesam:artist'));
|
||||
|
||||
$label = sprintf('%s – %s', $title, $artist);
|
||||
|
||||
$fullText = sprintf('%s – %s', $title, $artist);
|
||||
|
||||
if (getenv('BLOCK_BUTTON') === '1') {
|
||||
shell_exec('i3-msg \'workspace "6. MEDIA"\'');
|
||||
}
|
||||
|
||||
echo block(
|
||||
'spotify',
|
||||
[
|
||||
|
|
|
@ -7,8 +7,12 @@ $format = $argv[1] ?? 'H:i:s';
|
|||
|
||||
$fullText = date($format);
|
||||
|
||||
if (getenv('BLOCK_BUTTON') === '1') {
|
||||
shell_exec('i3-msg \'workspace "3. MAIL"\'');
|
||||
}
|
||||
|
||||
echo block(
|
||||
'time_'.$format,
|
||||
'time',
|
||||
[
|
||||
'full_text' => $fullText,
|
||||
'color' => color('date'),
|
||||
|
|
Loading…
Reference in a new issue