2019-07-07 22:07:32 -07:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-09-13 03:27:42 -07:00
|
|
|
###########################
|
|
|
|
## Program: parlink.sh
|
|
|
|
##
|
|
|
|
## Description: Parsec Wrapper
|
|
|
|
##
|
|
|
|
## MIT License
|
|
|
|
##
|
|
|
|
## Copyright (c) 2019 Justin Moore
|
|
|
|
##
|
|
|
|
## Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
## of this software and associated documentation files (the "Software"), to deal
|
|
|
|
## in the Software without restriction, including without limitation the rights
|
|
|
|
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
## copies of the Software, and to permit persons to whom the Software is
|
|
|
|
## furnished to do so, subject to the following conditions:
|
|
|
|
##
|
|
|
|
## The above copyright notice and this permission notice shall be included in all
|
|
|
|
## copies or substantial portions of the Software.
|
|
|
|
##
|
|
|
|
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
## AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
## SOFTWARE.
|
|
|
|
###########################
|
|
|
|
# Colors
|
|
|
|
RED='\033[0;31m'
|
|
|
|
LRED="\033[1;31m"
|
|
|
|
BLUE="\033[0;34m"
|
|
|
|
LBLUE="\033[1;34m"
|
|
|
|
GREEN="\033[0;32m"
|
|
|
|
LGREEN="\033[1;32m"
|
|
|
|
YELLOW="\033[1;33m"
|
|
|
|
CYAN="\033[0;36m"
|
|
|
|
LCYAN="\033[1;36m"
|
|
|
|
PURPLE="\033[0;35m"
|
|
|
|
LPURPLE="\033[1;35m"
|
|
|
|
BWHITE="\e[1m"
|
|
|
|
NC='\033[0m' # No Color
|
2019-07-07 22:07:32 -07:00
|
|
|
|
2019-09-13 03:27:42 -07:00
|
|
|
# Global Vars
|
2019-07-07 22:07:32 -07:00
|
|
|
PARSEC_BIN="/usr/bin/parsecd"
|
|
|
|
PARSEC_ARGS="app_daemon=1"
|
|
|
|
PARSEC_URL="https://parsecgaming.com"
|
|
|
|
PARSEC_PROCESS=$(ps -A | grep -c parsecd)
|
2019-08-22 07:53:35 -07:00
|
|
|
|
2019-09-13 03:27:42 -07:00
|
|
|
###########################################
|
|
|
|
set_video_driver(){
|
|
|
|
declare -a driver_name
|
2019-07-07 22:07:32 -07:00
|
|
|
|
2019-09-13 03:27:42 -07:00
|
|
|
driver_name=(
|
|
|
|
"iHD"
|
|
|
|
"i965"
|
|
|
|
"nouveau"
|
|
|
|
"vdpau"
|
|
|
|
"radeonsi"
|
|
|
|
"fglrx")
|
|
|
|
|
|
|
|
|
|
|
|
CARD_ID="${1}"
|
|
|
|
if [[ ${CARD_ID} = "nvidia" ]];then
|
|
|
|
echo "Setting LIBVA_DRIVER_NAME to: ${driver_name[2]}"
|
|
|
|
export LIBVA_DRIVER_NAME=${driver_name[2]}
|
|
|
|
|
|
|
|
elif [[ ${CARD_ID} = "catalyst" ]];then
|
|
|
|
echo "Setting LIBVA_DRIVER_NAME to: ${driver_name[5]}"
|
|
|
|
export LIBVA_DRIVER_NAME=${driver_name[5]}
|
|
|
|
|
|
|
|
elif [[ "${CARD_ID}" = "intel-modern" ]];then
|
|
|
|
echo "Setting LIBVA_DRIVER_NAME to: ${driver_name[0]}"
|
|
|
|
export LIBVA_DRIVER_NAME=${driver_name[0]}
|
|
|
|
|
|
|
|
elif [[ "${CARD_ID}" = "intel-old" ]];then
|
|
|
|
echo "Setting LIBVA_DRIVER_NAME to: ${driver_name[1]}"
|
|
|
|
export LIBVA_DRIVER_NAME=${driver_name[1]}
|
|
|
|
|
|
|
|
elif [[ "${CARD_ID}" = "radeon" ]];then
|
|
|
|
echo "Setting LIBVA_DRIVER_NAME to: ${driver_name[4]}"
|
|
|
|
export LIBVA_DRIVER_NAME=${driver_name[4]}
|
2019-07-07 22:07:32 -07:00
|
|
|
|
2019-08-22 07:53:35 -07:00
|
|
|
else
|
2019-09-13 03:27:42 -07:00
|
|
|
echo -e "${LRED}Accepted Options:\n
|
|
|
|
intel-old : (uses i965 driver)
|
|
|
|
intel-modern : (uses iHD driver)
|
|
|
|
nvidia : (uses vdpau driver)
|
|
|
|
nouveau : (uses nouveau driver)
|
2019-09-13 17:56:25 -07:00
|
|
|
radeon: (uses the radeonsi driver)
|
|
|
|
catalyst: (uses fglx driver)${NC}"
|
2019-08-22 07:53:35 -07:00
|
|
|
fi
|
2019-09-13 03:27:42 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
start_parsec(){
|
|
|
|
while [[ ${PARSEC_PROCESS} != "1" ]];do
|
|
|
|
if [[ ! -f ${PARSEC_BIN} ]];then
|
|
|
|
xdg-open ${PARSEC_URL}
|
|
|
|
elif [[ "${1}" = "-b" ]];then
|
|
|
|
${PARSEC_BIN} ${PARSEC_ARGS}
|
|
|
|
break
|
|
|
|
|
|
|
|
else
|
|
|
|
${PARSEC_BIN} ${PARSEC_ARGS}
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
case "${1}" in
|
|
|
|
|
|
|
|
-c)
|
|
|
|
PARSEC_ARGS="%u"
|
|
|
|
|
|
|
|
if [[ ! -z "${2}" ]];then
|
|
|
|
set_video_driver "${2}"
|
|
|
|
start_parsec "-b"
|
|
|
|
else
|
|
|
|
start_parsec "-b"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
set_video_driver "${1}"
|
|
|
|
start_parsec
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
|