dotfiles/.moc/notif
2019-04-19 22:18:25 +02:00

33 lines
675 B
Bash
Executable file
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
pkill -SIGRTMIN+13 i3blocks
pidof cava && pkill -USR1 cava
[[ $# -eq 0 ]] && exit
file="$1"
duration="$2"
title="$3"
artist="$4"
album="$5"
## Debug
#notify-send "MOC" \
#"Fichier : $file
#Durée : $duration
#Titre : $title
#Artiste : $artist
#Album : $album"
if [[ -z "$title" ]]
then
notify-send "Music On Console" "$(basename "$file" | rev | cut -d'.' -f2- | rev)"
echo "$(basename "$file" | rev | cut -d'.' -f2- | rev)" > /dev/shm/mocp
else
string="$title"
[[ -n "$artist" ]] && string="$artist - $string"
[[ -n "$album" ]] && string="$string\n$album"
notify-send "Music On Console" "$string"
echo "$title, $artist" > /dev/shm/mocp
fi