Cleaner async, music-client aliased to go trough awesome

This commit is contained in:
Thomas Forgione 2017-10-20 11:38:23 +02:00
parent 052e945250
commit f082d6c5a5
No known key found for this signature in database
GPG Key ID: C75CD416BD1FFCE1
2 changed files with 31 additions and 15 deletions

View File

@ -27,9 +27,9 @@ local function set_text(text)
end end
end end
ret.execute_command = function(command) ret.execute_command = function(command, arg)
awful.spawn.easy_async('music-client ' .. command, function(stdout, stderr, reason, code) awful.spawn.easy_async({'music-client', command, arg}, function(stdout, stderr, reason, code)
local text = su.split(stdout, '\n') local text = su.split(stdout, '\n')
local active_command = local active_command =

View File

@ -112,17 +112,33 @@ if [ -d "$GCLONE_PATH" ]; then
fi fi
# Music things # Music things
# command -v music-server > /dev/null 2>&1 command -v music-server > /dev/null 2>&1
# if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
# mplayer() {
# ps -e | grep music-server > /dev/null 2>&1 # If music-server is installed, check if awesome is running with screenfetch
# if [ $? -ne 0 ]; then command -v screenfetch > /dev/null 2>&1
# nohup music-server > /dev/null 2>&1 &
# disown if [ $? -eq 0 ]; then
# sleep 0.2s
# fi screenfetch -d wm -nN | grep "Awesome" > /dev/null 2>&1
# filename=$(echo `realpath $1` | sed 's/ /\\\\ /g' | sed "s/'/\\\\\\\\'/g")
# awesome-client "require('music').execute_command('file ' .. \"$filename\")" if [ $? -eq 0 ]; then
# }
# fi # User is running awesome, music-client will go through awesome-client
music-client() {
command=$1
if [ $# -eq 1 ]; then
echo "require('music').execute_command(\"$command\")"
else
library_path=$(realpath $2 | rev | cut -d '/' -f -3 | rev)
awesome_command="require('music').execute_command(\"$command\",\"$library_path\")"
echo $awesome_command | awesome-client
fi
}
fi
fi
fi