add ncspot config + workaround for wired to show album covers

master
Rostyslav Hnatyshyn 3 weeks ago
parent b9bfd9cc51
commit a9cc6f0889
  1. 1
      .gitignore
  2. 4
      ncspot/config.toml
  3. 27
      ncspot/playerctl_notifier.sh
  4. 3
      zshrc

1
.gitignore vendored

@ -55,3 +55,4 @@ nvim/plugin
alacritty/themes alacritty/themes
myzsh myzsh
ncspot/userstate.cbor

@ -0,0 +1,4 @@
notify=false
[notification_format]
body = "%album\n%artists"

@ -0,0 +1,27 @@
killall -q playerctl
# delete all the copied image files first
find "$HOME/.cache/ncspot/" -type f -exec sh -c 'file -b --mime-type "$0" | grep -q "^image/" && rm "$0"' {} \;
playerctl metadata --follow --format '{{ mpris:trackid }}' | while read -r line; do
title=$(playerctl metadata title)
album=$(playerctl metadata album)
artist=$(playerctl metadata artist)
art_url=$(playerctl metadata mpris:artUrl)
ap="${art_url##*/}"
if [[ -n $ap ]]; then
cfp="$HOME/.cache/ncspot/covers/$ap"
until [ -e $cfp ]; do
sleep 1
done
MIME_TYPE=$(file -b --mime-type "$cfp")
SUB_TYPE=$(echo "$MIME_TYPE" | cut -d'/' -f2)
curr_dir="$HOME/.cache/ncspot"
nfp="$curr_dir/$ap.$SUB_TYPE"
cp $cfp $nfp
# Extract the subtype (e.g., "jpeg", "plain")
SUB_TYPE=$(echo "$MIME_TYPE" | cut -d'/' -f2)
notify-send -a ncspot "$title" "$album\n$artist" --hint=string:image-path:$nfp --icon "/usr/share/icons/Papirus-Dark/24x24/devices/audio-speakers.svg"
fi
done

@ -16,9 +16,10 @@ source $ZSH/oh-my-zsh.sh
export LANG=en_US.UTF-8 export LANG=en_US.UTF-8
export EDITOR='nvim' export EDITOR='nvim'
export VISUAL='nvim' export VISUAL='nvim-qt'
alias vim='nvim' alias vim='nvim'
alias ws='web_search' alias ws='web_search'
alias ncspot='~/.config/ncspot/playerctl_notifier.sh & ncspot'
zstyle ':completion:*' completer _complete _approximate zstyle ':completion:*' completer _complete _approximate
zstyle ':completion:*' group-name '' zstyle ':completion:*' group-name ''

Loading…
Cancel
Save