diff --git a/bar/bar1.conf b/bar/bar1.conf
index 2be4051..1f0ece6 100644
--- a/bar/bar1.conf
+++ b/bar/bar1.conf
@@ -70,43 +70,11 @@ format=json
markup=pango
interval=3
-#[spotify_ctrl]
-#command=/home/simon/.i3/bar/src/spotify_ctrl.php
-#format=json
-#interval=1
-
-#[app_S]
-#command=/home/simon/.i3/bar/src/app.php S "i3-msg workspace '6. MEDIA'" '#1db954' 0
-#format=json
-#interval=1000
-
-[app_J]
-command=/home/simon/.i3/bar/src/app.php J "/home/simon/bin/joplin" '#057bdd' '#fff' 0
+[spotify_ctrl]
+command=/home/simon/.i3/bar/src/spotify_ctrl.php
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' 0
-format=json
-markup=pango
-interval=1000
-
-[app_F]
-command=/home/simon/.i3/bar/src/app.php F "xdg-open https://www.facebook.com/" '#598df3' '#fff' 1
-format=json
-markup=pango
-interval=1000
-
-#[app_C]
-#command=/home/simon/.i3/bar/src/app.php C "xdg-open https://choualbox.com/new" '#eeb819' 0
-#format=json
-#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=1000
+interval=1
[volume]
command=/home/simon/.i3/bar/src/volume.php
@@ -120,20 +88,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'
+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'
+format=json
+markup=pango
+interval=1000
+
[time]
-command=/home/simon/.i3/bar/src/time.php
+command=/home/simon/.i3/bar/src/time.php "H:i:s d/m/Y"
format=json
markup=pango
interval=1
-[date]
-command=/home/simon/.i3/bar/src/date.php
-format=json
-markup=pango
-interval=30
+#[date]
+#command=/home/simon/.i3/bar/src/date.php
+#format=json
+#markup=pango
+#interval=30
[rss]
-command=/home/simon/.i3/bar/src/rss.php "https://tiny.deblan.org/public.php?op=rss&id=-3&key=17c659af1ad27f30941a724fcf48421d1e83081a" "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/"
align=left
interval=30
format=json
diff --git a/bar/src/acpi.php b/bar/src/acpi.php
index ebdebc8..d872baa 100755
--- a/bar/src/acpi.php
+++ b/bar/src/acpi.php
@@ -16,28 +16,37 @@ if (!preg_match('`Discharging`', $acpi)) {
}
if ($charging < 20) {
- $color = color('critical');
+ $foreground = '#333';
+ $background = color('critical');
} elseif ($charging < 50) {
- $color = color('warning');
+ $foreground = color('info');
+ $background = color('warning');
} else {
- $color = color('normal');
+ $foreground = '#333';
+ $background = color('normal');
}
- $charging .= '%↑';
+ $charging .= '% '.emoji(0xf0aa);
+
+ $text = span(' '.$charging.' ', $foreground, $background);
$block = block(
'acpi',
[
- 'full_text' => $charging,
+ 'full_text' => $text,
'color' => $color,
+ 'separator' => false,
+ 'separator_block_width' => 0,
]
);
} else {
$block = block(
'acpi',
[
- 'full_text' => '??? ↑',
+ 'full_text' => '??? '.emoji(0xf0aa),
'color' => color('info'),
+ 'separator' => false,
+ 'separator_block_width' => 0,
]
);
}
@@ -45,22 +54,27 @@ if (!preg_match('`Discharging`', $acpi)) {
preg_match('`([0-9]+%), ([0-9]+:[0-9]+)`', $acpi, $values);
if ($values[0] < 20) {
- $color = color('critical');
+ $foreground = '#333';
+ $background = color('critical');
} elseif ($values[0] < 50) {
- $color = color('warning');
+ $foreground = color('info');
+ $background = color('warning');
} else {
- $color = color('info');
+ $foreground = '#333';
+ $background = color('normal');
}
- $charging = $values[1].'↓';
+ $charging = $values[1];
$times = str_replace(':', 'h', $values[2]);
- $text = implode(' ', [$charging, $times]);
+ $text = span(' '.implode(' ', [$charging, $times, emoji(0xf0ab)]).' ', $foreground, $background);
$block = block(
'acpi',
[
'full_text' => $text,
'color' => $color,
+ 'separator' => false,
+ 'separator_block_width' => 0,
]
);
}
diff --git a/bar/src/app.php b/bar/src/app.php
index 08a565e..24f5964 100755
--- a/bar/src/app.php
+++ b/bar/src/app.php
@@ -5,16 +5,13 @@ require __DIR__.'/base/block.php';
$name = $argv[1] ?? null;
$app = $argv[2] ?? null;
-$background = $argv[3];
-$foreground = $argv[4];
-$separator = (bool) ($argv[5] ?? true);
+$background = $argv[3] ?? '#333';
+$foreground = $argv[4] ?? '#fff';
if (empty($name) && empty($app)) {
die;
}
-$fullText = sprintf(' %s ', $name);
-
if (getenv('BLOCK_BUTTON') === '1') {
pclose(popen($app, 'r'));
}
@@ -22,10 +19,6 @@ if (getenv('BLOCK_BUTTON') === '1') {
echo block(
'app_'.$name,
[
- 'full_text' => span($fullText, $foreground, $background),
- //'separator' => $separator,
- //'separator_block_width' => $separator ? 20 : 0,
- 'separator' => false,
- 'separator_block_width' => 0,
+ 'full_text' => pspan($name, $foreground, $background),
]
);
diff --git a/bar/src/bandwidth.php b/bar/src/bandwidth.php
index 6f152d9..58b5c5a 100755
--- a/bar/src/bandwidth.php
+++ b/bar/src/bandwidth.php
@@ -1,4 +1,4 @@
-#!/usr/bin/php
+#!/usr/bin/php7.1
$fullText,
- 'color' => '#ffffff',
- 'urgent' => 1,
- 'separator' => false,
- 'separator_block_width' => 0,
]
);
diff --git a/bar/src/base/block.php b/bar/src/base/block.php
index 593f142..b697697 100644
--- a/bar/src/base/block.php
+++ b/bar/src/base/block.php
@@ -10,7 +10,7 @@
function color($label)
{
$colors = [
- 'music' => '#C3D4FF',
+ 'music' => '#cccccc',
'date' => '#E9F1FF',
'info' => '#E9F1FF',
'critical' => '#FF474A',
@@ -21,6 +21,40 @@ function color($label)
return $colors[$label] ?? $colors['info'];
}
+/**
+ * Create emoji with padding.
+ *
+ * @param mixed $char
+ */
+function pemoji($char)
+{
+ return ' '.IntlChar::chr($char).' ';
+}
+
+/**
+ * Create emoji.
+ *
+ * @param mixed $char
+ */
+function emoji($char)
+{
+ return ''.IntlChar::chr($char).'';
+}
+
+/**
+ * Creates span with padding.
+ *
+ * @param string $text
+ * @param string $foreground
+ * @param string $background
+ *
+ * @return string
+ */
+function pspan($text, $foreground = null, $background = null)
+{
+ return span(sprintf(' %s ', $text), $foreground, $background);
+}
+
/**
* Creates span.
*
@@ -56,8 +90,8 @@ function block(string $name, array $options = [])
'align' => 'left',
'name' => $name,
'urgent' => false,
- 'separator' => true,
- 'separator_block_width' => 20,
+ 'separator' => false,
+ 'separator_block_width' => 0,
],
$options
);
diff --git a/bar/src/date.php b/bar/src/date.php
index e0291be..732f842 100755
--- a/bar/src/date.php
+++ b/bar/src/date.php
@@ -1,11 +1,11 @@
-#!/usr/bin/php
+#!/usr/bin/php7.1
0) {
$title .= ' +'.$count;
}
-$fullText = span(' '.$title.' ', $count ? color('normal') : color('info'), '#333'); // sprintf('[%s] %s', $title, $count = count($matches));
+$fullText = span($title, $count ? color('normal') : color('info'), '#333');
-$blockButton = (int) getenv('BLOCK_BUTTON');
-
-if ($blockButton === 1) {
- shell_exec('xdg-open "https://tiny.deblan.org/index.php"');
+if ($client && (int) getenv('BLOCK_BUTTON') === 1) {
+ shell_exec(sprintf('xdg-open %s', escapeshellarg($client)));
}
echo block(
'rss',
[
'full_text' => $fullText,
- // 'color' => $count ? color('normal') : color('info'),
]
);
diff --git a/bar/src/screensaver.php b/bar/src/screensaver.php
index 2440c17..253c488 100755
--- a/bar/src/screensaver.php
+++ b/bar/src/screensaver.php
@@ -11,10 +11,8 @@ if (empty($output)) {
echo block(
'screensaver',
[
- 'full_text' => span(' • ', color('normal'), '#333'),//IntlChar::chr(0x1F5B5),
+ 'full_text' => pspan(emoji(0xf108), color('normal'), '#000'),
'color' => color('normal'),
- 'separator' => false,
- 'separator_block_width' => 0,
]
);
@@ -26,10 +24,8 @@ if (empty($output)) {
echo block(
'screensaver',
[
- 'full_text' => span(' • ', color('warning'), '#333'),//IntlChar::chr(0x1F5B5),
+ 'full_text' => pspan(emoji(0xf108), color('warning'), '#000'),
'color' => color('warning'),
- 'separator' => false,
- 'separator_block_width' => 0,
]
);
diff --git a/bar/src/spotify.php b/bar/src/spotify.php
index 27bbeea..d53d9bc 100755
--- a/bar/src/spotify.php
+++ b/bar/src/spotify.php
@@ -23,8 +23,7 @@ function cleanUp($d, $max = 20)
$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);
+$fullText = pspan($artist, '#ccc', '#222').pspan($title, '#ddd', '#000');
if (getenv('BLOCK_BUTTON') === '1') {
shell_exec('i3-msg \'workspace "6. MEDIA"\'');
@@ -35,5 +34,7 @@ echo block(
[
'full_text' => $fullText,
'color' => color('music'),
+ 'separator' => false,
+ 'separator_block_width' => 0,
]
);
diff --git a/bar/src/spotify_ctrl.php b/bar/src/spotify_ctrl.php
index 86b1d72..bd5fcf4 100755
--- a/bar/src/spotify_ctrl.php
+++ b/bar/src/spotify_ctrl.php
@@ -6,9 +6,9 @@ require __DIR__.'/base/block.php';
$status = trim(shell_exec('playerctl -p spotify status'));
if ($status === 'Playing') {
- $fullText = '▮▮';
+ $fullText = pemoji(0xf04c);
} elseif ($status === 'Paused') {
- $fullText = '▶';
+ $fullText = pemoji(0xf04b);
}
if (empty($fullText)) {
@@ -22,7 +22,7 @@ if (getenv('BLOCK_BUTTON') === '1') {
echo block(
'spotify_ctrl',
[
- 'full_text' => $fullText,
+ 'full_text' => span($fullText, '#ccc', '#000'),
'color' => color('music'),
]
);
diff --git a/bar/src/time.php b/bar/src/time.php
index e60bd30..27c3e0e 100755
--- a/bar/src/time.php
+++ b/bar/src/time.php
@@ -1,4 +1,4 @@
-#!/usr/bin/php
+#!/usr/bin/php7.1