This commit is contained in:
Simon Vieille 2022-09-26 12:11:24 +02:00
parent 504cf2f5d7
commit dcae666656
Signed by: deblan
GPG Key ID: 579388D585F70417
13 changed files with 190 additions and 207 deletions

View File

@ -34,86 +34,98 @@
#markup=pango
#interval=1
[ip_wg0_inet]
command=/home/simon/.i3/bar/src/ip.php wg0 inet wg0
[ip_wg0_ip4]
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/ip -iface=wg0 -version=ip4 -name=wg0
format=json
markup=pango
interval=10
interval=3
[ip_wg1_inet]
command=/home/simon/.i3/bar/src/ip.php wg1 inet wg1
[ip_wg1_ip4]
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/ip -iface=wg1 -version=ip4 -name=wg1
format=json
markup=pango
interval=10
interval=3
[ip_eth0_inet]
command=/home/simon/.i3/bar/src/ip.php eth0 inet eth
[ip_wg2_ip4]
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/ip -iface=wg2 -version=ip4 -name=wg2
format=json
markup=pango
interval=10
interval=3
[ip_enx00e04cf69b06_inet]
command=/home/simon/.i3/bar/src/ip.php enx00e04cf69b06 inet eth
[ip_eth0_ip4]
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/ip -iface=eth0 -version=ip4 -name=eth
format=json
markup=pango
interval=10
interval=3
[ip_enx00e04c68022c_inet]
command=/home/simon/.i3/bar/src/ip.php enx00e04c68022c inet eth
[ip_enx00e04cf69b06_ip4]
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/ip -iface=enx00e04cf69b06 -version=ip4 -name=eth
format=json
markup=pango
interval=10
interval=3
[ip_wlp59s0_inet]
command=/home/simon/.i3/bar/src/ip.php wlp59s0 inet wifi
[ip_enx00e04c68022c_ip4]
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/ip -iface=enx00e04c68022c -version=ip4 -name=eth
format=json
markup=pango
interval=10
interval=3
[ip_bnep0_ip4]
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/ip -iface=bnep0 -version=ip4 -name=bth
format=json
markup=pango
interval=3
[ip_wlp59s0_ip4]
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/ip -iface=wlp59s0 -version=ip4 -name=wifi
format=json
markup=pango
interval=3
[ip_wan]
command=/home/simon/.i3/bar/src/ip_wan.php
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/ip_wan
format=json
markup=pango
interval=100
[wireguard_wg0]
command=/home/simon/.i3/bar/src/wireguard.php wg0 wg0
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/wireguard -iface=wg0 -name=DEBLAN
format=json
markup=pango
interval=1
interval=2
[wireguard_wg1]
command=/home/simon/.i3/bar/src/wireguard.php wg1 wg1
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/wireguard -iface=wg1 -name=OVH
format=json
markup=pango
interval=1
interval=2
[mount_point_space_root]
command=/home/simon/.i3/bar/src/mount_point_space.php root /
format=json
markup=pango
interval=5
# [wireguard_wg2]
# command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/wireguard -iface=wg2 -name=VPN01
# format=json
# markup=pango
# interval=2
[mount_point_space_home]
command=/home/simon/.i3/bar/src/mount_point_space.php home /home 90 95
[app_wg0edit]
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/app -block=app_wg0edit -name="<span font='FontAwesome'>$(bash -c 'echo -e "\uf044"')</span>" -bg-color='#505050' -fg-color='#cccccc' -cmd="sudo /home/simon/bin/wireguard-gui"
format=json
markup=pango
interval=5
interval=1000
[spotify]
command=/home/simon/.i3/bar/src/spotify.php
[du_root]
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/du -block=du_root -mount-point=/ -name=/ -limit-warning=70 -limit-danger=90
format=json
markup=pango
interval=3
interval=30
[spotify_ctrl]
command=/home/simon/.i3/bar/src/spotify_ctrl.php
[du_home]
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/du -block=du_home -mount-point=/home -name=/home -limit-warning=90 -limit-danger=95
format=json
markup=pango
interval=1
interval=30
[volume]
command=/home/simon/.i3/bar/src/volume.php
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/volume -channel=Master
format=json
markup=pango
interval=1
@ -124,79 +136,55 @@ format=json
markup=pango
interval=3
[screensaver]
command=/home/simon/.i3/bar/src/screensaver.php
format=json
markup=pango
interval=3
#[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_otp]
command=/home/simon/.i3/bar/src/app.php app_otp "🔐" "/home/simon/bin/otpclient" '#363636' '#ffc337'
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/app -block=app_otp -name=🔐 -bg-color='#363636' -fg-color='#ffc337' -cmd="/home/simon/bin/otpclient"
format=json
markup=pango
interval=1000
[app_flameshot]
command=/home/simon/.i3/bar/src/app.php app_flameshot "F" "/usr/bin/flameshot gui --delay 500" '#bf007e' '#fff'
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/app -block=app_flameshot -name=F -bg-color='#bf007e' -fg-color='#fff' -cmd="/usr/bin/flameshot gui --delay 500"
format=json
markup=pango
interval=1000
[app_ksnip]
command=/home/simon/.i3/bar/src/app.php app_ksnip "K" "/usr/bin/ksnip" '#a460ef' '#fff'
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/app -block=app_ksnip -name=K -bg-color='#a460ef' -fg-color='#fff' -cmd=/usr/bin/ksnip
format=json
markup=pango
interval=1000
[app_cloud]
command=/home/simon/.i3/bar/src/app.php app_cloud C "xdg-open https://deblan.cloud/" '#3c4e74' '#fff'
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/app -block=app_cloud -name=C -bg-color='#3c4e74' -fg-color='#fff' -cmd="xdg-open https://deblan.cloud/"
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'
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/app -block=app_youtube -name=Y -bg-color='#c74a42' -fg-color='#fff' -cmd="xdg-open https://www.youtube.com/feed/subscriptions"
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
[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/"
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/rss -block=rss_tts -feed="https://tiny.deblan.org/public.php?op=rss&id=-3&key=17c659af1ad27f30941a724fcf48421d1e83081a" -website="https://tiny.deblan.org/" -empty-color="#CCCCCC" -non-empty-color="#B3FF6C"
align=left
interval=30
format=json
markup=pango
[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"
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/rss -block=rss_wallabag -feed="https://wallabag.deblan.org/simon/AMHCUowxsRPdNiz/unread.xml" -website="https://wallabag.deblan.org/" -empty-color="#aabfc1" -non-empty-color="#00d8f0"
align=left
interval=30
format=json
markup=pango
[time]
command=/home/simon/.i3/bar/src/time.php "H:i:s d/m/Y"
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/date -format="%H:%M:%S %d/%m/%Y"
format=json
markup=pango
interval=1
interval=persist
[acpi]
command=/home/simon/.i3/bar/src/acpi.php

View File

@ -1,135 +1,32 @@
[bandwidth_eth0]
command=/home/simon/.i3/bar/src/bandwidth.php eth0 inet eth
[meteo]
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/weather -loc=Besançon
format=json
markup=pango
interval=5
interval=3600
[bandwidth_wg0]
command=/home/simon/.i3/bar/src/bandwidth.php wg0
[spotify]
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/spotify
format=json
markup=pango
interval=5
interval=3
[bandwidth_wg1]
command=/home/simon/.i3/bar/src/bandwidth.php wg1
[ps_backup]
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/ps -process=backup-bin/cron -message="💾 Backup en cours"
format=json
markup=pango
interval=5
interval=3
[bandwidth_enx00e04cf69b06]
command=/home/simon/.i3/bar/src/bandwidth.php enx00e04cf69b06 inet eth
format=json
markup=pango
interval=5
[bandwidth_enx00e04c68022c]
command=/home/simon/.i3/bar/src/bandwidth.php enx00e04c68022c inet eth
format=json
markup=pango
interval=5
[bandwidth_wlp59s0]
command=/home/simon/.i3/bar/src/bandwidth.php wlp59s0 inet wifi
[workspace_apps]
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/workspace_apps -x=$relative_x
format=json
markup=pango
interval=1
[workspace_apps_0]
command=/home/simon/.i3/bar/src/workspace_apps.php 0 $BLOCK_BUTTON
[3dprinter_tel]
command=/home/simon/www/repo/i3-blocks-go/build/linux-amd64/prusa_telemetry -api=http://192.168.0.41/api/telemetry
format=json
markup=pango
interval=1
align=left
[workspace_apps_1]
command=/home/simon/.i3/bar/src/workspace_apps.php 1 $BLOCK_BUTTON
format=json
markup=pango
interval=1
align=left
[workspace_apps_2]
command=/home/simon/.i3/bar/src/workspace_apps.php 2 $BLOCK_BUTTON
format=json
markup=pango
interval=1
align=left
[workspace_apps_3]
command=/home/simon/.i3/bar/src/workspace_apps.php 3 $BLOCK_BUTTON
format=json
markup=pango
interval=1
align=left
[workspace_apps_4]
command=/home/simon/.i3/bar/src/workspace_apps.php 4 $BLOCK_BUTTON
format=json
markup=pango
interval=1
align=left
[workspace_apps_5]
command=/home/simon/.i3/bar/src/workspace_apps.php 5 $BLOCK_BUTTON
format=json
markup=pango
interval=1
align=left
[workspace_apps_6]
command=/home/simon/.i3/bar/src/workspace_apps.php 6 $BLOCK_BUTTON
format=json
markup=pango
interval=1
align=left
[workspace_apps_7]
command=/home/simon/.i3/bar/src/workspace_apps.php 7 $BLOCK_BUTTON
format=json
markup=pango
interval=1
align=left
[workspace_apps_8]
command=/home/simon/.i3/bar/src/workspace_apps.php 8 $BLOCK_BUTTON
format=json
markup=pango
interval=1
align=left
[workspace_apps_9]
command=/home/simon/.i3/bar/src/workspace_apps.php 9 $BLOCK_BUTTON
format=json
markup=pango
interval=1
align=left
[workspace_apps_10]
command=/home/simon/.i3/bar/src/workspace_apps.php 10 $BLOCK_BUTTON
format=json
markup=pango
interval=1
align=left
[workspace_apps_11]
command=/home/simon/.i3/bar/src/workspace_apps.php 11 $BLOCK_BUTTON
format=json
markup=pango
interval=1
align=left
[workspace_apps_12]
command=/home/simon/.i3/bar/src/workspace_apps.php 12 $BLOCK_BUTTON
format=json
markup=pango
interval=1
align=left
#[meteo]
#command=/home/simon/.i3/bar/src/meteo.php
#format=json
#markup=pango
#interval=3600
interval=10
[app_system]
command=/home/simon/.i3/bar/src/app.php app_system "Système" /home/simon/bin/poweroption '#000' '#fff'

BIN
bar/core Normal file

Binary file not shown.

27
bar/src/3dprinter.php Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env php
<?php
require __DIR__.'/base/block.php';
$blockName = $argv[1];
$telemetry = $argv[2];
$content = json_decode(@file_get_contents($telemetry), true);
if (empty($content)) {
die;
}
$fullText =
span(sprintf(' %d%%', $content['progress']), '#6bffa6', '#333')
.span(sprintf(' %d°', $content['temp_nozzle']), '#ff946a', '#333')
.span(sprintf(' %d°', $content['temp_bed']), '#66caff', '#333')
.span(sprintf(' %s ', date('H:i', $content['time_est'] + time())), '#d5d5d5', '#333')
;
echo block(
$blockName,
[
'full_text' => $fullText,
]
);

View File

@ -10,7 +10,7 @@
function color($label)
{
$colors = [
'music' => '#cccccc',
'music' => '#CCCCCC',
'date' => '#E9F1FF',
'info' => '#E9F1FF',
'critical' => '#FF474A',

View File

@ -0,0 +1,6 @@
#!/usr/bin/env php
<?php
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
$value = $redis->set('i3_get_workspaces', shell_exec('i3-msg -t get_workspaces'));

View File

@ -15,7 +15,7 @@ if (file_exists($pidFile)) {
}
putenv('DISPLAY=:0');
putenv('REMOTE_I3WM_WS_OPTIONS=-v -vvv');
putenv('SERVER_OPTIONS=-v -m');
$commandSuffix = ' >> /home/simon/remote_i3.log 2>>/home/simon/remote_i3.log';
@ -26,7 +26,7 @@ if (!$isAlive) {
echo block(
'i3remote',
[
'full_text' => lpspan(emoji(0xf245), '#cccccc', '#000'),
'full_text' => rpspan(emoji(0xf245), '#cccccc', '#000'),
'color' => '#cccccc',
]
);
@ -38,7 +38,7 @@ if (!$isAlive) {
echo block(
'i3remote',
[
'full_text' => lpspan(emoji(0xf245), color('warning'), '#000'),
'full_text' => rpspan(emoji(0xf245), color('warning'), '#000'),
'color' => color('warning'),
]
);

View File

@ -3,7 +3,7 @@
require __DIR__.'/base/block.php';
$url = 'https://fr.wttr.in/?format=%l+%c+%t+%m';
$url = 'https://fr.wttr.in/'.($argv[1] ?? '').'?format=%l+%c+%t+%m';
$command = sprintf('curl %s', escapeshellarg($url));
$output = trim(shell_exec($command));
@ -23,7 +23,7 @@ if (!empty($output)) {
echo block(
'meteo',
[
'full_text' => pspan($output, '#fff'),
'full_text' => pspan(preg_replace("/\s{2,}/", ' ', $output), '#fff'),
]
);
} catch(\Exception $e) {

22
bar/src/ps.php Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env php
<?php
require __DIR__.'/base/block.php';
$processus = $argv[1];
$label = $argv[2];
$count = count(explode("\n", trim(shell_exec(sprintf('pgrep -f %s', escapeshellarg($processus)))))) - 3;
if ($count < 1) {
return;
}
$fullText = span(sprintf(' %s ', $label));
echo block(
'ps',
[
'full_text' => $fullText,
]
);

View File

@ -13,7 +13,7 @@ if (empty($output)) {
echo block(
'wireguard_'.$iface,
[
'full_text' => pspan($name, color('warning'), '#000'),
'full_text' => pspan($name, '#ccc', '#222'),
'color' => color('warning'),
]
);
@ -26,7 +26,7 @@ if (empty($output)) {
echo block(
'wireguard_'.$iface,
[
'full_text' => pspan($name, color('normal'), '#000'),
'full_text' => pspan($name, '#333', color('normal')),
'color' => color('normal'),
]
);

View File

@ -1,16 +1,18 @@
#!/usr/bin/env php
<?php
$windowKey = $argv[1];
$blockButton = $argv[2];
$windowKey = $argv[1] ?? null;
$blockButton = $argv[2] ?? null;
require __DIR__.'/base/block.php';
function getWorkspaces(): array
{
$output = shell_exec('i3-msg -t get_workspaces');
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
$value = (array) json_decode($redis->get('i3_get_workspaces'), true);
return json_decode($output, true);
return $value;
}
function getVisibleWorkspaces(): array

25
bin/i3_promote_window.py Executable file
View File

@ -0,0 +1,25 @@
#!/usr/bin/env python3
#
# Promotes the focused window by swapping it with the largest window.
from i3ipc import Connection, Event
def find_biggest_window (container):
max_leaf = None
max_area = 0
for leaf in container.leaves():
rect = leaf.rect
area = rect.width * rect.height
if not leaf.focused and area > max_area:
max_area = area
max_leaf = leaf
return max_leaf
i3 = Connection()
for reply in i3.get_workspaces():
if reply.focused:
workspace = i3.get_tree().find_by_id(reply.ipc_data["id"])
master = find_biggest_window(workspace)
i3.command("swap container with con_id %s" % master.id)

30
config
View File

@ -26,9 +26,9 @@ set $wp3 "3. MAIL"
set $wp4 "4. IM"
set $wp5 "5"
set $wp6 "6. MEDIA"
set $wp7 "7. WORK"
set $wp8 "8"
set $wp9 "9"
set $wp7 "7. DEV"
set $wp8 "8. DEV"
set $wp9 "9. DEV"
set $wp10 "10"
set $wp11 "11"
set $wp12 "12"
@ -208,11 +208,15 @@ bindsym XF86Calculator exec qalculate
bindsym $window+l exec mlclipboard
bindsym $window+$shift+S exec i3-msg "sticky toggle"
#bindsym $window+$shift+p exec --no-startup-id ~/.i3/bin/promote-window.py
for_window [class=".*Steam.*"] floating enable
for_window [class=".*gnome-weather.*"] floating enable
for_window [title="CSSH "] floating enable
for_window [title="X2Go"] floating enable
for_window [title="florence"] floating enable
for_window [title="Yakuake"] floating enable
for_window [title="SM-G950F"] floating enable
for_window [title="OTPClient"] floating enable
for_window [title="Syncthing-GTK"] floating enable
@ -241,6 +245,7 @@ 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="^Wireguard GUI$"] floating enable
for_window [title=".*"] border 1pixel
bar {
@ -249,6 +254,7 @@ bar {
tray_output primary
output DP1
output DP3
output HDMI1
output eDP-1
output eDP1
@ -273,6 +279,7 @@ bar {
tray_output none
output DP1
output DP3
output HDMI1
output eDP-1
output eDP1
@ -317,14 +324,17 @@ exec ~/bin/pulseaudio-start
exec ~/bin/reload_wallpaper
exec ~/bin/remote_i3_server
exec ~/bin/picom-desk
exec ~/make/with-ex-editor
exec rofi -key-run 'SuperL+Alt+d' -Key-ssh 'SuperL+Alt+s' -key-window 'SuperL+Alt+w'
exec rm ~/.cache/dmenu_run
# exec ~/make/with-ex-editor
# exec rofi -key-run 'SuperL+Alt+d' -Key-ssh 'SuperL+Alt+s' -key-window 'SuperL+Alt+w'
# exec flatpak run me.kozec.syncthingtk --minimized
exec syncthing-gtk -m
exec feh --bg-fill ~/wallpaper.jpg
exec setxkbmap fr oss
exec mpd
exec nextcloud
exec gpg-agent --daemon
exec wicd-gtk -t
exec nm-applet
exec blueman-applet
exec systemctl --user start xfce4-notifyd
exec sleep 3 && monitordisplay -s -m laptop
@ -332,10 +342,15 @@ exec sleep 3 && monitordisplay -s -m hdmi
exec redshift-gtk -t 5500:3500 -m randr -l 47.51659:6.7809
exec xfce4-power-manager
exec kdeconnect-indicator
exec flatpak run me.kozec.syncthingtk --minimized
exec xbacklight + 100
exec ~/bin/joplin
exec xdg-mime default pcmanfm.desktop inode/directory
exec xdg-mime default pcmanfm.desktop inode/mount-point
#exec xdg-mime default firefox.desktop x-scheme-handler/https
exec xdg-mime default org.pwmt.zathura application/pdf
exec sudo /usr/local/bin/powertop-tuning
exec yakuake
#exec espanso service start --unmanaged
# exec sudo service alsa-utils stop && pulseaudio --start
# exec alsactl init -c 1
@ -352,3 +367,4 @@ exec sudo /usr/local/bin/powertop-tuning
# exec flatpak run com.github.bajoja.indicator-kdeconnect/x86_64/stable
# exec compton
# exec ~/make/picom/build/src/picom -c -b