awesomewm files

This commit is contained in:
Cynthia Foxwell 2022-10-23 21:06:06 -06:00
parent b5fcd4b6d3
commit 24706d35f7
46 changed files with 1485 additions and 0 deletions

36
linux/.local/bin/cmus-notify.sh Executable file
View file

@ -0,0 +1,36 @@
#!/bin/bash
[ $# -eq 0 ] && exit 0
get_albumart() {
rm /tmp/albumart.jpg
local dir_name=$( dirname "$1" )
local names=(folder cover albumart front "$2")
for item in "${names[@]}" ; do
img_file=$( find "$dir_name" -maxdepth 1 -iregex ".*$item*\.\(jpg\|jpeg\|gif\|png\|\)$" -print -quit )
[ -n "$img_file" ] && cp "$img_file" /tmp/_albumart.jpg && break
done
[ -z "$img_file" ] && ffmpeg -i "$1" -an -v:c copy "/tmp/_albumart.jpg" -y && img_file="/tmp/_albumart.jpg"
[ -n "$img_file" ] && ffmpeg -i /tmp/_albumart.jpg -vf scale=72:-1 /tmp/albumart.jpg && rm /tmp/_albumart.jpg
}
if [ $2 == "playing" ]; then
while [ $# -ge 2 ] ; do
eval _$1='$2'
shift
shift
done
get_albumart "$_file" "$_album"
duration_formatted=""
if [ "$_duration" != "" ]; then
if [ $_duration -ge 3600 ]; then
duration_formatted+=$(printf '%02d:' $(($_duration/3600)))
fi
duration_formatted+=$(printf '%02d:%02d' $(($_duration%3600/60)) $(($_duration%60)))
fi
notify-send -t 5000 -i /tmp/albumart.jpg "$_title" "$_artist\n$_album\n$duration_formatted"
fi

View file

@ -0,0 +1,51 @@
#!/bin/bash
if [ "`pgrep -x cmus`" == "" ]; then
echo "<txt></txt>"
exit 0
fi
status=$(cmus-remote -Q | awk '/status / {print $2}')
albumartist=$(cmus-remote -Q | awk '/tag albumartist / {$1="";$2="";print substr($0,3)}')
artist=$(cmus-remote -Q | awk '/tag artist / {$1="";$2="";print substr($0,3)}')
title=$(cmus-remote -Q | awk '/tag title / {$1="";$2="";print substr($0,3)}')
duration=$(cmus-remote -Q | awk '/duration/ {print $2}')
position=$(cmus-remote -Q | awk '/position/ {print $2}')
nowplaying=""
if [ "$albumartist" != "" ]; then
nowplaying+="$albumartist"
else
nowplaying+="$artist"
fi
nowplaying+=" - $title"
position_formatted=""
duration_formatted=""
if [ "$position" != "" ]; then
if [ $position -ge 3600 ]; then
position_formatted+=$(printf '%02d:' $(($position/3600)))
fi
position_formatted+=$(printf '%02d:%02d' $(($position%3600/60)) $(($position%60)))
fi
if [ "$duration" != "" ]; then
if [ $duration -ge 3600 ]; then
duration_formatted+=$(printf '%02d:' $(($duration/3600)))
fi
duration_formatted+=$(printf '%02d:%02d' $(($duration%3600/60)) $(($duration%60)))
fi
nowplaying+=" [$position_formatted/$duration_formatted]"
if [ "$status" == "paused" ]; then
nowplaying+=" [paused]"
elif [ "$status" == "stopped" ]; then
nowplaying+=" [stopped]"
fi
echo "<icon>mplayer</icon>"
echo "<txt> $nowplaying</txt>"

View file

@ -4,8 +4,10 @@ pkill -9 pipewire
pkill -9 pipewire-pulse
pkill -9 vmware-user-suid-wrapper
pkill -9 xmousepasteblock
pkill -9 xscreensaver
pipewire &
pipewire-pulse &
vmware-user-suid-wrapper &
xmousepasteblock &
xscreensaver &