diff --git a/zsh/functions.zsh b/zsh/functions.zsh index ba21fde..cf47159 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -6,7 +6,8 @@ copy() { if [ $# -eq 0 ]; then xclip -selection c else - cat $1 | xclip -selection c + file_type=$(file -b --mime-type "$1") + xclip -selection c -t $file_type < $1 fi } @@ -125,7 +126,6 @@ if [ -d "$GCLONE_PATH" ]; then compdef _cdg cdg - alias mcf="music-client file" fi # Music things @@ -147,12 +147,14 @@ if [ $? -eq 0 ]; then if [ $# -eq 1 ]; then echo "require('music').execute_command(\"$command\")" | awesome-client else - library_path=$(realpath $2 | rev | cut -d '/' -f -3 | rev) + library_path=$(realpath $2 | cut -d '/' -f 5-) awesome_command="require('music').execute_command(\"$command\",\"$library_path\")" echo $awesome_command | awesome-client fi } + alias mcf="music-client file" + fi fi