Nettoyage i3blocks
This commit is contained in:
parent
c94c6691eb
commit
af29cc2814
2 changed files with 1 additions and 65 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
Loading…
Reference in a new issue