This commit is contained in:
Simon Vieille 2020-01-14 11:35:27 +01:00
parent 62966c2fce
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);
}
}

43
config
View File

@ -1,4 +1,5 @@
# @see: $ xmodmap
set $window Mod4
set $altleft Mod1
set $shift Shift
@ -35,11 +36,15 @@ workspace_auto_back_and_forth yes
# @see fc-list, fc-cache -f -v
font pango:Bitstream Vera Sans Mono, 9
#font pango:System San Francisco Display 8
#
# Use Mouse+$window to drag floating windows to their wanted position
floating_modifier $window
# I3-GAPS
# gaps inner 5
# smart_gaps on
# /I3-GAPS
# start a terminal
# bindsym $window+$enter exec i3-sensible-terminal
bindsym $window+$enter exec ~/bin/urxvt
@ -92,7 +97,7 @@ bindsym $window+$shift+$space floating toggle
bindsym $window+$space focus mode_toggle
# focus the parent container
bindsym $window+q focus parent
bindsym $window+a focus parent
bindsym $window+b workspace back_and_forth
@ -187,8 +192,13 @@ bindsym XF86Calculator exec qalculate
bindsym $window+l exec mlclipboard
bindsym $window+$shift+S exec i3-msg "sticky toggle"
for_window [title="SM-G950F"] floating enable
for_window [title="OTPClient"] floating enable
for_window [title="Syncthing-GTK"] floating enable
for_window [title="FLOAT"] floating enable
#for_window [title="sms-send"] floating enable
for_window [title="Deluge"] floating enable
for_window [title="VirtualBox"] floating enable
#for_window [title="VirtualBox"] floating enable
for_window [title="Thème du panel tint2"] floating enable
for_window [title="Gestionnaire de tâches"] floating enable
for_window [title="Liste des applications"] floating enable
@ -209,6 +219,7 @@ for_window [title="Gnuplot"] floating enable
for_window [title="Network Connect"] floating enable
for_window [title="Android Emulator"] floating enable
for_window [title="Guake"] floating enable
for_window [title="^Agenda$"] floating enable
for_window [title=".*"] border 1pixel
bar {
@ -224,9 +235,11 @@ bar {
background #000000
statusline #ffffff
#border bg text
focused_workspace #a74068 #bd4875 #ffffff
active_workspace #333333 #5f676a #ffffff
inactive_workspace #111111 #111111 #888888
# focused_workspace #a74068 #bd4875 #ffffff
# focused_workspace #05abba #07c0d4 #01282c
focused_workspace #333333 #333333 #07c0d4
active_workspace #5f676a #5f676a #ffffff
inactive_workspace #222222 #222222 #bababa
urgent_workspace #5aaad8 #6ac6ff #ffffff
}
}
@ -253,23 +266,31 @@ bar {
}
}
# exec sudo service alsa-utils stop && pulseaudio --start
#exec alsactl init -c 1
exec start-pulseaudio-x11
exec alsactl init
exec tint2
exec rofi -key-run 'SuperL+Alt+d' -Key-ssh 'SuperL+Alt+s' -key-window 'SuperL+Alt+w'
exec feh --bg-fill ~/wallpaper.jpg
exec setxkbmap fr oss
# exec xfce4-clipman
exec mpd
exec nextcloud
exec gpg-agent --daemon
exec wicd-gtk -t
exec alsactl init -c 1
exec volumeicon
exec ~/bin/sshplus.py
# exec volumeicon
exec pasystray
# exec ~/bin/sshplus.py
exec systemctl --user start xfce4-notifyd
exec sleep 3 && monitordisplay -s -m laptop
exec sleep 3 && monitordisplay -s -m hdmi
exec ~/bin/reload_wallpaper
exec redshift-gtk -l 47.51659:6.7809
exec blueman-applet
# exec blueman-applet
exec /home/simon/bin/remote_i3_server
exec flatpak run com.github.bajoja.indicator-kdeconnect/x86_64/stable
#exec flatpak run com.github.bajoja.indicator-kdeconnect/x86_64/stable
exec kdeconnect-indicator
exec flatpak run me.kozec.syncthingtk --minimized
exec xbacklight + 100
exec xdg-mime default pcmanfm.desktop inode/directory