diff --git a/.config/i3/config b/.config/i3/config
index 58a5b64..bc73f4f 100644
--- a/.config/i3/config
+++ b/.config/i3/config
@@ -108,10 +108,10 @@ bindsym XF86AudioMute exec --no-startup-id BLOCK_BUTTON=2 ${HOME}/.i3blocks/volu
bindsym XF86AudioMicMute exec --no-startup-id BLOCK_BUTTON=2 BLOCK_INSTANCE=Capture ${HOME}/.i3blocks/volume && pkill -RTMIN+10 i3blocks
# Media controls
-bindsym XF86AudioNext exec --no-startup-id mocp -f
-bindsym XF86AudioPrev exec --no-startup-id mocp -r
-bindsym XF86AudioPlay exec --no-startup-id mocp -G
-bindsym XF86AudioStop exec --no-startup-id mocp -s
+bindsym XF86AudioNext exec --no-startup-id mpc next
+bindsym XF86AudioPrev exec --no-startup-id mpc prev
+bindsym XF86AudioPlay exec --no-startup-id mpc toggle
+bindsym XF86AudioStop exec --no-startup-id mocp stop
# LEDs controls
diff --git a/.i3blocks.conf b/.i3blocks.conf
index 616c6eb..3f680ab 100644
--- a/.i3blocks.conf
+++ b/.i3blocks.conf
@@ -38,14 +38,12 @@ markup=pango
# see the script for details.
[cpu_usage]
#label=
-label=cpu
interval=1
#min_width= 99.99%
#separator=false
[load_average]
#label=
-label=load
interval=5
# Temperature
@@ -53,32 +51,32 @@ interval=5
# Support multiple chips, though lm-sensors.
# The script may be called with -w and -c switches to specify thresholds,
# see the script for details.
-[temperature]
-#label=
-label=cpu
-instance=coretemp-isa-0000
-interval=3
-separator=false
-
-[temperature]
-label=gpu
-instance=radeon-pci-0300
-interval=3
+#[temperature]
+##label=
+#label=cpu
+#instance=coretemp-isa-0000
+#interval=3
+#separator=false
+#
+#[temperature]
+#label=gpu
+#instance=radeon-pci-0300
+#interval=3
# Memory usage
#
# The type defaults to "mem" if the instance is not specified.
[memory]
label=ram
-separator=false
+#separator=false
interval=2
#min_width=RAM 99.99%
-[memory]
-label=swap
-instance=swap
-#separator=false
-interval=2
-#min_width=swap 99.9%
+#[memory]
+#label=swap
+#instance=swap
+##separator=false
+#interval=2
+##min_width=swap 99.9%
# Disk usage
#
diff --git a/.i3blocks/cpu_usage b/.i3blocks/cpu_usage
index e387faf..732d518 100755
--- a/.i3blocks/cpu_usage
+++ b/.i3blocks/cpu_usage
@@ -19,4 +19,4 @@ else color="#66cccc"
fi
# Affichage
-printf "%3d%%" "$color" "$used"
\ No newline at end of file
+printf "cpu%3d%%" "$color" "$used"
diff --git a/.i3blocks/load_average b/.i3blocks/load_average
index 856700e..2b29bf1 100755
--- a/.i3blocks/load_average
+++ b/.i3blocks/load_average
@@ -50,4 +50,6 @@ else
color15="#F2777A"
fi
-printf "%4.4s %4.4s %4.4s" ${load} ${load5} ${load15}
+printf "load %4.4s %4.4s %4.4s" ${load} ${load5} ${load15}
+echo
+printf "load %4.4s" ${load}
diff --git a/.i3blocks/mpd b/.i3blocks/mpd
index f6e1fb1..0ab3383 100755
--- a/.i3blocks/mpd
+++ b/.i3blocks/mpd
@@ -1,5 +1,26 @@
#!/bin/bash
+LONG=30
+SHORT=15
+
+human_time() {
+ local seconds="$1"
+ if [[ "$seconds" -lt 0 ]]
+ then
+ echo "--:--"
+ return
+ fi
+ local minutes=$(( $seconds / 60 ))
+ seconds=$(( $seconds % 60 ))
+ if [[ "$minutes" -ge 90 ]]
+ then
+ printf "%5s\n" "${minutes}m"
+ else
+ printf "%02d:%02d\n" "$minutes" "$seconds"
+ fi
+ return
+}
+
if ! systemctl --user is-active mpd &>/dev/null
then
origstatus='off'
@@ -13,8 +34,6 @@ case $BLOCK_BUTTON in
1) mpc -q prev ;;
2) mpc -q toggle ;;
3) mpc -q next ;;
- 4) mpc -q seek +5 ;;
- 5) mpc -q seek -5 ;;
esac
status=""
@@ -29,53 +48,87 @@ if [[ "$origstatus" != "stop" ]] && [[ "$origstatus" != "off" ]]
then
if [[ ! -f /dev/shm/mpd ]]
then
- mpc -f '[[%artist%, ]%title%|[%file%]' current > /dev/shm/mpd
+ mpc -f '[[%artist%§]%title%|[%file%]' current > /dev/shm/mpd
fi
-
+
song=$( /dev/shm/mpd-scroll
+ scrolling=none
fi
- alltime="$(mpc status | column -t -o ' ' | sed -n '2p' | cut -f3)"
- elapsed_time="$(dateconv -f "%0H:%0M" "${alltime%/*}" || echo "--:--")"
- total_time="$(dateconv -f "%0H:%0M" "${alltime#*/}" || echo "--:--")"
- left_time="$(datediff -f "%0H:%0M" "$elapsed_time" "$total_time" || echo "--:--")"
-
- time="[$elapsed_time $left_time $total_time]"
- shorttime="$elapsed_time $left_time"
-
- if [[ "$time" = "[ ]" ]] || [[ -z "$time" ]]
+ if [[ "$scrolling" != "none" ]]
then
- time="[--:-- --:-- --:--]"
- fi
+ scroll="$( /dev/shm/mpd-scroll
+ song="$( /dev/shm/mpd-scroll
+ fi
fi
- echo "${song:0:25} $status$time"
- echo "${song:0:10} $status$shorttime"
+ time="$(echo -e 'status\nclose' | nc -U .mpd/socket | grep time \
+ | cut -d' ' -f2)"
+
+ time_elapsed=$(human_time "${time%:*}")
+ time_total=$(human_time "${time#*:}")
+ time_left=$(human_time "$(( ${time#*:} - ${time%:*} ))")
+
+ longtime="[$time_elapsed $time_left ${time_total/00:00/--:--}]"
+ shorttime="$time_elapsed $time_left"
+
+ case $scrolling in
+ long)
+ longsong="${song} "
+ shortsong="${song} "
+ ;;
+ short)
+ longsong="$(${longsong/§/ }"
+ elif [[ "$song" =~ § ]]
+ then
+ longsong="${longsong}"
+ fi
+ if [[ "$shortsong" =~ § ]]
+ then
+ shortsong="${shortsong/§/ }"
+ elif [[ "$song" =~ § ]]
+ then
+ shortsong="${shortsong}"
+ fi
+
+ echo "${longsong} $status$longtime"
+ echo "${shortsong} $status$shorttime"
else
[[ -f /dev/shm/mpd ]] && rm /dev/shm/mpd
[[ -f /dev/shm/mpd-scroll ]] && rm /dev/shm/mpd-scroll
- echo "$status[--:-- --:-- --:--]"
- echo "$status--:-- --:--"
+ printf "%${LONG}s $status[--:-- --:-- --:--]\n" " "
+ printf "%${SHORT}s $status--:-- --:--\n" " "
fi
diff --git a/.local/bin/mpd-notif b/.local/bin/mpd-notif
index 3f845ca..68667c0 100755
--- a/.local/bin/mpd-notif
+++ b/.local/bin/mpd-notif
@@ -5,9 +5,9 @@ export MPD_HOST="$HOME/.mpd/socket"
while true
do
systemctl --user is-active mpd.service || exit 1
- infos=$(mpc -w -f '[[%artist% - ]%title%[\n%album%]]|[%file%]' current)
- mpc -f '[[%artist%, ]%title%|[%file%]' current > /dev/shm/mpd
- cp /dev/shm/mpd /dev/shm/mpd-scroll
+ infos=$(mpc -w -f '[[%artist%\n]%title%[\n%album%]]|[%file%]' current)
+ mpc -f '[[%artist%§]%title%|[%file%]' current > /dev/shm/mpd
+ echo "$( /dev/shm/mpd-scroll
if [[ -z "$infos" ]]
then
infos="Arrêt"