Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Add cover art script
Browse files Browse the repository at this point in the history
  • Loading branch information
Dylan committed Feb 19, 2016
1 parent 2a24488 commit c89b7da
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .config/openbox/autostart
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
coverspawn

10 changes: 10 additions & 0 deletions .config/openbox/rc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,16 @@
<decor>yes</decor>
<layer>above</layer>
</application>
<application name="Music">
<desktop>all</desktop>
<maximized>no</maximized>
<decor>no</decor>
<layer>above</layer>
<position force="yes">
<x>1670</x>
<y>820</y>
</position>
</application>
<application class="Firefox*">
<desktop>1</desktop>
<focus>no</focus>
Expand Down
2 changes: 1 addition & 1 deletion .xinitrc
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ pulseaudio --start &
redshift -m randr &

# Start openbox
exec openbox
exec openbox-session
9 changes: 0 additions & 9 deletions scripts/music/cmus-current.sh

This file was deleted.

44 changes: 44 additions & 0 deletions scripts/music/cover.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/mksh
# Display cover art based on "mpc current"
#
# Created by Dylan Araps
# https://github.com/dylanaraps/dotfiles

# Show cursor on exit
trap 'printf "\033[?25h"; clear; exit' 2

# Set terminal title
echo -e '\033]2;'Music'\007'

# Hide terminal cursor
tput civis

# Clear terminal output
clear

# Cover directory
dir=$HOME/Music/covers/

# Image size
width=$1
height=$1

# Image offset
xoffset=0
yoffset=0

# Image format
format=jpg

while :; do
currentsong=$(mpc current)
currentsong=${currentsong//\/}
img="$dir$currentsong.$format"

w3m_command="0;1;$xoffset;$yoffset;$width;$height;;;;;$img\n4;\n3;"
echo -e "$w3m_command" | /usr/lib/w3m/w3mimgdisplay

# Update on mpd play/pause/next/prev and database update
mpc idle player update > /dev/null 2>&1
done

16 changes: 16 additions & 0 deletions scripts/music/coverspawn.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/mksh
# Spawn a terminal that displays cover art
#
# Created by Dylan Araps
# https://github.com/dylanaraps/dotfiles

# Source colors
source ~/dotfiles/scripts/colors/output/colors.sh

# Spawn the terminal
urxvtc -name "Music" -bg "#$white" -fn "xft:fixed" -b 3 -g 18x8 -e mksh -c "cover 140" >/dev/null

# Redraw album art
mpc update
mpc update
mpc update

0 comments on commit c89b7da

Please sign in to comment.