[xmobar] truncated mpris2 output and updated scripts

This commit is contained in:
Afonso Franco 2024-09-12 21:42:04 +01:00
parent 9ca7026a62
commit a2df9ab68b
Signed by: afonso
SSH key fingerprint: SHA256:PQTRDHPH3yALEGtHXnXBp3Orfcn21pK20t0tS1kHg54
5 changed files with 19 additions and 7 deletions

View file

@ -13,10 +13,10 @@ else
fi
if [ "$temp" -ge "$temp2" ] ; then
echo "<fc=#7C6F64><fn=6></fn></fc> <fc=#FB4934> $temp°C</fc>"
echo "<fc=#D79921><fn=6></fn></fc> <fc=#FB4934> $temp°C</fc>"
elif [ "$temp" -ge "$temp1" ] ; then
echo "<fc=#7C6F64><fn=6></fn></fc> <fc=#FE8019> $temp°C</fc>"
echo "<fc=#D79921><fn=6></fn></fc> <fc=#FE8019> $temp°C</fc>"
else
echo "<fc=#7C6F64><fn=6></fn></fc> <fc=#B8BB26> $temp°C</fc>"
echo "<fc=#D79921><fn=6></fn></fc> <fc=#B8BB26> $temp°C</fc>"
fi

View file

@ -1,3 +1,3 @@
#!/bin/sh
freespace=$(btrfs fi usage / | grep -Po 'Free \(estimated\):.*' | awk '{print $3}')
echo "<fc=#7C6F64><fn=6></fn></fc> <fc=#B8BB26> $freespace</fc>"
echo "<fc=#689D6A><fn=6></fn></fc> <fc=#B8BB26> $freespace</fc>"

View file

@ -0,0 +1,12 @@
#!/bin/bash
# Get the MPRIS information
mpris_info=$(playerctl --player=playerctld metadata --format '{{ artist }} - {{ title }}')
# Truncate the output to 15 characters, adding trailing dots if needed
truncated_info=$(printf '%.35s' "$mpris_info")
if [ ${#mpris_info} -gt 35 ]; then
truncated_info="${truncated_info}..."
fi
echo "$truncated_info"

View file

@ -1,4 +1,4 @@
#!/bin/bash
update_number=$(checkupdates | wc -l)
echo "<fc=#7C6F64><fn=6>󰣇 </fn></fc> <fc=#B8BB26>$update_number</fc>"
echo "<fc=#458588><fn=6>󰣇 </fn></fc> <fc=#B8BB26>$update_number</fc>"

View file

@ -19,8 +19,8 @@ Config {font = "Ubuntu bold 10"
, commands = [
Run XMonadLog
, Run Date "<fc=#A89984>%a, %d %b <fn=1></fn> %H:%M</fc>" "date" 10
, Run Mpris2 "playerctld" ["-t", "<artist> - <title>"] 10
, Run Memory ["-t","<fc=#7C6F64><fn=6></fn></fc> <fc=#B8BB26> <usedratio>%</fc>"] 50
, Run Com "/home/afonso/.config/xmobar/scripts/mpris2.sh" [] "mpris2" 10
, Run Memory ["-t","<fc=#CC241D><fn=6></fn></fc> <fc=#B8BB26> <usedratio>%</fc>"] 50
, Run Com "/home/afonso/.config/xmobar/scripts/disk.sh" [] "disk" 100
, Run Com "/home/afonso/.config/xmobar/scripts/cpu_temp.sh" [] "cpu" 50
, Run Com "/home/afonso/.config/xmobar/scripts/battery.sh" [] "battery" 50