From 17e09f4fd7dbeb938d82b8741b6a1b2d99785e10 Mon Sep 17 00:00:00 2001 From: Breizh Date: Sat, 13 Aug 2022 02:06:15 +0200 Subject: [PATCH] Nettoyage i3blocks --- .config/i3/config | 2 +- .i3blocks/mpd.new | 64 ----------------------------------------------- 2 files changed, 1 insertion(+), 65 deletions(-) delete mode 100755 .i3blocks/mpd.new diff --git a/.config/i3/config b/.config/i3/config index b487ff3..e1ab256 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -375,7 +375,7 @@ exec --no-startup-id sleep 5 && play "$HOME/Musique/WELCOME BACK.wav" # Start i3bar to display a workspace bar (plus the system information i3status if available) bar { # position top - status_command 2>/tmp/i3blocks.err i3blocks + status_command i3blocks ## please set your primary output first. Example: 'xrandr --output eDP1 --primary' tray_output primary diff --git a/.i3blocks/mpd.new b/.i3blocks/mpd.new deleted file mode 100755 index b78f21e..0000000 --- a/.i3blocks/mpd.new +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash - -LENGHT=40 - -human_time() { - # Prends des secondes - local seconds="$1" - - if [[ "$seconds" -lt 0 ]] - then - # Négatif = pas de temps à afficher - echo "--:--" - return - fi - - # Calcule les minutes - local minutes=$(( $seconds / 60 )) - seconds=$(( $seconds % 60 )) - - # Calcule les heures - local hours=$(( $minutes / 60 )) - minutes=$(( $minutes % 60 )) - - if [[ "$hours" -ge 1 ]] - then - # Si on dépasse l’heure affiche le temps en heures-minutes - printf "%02dh%02d\n" "$hours" "$minutes" - else - # Sinon en minutes-secondes - printf "%02d:%02d\n" "$minutes" "$seconds" - fi - return -} - -# Boucle principale -while true -do - # Déclaration des variables - declare status - - # État du serveur - if ! systemctl --user is-active mpd.service &>/dev/null - then - # Traitement particulier pour le cas où le service est coupé - status="off" - else - status="$(mpc status | sed -n '2p' | grep -Eo '^\[.*\]' | tr -d '[]')" - [[ -z status ]] && status="stopped" - fi - - artist="$(mpc -f '%artist%' current)" - title="$(mpc -f '%title%' current)" - name="$(mpc -f '%name%' current)" - file="$(basename "$(mpc -f '%file%' current)")" - album="$(mpc -f '%album%' current)" - - [[ -n "$artist" ]] && artist+=" " - - ( zscroll -n false -b "$(tput bold)$artist$(tput sgr0)" "${title:-${file}}" ) & - pid="$!" - - mpc idle &>/dev/null - kill "$pid" -done