Nettoyage i3blocks

This commit is contained in:
Breizh 2022-08-13 02:06:15 +02:00
parent 6fd25ec5e0
commit 17e09f4fd7
2 changed files with 1 additions and 65 deletions

View file

@ -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) # Start i3bar to display a workspace bar (plus the system information i3status if available)
bar { bar {
# position top # position top
status_command 2>/tmp/i3blocks.err i3blocks status_command i3blocks
## please set your primary output first. Example: 'xrandr --output eDP1 --primary' ## please set your primary output first. Example: 'xrandr --output eDP1 --primary'
tray_output primary tray_output primary

View file

@ -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 lheure 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