From fcc31cdba8ea5dc37168b95108001ffb2bd490bb Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Tue, 14 Jan 2020 11:35:27 +0100 Subject: [PATCH] conf --- bar/bar1.conf | 53 ++++++++++++++++++++--------------- bar/src/app.php | 11 ++++---- bar/src/bandwidth.php | 6 ++-- bar/src/base/block.php | 2 +- bar/src/date.php | 5 ++-- bar/src/ip.php | 9 ++++-- bar/src/ip_wan.php | 20 +++++++++++-- bar/src/mount_point_space.php | 2 +- bar/src/rss.php | 20 ++++++++----- bar/src/spotify.php | 1 + bar/src/time.php | 7 +++-- bar/src/volume.php | 17 ++++++----- config | 43 ++++++++++++++++++++-------- 13 files changed, 127 insertions(+), 69 deletions(-) diff --git a/bar/bar1.conf b/bar/bar1.conf index 1f0ece6..561f971 100644 --- a/bar/bar1.conf +++ b/bar/bar1.conf @@ -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 diff --git a/bar/src/app.php b/bar/src/app.php index 24f5964..017cb65 100755 --- a/bar/src/app.php +++ b/bar/src/app.php @@ -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), ] diff --git a/bar/src/bandwidth.php b/bar/src/bandwidth.php index 58b5c5a..f8fea2d 100755 --- a/bar/src/bandwidth.php +++ b/bar/src/bandwidth.php @@ -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, diff --git a/bar/src/base/block.php b/bar/src/base/block.php index b697697..acd4432 100644 --- a/bar/src/base/block.php +++ b/bar/src/base/block.php @@ -28,7 +28,7 @@ function color($label) */ function pemoji($char) { - return ' '.IntlChar::chr($char).' '; + return ' '.IntlChar::chr($char).' '; } /** diff --git a/bar/src/date.php b/bar/src/date.php index 732f842..ba23b97 100755 --- a/bar/src/date.php +++ b/bar/src/date.php @@ -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( diff --git a/bar/src/ip.php b/bar/src/ip.php index 859430d..8cd1f78 100755 --- a/bar/src/ip.php +++ b/bar/src/ip.php @@ -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( diff --git a/bar/src/ip_wan.php b/bar/src/ip_wan.php index 192a38a..50c6948 100755 --- a/bar/src/ip_wan.php +++ b/bar/src/ip_wan.php @@ -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'); diff --git a/bar/src/mount_point_space.php b/bar/src/mount_point_space.php index b0a3805..c6384f3 100755 --- a/bar/src/mount_point_space.php +++ b/bar/src/mount_point_space.php @@ -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')); } diff --git a/bar/src/rss.php b/bar/src/rss.php index 9365936..5bef8ad 100755 --- a/bar/src/rss.php +++ b/bar/src/rss.php @@ -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('/ 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, ] diff --git a/bar/src/spotify.php b/bar/src/spotify.php index d53d9bc..e9c1df5 100755 --- a/bar/src/spotify.php +++ b/bar/src/spotify.php @@ -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).'…'; diff --git a/bar/src/time.php b/bar/src/time.php index 27c3e0e..f23d496 100755 --- a/bar/src/time.php +++ b/bar/src/time.php @@ -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', diff --git a/bar/src/volume.php b/bar/src/volume.php index c277b22..3bd2d78 100755 --- a/bar/src/volume.php +++ b/bar/src/volume.php @@ -1,16 +1,17 @@ -#!/usr/bin/php7.1 +#!/usr/bin/php7.3 0, ] ); + + die(0); } } diff --git a/config b/config index 99cf0b6..d2df55e 100644 --- a/config +++ b/config @@ -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