Add option for set polling rate
This commit is contained in:
parent
c00f29f208
commit
6c36b85837
|
@ -55,6 +55,81 @@ function aboutZenidrv() {
|
|||
--text "Interfaz GUI: zenidrv-g203 ${VERSION} (${M_DATE})\nRepo: https://github.com/q3aql/zenidrv-g203\nAutor: q3aql\nContacto: q3aql@duck.com\nLicencia: GPL v2.0\n\nBackend: g203-led\nRepo: https://github.com/smasty/g203-led\nAutor: smasty\nContacto: https://smasty.net\nLicencia: Licencia MIT\n\nBackend: libratbag\nAutor: Equipo libratbag\nRepo: https://github.com/libratbag/libratbag\nLicencia: Licencia RedHat"
|
||||
}
|
||||
|
||||
# Function to set polling rate
|
||||
function setPollingRate(){
|
||||
checkNumbers=$(checkRatbag)
|
||||
if [ "${checkNumbers}" == "1" ] ; then
|
||||
selectedPolling=$(zenity --window-icon=${iconPath} --width=225 --height=265 --list --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" \
|
||||
--window-icon=${iconPath} --column "Selecciona el polling rate:" "100hz" "125hz" "250hz" "500hz" "1000hz")
|
||||
if [ "${selectedPolling}" == "100hz" ] ; then
|
||||
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Estableciendo polling rate a 100hz" \
|
||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
ratbagctl "${device_name}" rate set 100
|
||||
erroPoll=$?
|
||||
if [ ${erroPoll} -eq 0 ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=260 \
|
||||
--text "Error configurando el polling rate"
|
||||
fi
|
||||
elif [ "${selectedPolling}" == "125hz" ] ; then
|
||||
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Estableciendo polling rate a 125hz" \
|
||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
ratbagctl "${device_name}" rate set 125
|
||||
erroPoll=$?
|
||||
if [ ${erroPoll} -eq 0 ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=260 \
|
||||
--text "Error configurando el polling rate"
|
||||
fi
|
||||
elif [ "${selectedPolling}" == "250hz" ] ; then
|
||||
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Estableciendo polling rate a 250hz" \
|
||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
ratbagctl "${device_name}" rate set 250
|
||||
erroPoll=$?
|
||||
if [ ${erroPoll} -eq 0 ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=260 \
|
||||
--text "Error configurando el polling rate"
|
||||
fi
|
||||
elif [ "${selectedPolling}" == "500hz" ] ; then
|
||||
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Estableciendo polling rate a 500hz" \
|
||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
ratbagctl "${device_name}" rate set 500
|
||||
erroPoll=$?
|
||||
if [ ${erroPoll} -eq 0 ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=260 \
|
||||
--text "Error configurando el polling rate"
|
||||
fi
|
||||
elif [ "${selectedPolling}" == "1000hz" ] ; then
|
||||
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Estableciendo polling rate a 1000hz" \
|
||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
ratbagctl "${device_name}" rate set 1000
|
||||
erroPoll=$?
|
||||
if [ ${erroPoll} -eq 0 ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=260 \
|
||||
--text "Error configurando el polling rate"
|
||||
fi
|
||||
else
|
||||
echo null > /dev/null
|
||||
fi
|
||||
else
|
||||
zenity --title "zenidrv-g203 ${VERSION} (ratbagd requerido)" --window-icon=${iconPath} --warning --width=350 \
|
||||
--text "No puedes configurar el polling rate. Es necesario tener instalado el paquete ratbagd (libratbag).\n\nPuedes instalarlo desde el repositorio o accediendo al siguiente enlace:\nhttps://github.com/libratbag/libratbag"
|
||||
fi
|
||||
}
|
||||
|
||||
# Show menu with options.
|
||||
showMenu=0
|
||||
rootMessage
|
||||
|
@ -64,16 +139,18 @@ while [ ${showMenu} -eq 0 ] ; do
|
|||
checkNumbers=$(checkRatbag)
|
||||
if [ "${checkNumbers}" == "1" ] ; then
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
get_rate=$(ratbagctl "$device_name" rate get)
|
||||
get_dpi=$(ratbagctl "$device_name" dpi get | cut -d "d" -f 1)
|
||||
get_rate=$(ratbagctl "${device_name}" rate get)
|
||||
get_dpi=$(ratbagctl "${device_name}" dpi get | cut -d "d" -f 1)
|
||||
numberDPI="(${get_dpi})"
|
||||
numberPolling="(${get_rate})"
|
||||
fi
|
||||
opcion=$(zenity --width=280 --height=435 --list --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" \
|
||||
opcion=$(zenity --width=280 --height=460 --list --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" \
|
||||
--window-icon=${iconPath} --imagelist --column "Icono" --column "Efecto/Opcion" ${imagesPath}/solid.png "Solido" \
|
||||
${imagesPath}/cycle.png "Ciclo" ${imagesPath}/breathe.png "Respiracion" ${imagesPath}/wave.png "Ola" \
|
||||
${imagesPath}/blend.png "Mezcla" ${imagesPath}/intro-on.png "Intro (Activado)" ${imagesPath}/intro-off.png "Intro (Desactivado)" \
|
||||
${imagesPath}/mouse-dpi.png "Establecer DPI ${numberDPI}" ${imagesPath}/light-off.png "Apagar luz" ${imagesPath}/about.png "Acerca" ${imagesPath}/exit.png "Salir")
|
||||
${imagesPath}/mouse-dpi.png "Establecer DPI ${numberDPI}" \
|
||||
${imagesPath}/mouse-polling-rate.png "Polling Rate ${numberPolling}" ${imagesPath}/light-off.png "Apagar luz" \
|
||||
${imagesPath}/about.png "Acerca" ${imagesPath}/exit.png "Salir")
|
||||
if [ "${opcion}" == "${imagesPath}/solid.png" ] ; then
|
||||
color_selected=$(zenity --list --width=260 --height=570 --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" \
|
||||
--window-icon=${iconPath} --imagelist --column "Color" --column "Nombre color" ${imagesPath}/custom.png Personalizado \
|
||||
|
@ -416,13 +493,15 @@ while [ ${showMenu} -eq 0 ] ; do
|
|||
checkNumbers=$(checkRatbag)
|
||||
if [ "${checkNumbers}" == "1" ] ; then
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
ratbagctl "$device_name" dpi set "${dpi_number}"
|
||||
ratbagctl "${device_name}" dpi set "${dpi_number}"
|
||||
fi
|
||||
else
|
||||
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
|
||||
--text "Dispositivo no encontrado o conectado"
|
||||
fi
|
||||
fi
|
||||
elif [ "${opcion}" == "${imagesPath}/mouse-polling-rate.png" ] ; then
|
||||
setPollingRate
|
||||
elif [ "${opcion}" == "${imagesPath}/light-off.png" ] ; then
|
||||
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Apagando la luz del dispositivo" \
|
||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
||||
|
|
|
@ -55,6 +55,81 @@ function aboutZenidrv() {
|
|||
--text "Interfaz GUI: zenidrv-g203 ${VERSION} (${M_DATE})\nRepo: https://github.com/q3aql/zenidrv-g203\nAutor: q3aql\nContacto: q3aql@duck.com\nLicencia: GPL v2.0\n\nBackend: g203-led\nRepo: https://github.com/smasty/g203-led\nAutor: smasty\nContacto: https://smasty.net\nLicencia: Licencia MIT\n\nBackend: libratbag\nAutor: Equipo libratbag\nRepo: https://github.com/libratbag/libratbag\nLicencia: Licencia RedHat"
|
||||
}
|
||||
|
||||
# Function to set polling rate
|
||||
function setPollingRate(){
|
||||
checkNumbers=$(checkRatbag)
|
||||
if [ "${checkNumbers}" == "1" ] ; then
|
||||
selectedPolling=$(zenity --window-icon=${iconPath} --width=225 --height=265 --list --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" \
|
||||
--window-icon=${iconPath} --column "Selecciona el polling rate:" "100hz" "125hz" "250hz" "500hz" "1000hz")
|
||||
if [ "${selectedPolling}" == "100hz" ] ; then
|
||||
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Estableciendo polling rate a 100hz" \
|
||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
ratbagctl "${device_name}" rate set 100
|
||||
erroPoll=$?
|
||||
if [ ${erroPoll} -eq 0 ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
zenity --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=260 \
|
||||
--text "Error configurando el polling rate"
|
||||
fi
|
||||
elif [ "${selectedPolling}" == "125hz" ] ; then
|
||||
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Estableciendo polling rate a 125hz" \
|
||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
ratbagctl "${device_name}" rate set 125
|
||||
erroPoll=$?
|
||||
if [ ${erroPoll} -eq 0 ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
zenity --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=260 \
|
||||
--text "Error configurando el polling rate"
|
||||
fi
|
||||
elif [ "${selectedPolling}" == "250hz" ] ; then
|
||||
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Estableciendo polling rate a 250hz" \
|
||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
ratbagctl "${device_name}" rate set 250
|
||||
erroPoll=$?
|
||||
if [ ${erroPoll} -eq 0 ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
zenity --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=260 \
|
||||
--text "Error configurando el polling rate"
|
||||
fi
|
||||
elif [ "${selectedPolling}" == "500hz" ] ; then
|
||||
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Estableciendo polling rate a 500hz" \
|
||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
ratbagctl "${device_name}" rate set 500
|
||||
erroPoll=$?
|
||||
if [ ${erroPoll} -eq 0 ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
zenity --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=260 \
|
||||
--text "Error configurando el polling rate"
|
||||
fi
|
||||
elif [ "${selectedPolling}" == "1000hz" ] ; then
|
||||
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Estableciendo polling rate a 1000hz" \
|
||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
ratbagctl "${device_name}" rate set 1000
|
||||
erroPoll=$?
|
||||
if [ ${erroPoll} -eq 0 ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
zenity --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=260 \
|
||||
--text "Error configurando el polling rate"
|
||||
fi
|
||||
else
|
||||
echo null > /dev/null
|
||||
fi
|
||||
else
|
||||
zenity --title "zenidrv-g203 ${VERSION} (ratbagd requerido)" --window-icon=${iconPath} --warning --width=350 \
|
||||
--text "No puedes configurar el polling rate. Es necesario tener instalado el paquete ratbagd (libratbag).\n\nPuedes instalarlo desde el repositorio o accediendo al siguiente enlace:\nhttps://github.com/libratbag/libratbag"
|
||||
fi
|
||||
}
|
||||
|
||||
# Show menu with options.
|
||||
showMenu=0
|
||||
rootMessage
|
||||
|
@ -64,16 +139,17 @@ while [ ${showMenu} -eq 0 ] ; do
|
|||
checkNumbers=$(checkRatbag)
|
||||
if [ "${checkNumbers}" == "1" ] ; then
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
get_rate=$(ratbagctl "$device_name" rate get)
|
||||
get_dpi=$(ratbagctl "$device_name" dpi get | cut -d "d" -f 1)
|
||||
get_rate=$(ratbagctl "${device_name}" rate get)
|
||||
get_dpi=$(ratbagctl "${device_name}" dpi get | cut -d "d" -f 1)
|
||||
numberDPI="(${get_dpi})"
|
||||
numberPolling="(${get_rate})"
|
||||
fi
|
||||
opcion=$(zenity --width=280 --height=385 --list --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" \
|
||||
opcion=$(zenity --width=280 --height=410 --list --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" \
|
||||
--window-icon=${iconPath} --imagelist --column "Icono" --column "Efecto/Opcion" ${imagesPath}/solid.png "Solido" \
|
||||
${imagesPath}/cycle.png "Ciclo" ${imagesPath}/breathe.png "Respiracion" ${imagesPath}/intro-on.png \
|
||||
"Intro (Activado)" ${imagesPath}/intro-off.png "Intro (Desactivado)" ${imagesPath}/mouse-dpi.png "Establecer DPI ${numberDPI}" \
|
||||
${imagesPath}/light-off.png "Apagar luz" ${imagesPath}/about.png "Acerca" ${imagesPath}/exit.png "Salir")
|
||||
${imagesPath}/mouse-polling-rate.png "Polling Rate ${numberPolling}" ${imagesPath}/light-off.png "Apagar luz" \
|
||||
${imagesPath}/about.png "Acerca" ${imagesPath}/exit.png "Salir")
|
||||
if [ "${opcion}" == "${imagesPath}/solid.png" ] ; then
|
||||
color_selected=$(zenity --list --width=260 --height=570 --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" \
|
||||
--window-icon=${iconPath} --imagelist --column "Color" --column "Nombre color" ${imagesPath}/custom.png Personalizado \
|
||||
|
@ -394,13 +470,15 @@ while [ ${showMenu} -eq 0 ] ; do
|
|||
checkNumbers=$(checkRatbag)
|
||||
if [ "${checkNumbers}" == "1" ] ; then
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
ratbagctl "$device_name" dpi set "${dpi_number}"
|
||||
ratbagctl "${device_name}" dpi set "${dpi_number}"
|
||||
fi
|
||||
else
|
||||
zenity --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
|
||||
--text "Dispositivo no encontrado o conectado"
|
||||
fi
|
||||
fi
|
||||
elif [ "${opcion}" == "${imagesPath}/mouse-polling-rate.png" ] ; then
|
||||
setPollingRate
|
||||
elif [ "${opcion}" == "${imagesPath}/light-off.png" ] ; then
|
||||
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Apagando la luz del dispositivo" \
|
||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
||||
|
|
|
@ -55,6 +55,81 @@ function aboutZenidrv() {
|
|||
--text "GUI Interface: zenidrv-g203 ${VERSION} (${M_DATE})\nRepo: https://github.com/q3aql/zenidrv-g203\nAuthor: q3aql\nContact: q3aql@duck.com\nLicense: GPL v2.0\n\nBackend: g203-led\nRepo: https://github.com/smasty/g203-led\nAuthor: smasty\nContact: https://smasty.net\nLicense: MIT License\n\nBackend: libratbag\nAuthor: libratbag Team\nRepo: https://github.com/libratbag/libratbag\nLicense: RedHat License"
|
||||
}
|
||||
|
||||
# Function to set polling rate
|
||||
function setPollingRate(){
|
||||
checkNumbers=$(checkRatbag)
|
||||
if [ "${checkNumbers}" == "1" ] ; then
|
||||
selectedPolling=$(zenity --window-icon=${iconPath} --width=220 --height=265 --list --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" \
|
||||
--window-icon=${iconPath} --column "Select the polling rate:" "100hz" "125hz" "250hz" "500hz" "1000hz")
|
||||
if [ "${selectedPolling}" == "100hz" ] ; then
|
||||
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Setting polling rate to 100hz" \
|
||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
ratbagctl "${device_name}" rate set 100
|
||||
erroPoll=$?
|
||||
if [ ${erroPoll} -eq 0 ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=260 \
|
||||
--text "Error setting the polling rate"
|
||||
fi
|
||||
elif [ "${selectedPolling}" == "125hz" ] ; then
|
||||
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Setting polling rate to 125hz" \
|
||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
ratbagctl "${device_name}" rate set 125
|
||||
erroPoll=$?
|
||||
if [ ${erroPoll} -eq 0 ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=260 \
|
||||
--text "Error setting the polling rate"
|
||||
fi
|
||||
elif [ "${selectedPolling}" == "250hz" ] ; then
|
||||
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Setting polling rate to 250hz" \
|
||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
ratbagctl "${device_name}" rate set 250
|
||||
erroPoll=$?
|
||||
if [ ${erroPoll} -eq 0 ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=260 \
|
||||
--text "Error setting the polling rate"
|
||||
fi
|
||||
elif [ "${selectedPolling}" == "500hz" ] ; then
|
||||
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Setting polling rate to 500hz" \
|
||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
ratbagctl "${device_name}" rate set 500
|
||||
erroPoll=$?
|
||||
if [ ${erroPoll} -eq 0 ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=260 \
|
||||
--text "Error setting the polling rate"
|
||||
fi
|
||||
elif [ "${selectedPolling}" == "1000hz" ] ; then
|
||||
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Setting polling rate to 1000hz" \
|
||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
ratbagctl "${device_name}" rate set 1000
|
||||
erroPoll=$?
|
||||
if [ ${erroPoll} -eq 0 ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=260 \
|
||||
--text "Error setting the polling rate"
|
||||
fi
|
||||
else
|
||||
echo null > /dev/null
|
||||
fi
|
||||
else
|
||||
zenity --title "zenidrv-g203 ${VERSION} (ratbagd required)" --window-icon=${iconPath} --warning --width=350 \
|
||||
--text "You cannot configure the polling rate. You need to have the ratbagd (libratbag) package installed.\n\nYou can install it from the repository or by accessing the following link:\nhttps://github.com/libratbag/libratbag"
|
||||
fi
|
||||
}
|
||||
|
||||
# Show menu with options.
|
||||
showMenu=0
|
||||
rootMessage
|
||||
|
@ -64,16 +139,18 @@ while [ ${showMenu} -eq 0 ] ; do
|
|||
checkNumbers=$(checkRatbag)
|
||||
if [ "${checkNumbers}" == "1" ] ; then
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
get_rate=$(ratbagctl "$device_name" rate get)
|
||||
get_dpi=$(ratbagctl "$device_name" dpi get | cut -d "d" -f 1)
|
||||
get_rate=$(ratbagctl "${device_name}" rate get)
|
||||
get_dpi=$(ratbagctl "${device_name}" dpi get | cut -d "d" -f 1)
|
||||
numberDPI="(${get_dpi})"
|
||||
numberPolling="(${get_rate})"
|
||||
fi
|
||||
opcion=$(zenity --width=280 --height=435 --list --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" \
|
||||
opcion=$(zenity --width=280 --height=460 --list --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" \
|
||||
--window-icon=${iconPath} --imagelist --column "Icon" --column "Effect/Option" ${imagesPath}/solid.png "Solid" \
|
||||
${imagesPath}/cycle.png "Cycle" ${imagesPath}/breathe.png "Breathe" ${imagesPath}/wave.png "Wave" \
|
||||
${imagesPath}/blend.png "Blend" ${imagesPath}/intro-on.png "Intro (On)" ${imagesPath}/intro-off.png "Intro (Off)" \
|
||||
${imagesPath}/mouse-dpi.png "Set DPI ${numberDPI}" ${imagesPath}/light-off.png "Light off" ${imagesPath}/about.png "About" ${imagesPath}/exit.png "Exit")
|
||||
${imagesPath}/mouse-dpi.png "Set DPI ${numberDPI}" \
|
||||
${imagesPath}/mouse-polling-rate.png "Polling Rate ${numberPolling}" ${imagesPath}/light-off.png "Light off" \
|
||||
${imagesPath}/about.png "About" ${imagesPath}/exit.png "Exit")
|
||||
if [ "${opcion}" == "${imagesPath}/solid.png" ] ; then
|
||||
color_selected=$(zenity --list --width=260 --height=570 --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" \
|
||||
--window-icon=${iconPath} --imagelist --column "Color" --column "Name color" ${imagesPath}/custom.png Custom \
|
||||
|
@ -416,13 +493,15 @@ while [ ${showMenu} -eq 0 ] ; do
|
|||
checkNumbers=$(checkRatbag)
|
||||
if [ "${checkNumbers}" == "1" ] ; then
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
ratbagctl "$device_name" dpi set "${dpi_number}"
|
||||
ratbagctl "${device_name}" dpi set "${dpi_number}"
|
||||
fi
|
||||
else
|
||||
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
|
||||
--text "Device not found or connected"
|
||||
fi
|
||||
fi
|
||||
elif [ "${opcion}" == "${imagesPath}/mouse-polling-rate.png" ] ; then
|
||||
setPollingRate
|
||||
elif [ "${opcion}" == "${imagesPath}/light-off.png" ] ; then
|
||||
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Turning off the light on the mouse" \
|
||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
||||
|
|
|
@ -55,6 +55,81 @@ function aboutZenidrv() {
|
|||
--text "GUI Interface: zenidrv-g203 ${VERSION} (${M_DATE})\nRepo: https://github.com/q3aql/zenidrv-g203\nAuthor: q3aql\nContact: q3aql@duck.com\nLicense: GPL v2.0\n\nBackend: g203-led\nRepo: https://github.com/smasty/g203-led\nAuthor: smasty\nContact: https://smasty.net\nLicense: MIT License\n\nBackend: libratbag\nAuthor: libratbag Team\nRepo: https://github.com/libratbag/libratbag\nLicense: RedHat License"
|
||||
}
|
||||
|
||||
# Function to set polling rate
|
||||
function setPollingRate(){
|
||||
checkNumbers=$(checkRatbag)
|
||||
if [ "${checkNumbers}" == "1" ] ; then
|
||||
selectedPolling=$(zenity --window-icon=${iconPath} --width=220 --height=265 --list --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" \
|
||||
--window-icon=${iconPath} --column "Select the polling rate:" "100hz" "125hz" "250hz" "500hz" "1000hz")
|
||||
if [ "${selectedPolling}" == "100hz" ] ; then
|
||||
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Setting polling rate to 100hz" \
|
||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
ratbagctl "${device_name}" rate set 100
|
||||
erroPoll=$?
|
||||
if [ ${erroPoll} -eq 0 ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
zenity --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=260 \
|
||||
--text "Error setting the polling rate"
|
||||
fi
|
||||
elif [ "${selectedPolling}" == "125hz" ] ; then
|
||||
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Setting polling rate to 125hz" \
|
||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
ratbagctl "${device_name}" rate set 125
|
||||
erroPoll=$?
|
||||
if [ ${erroPoll} -eq 0 ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
zenity --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=260 \
|
||||
--text "Error setting the polling rate"
|
||||
fi
|
||||
elif [ "${selectedPolling}" == "250hz" ] ; then
|
||||
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Setting polling rate to 250hz" \
|
||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
ratbagctl "${device_name}" rate set 250
|
||||
erroPoll=$?
|
||||
if [ ${erroPoll} -eq 0 ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
zenity --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=260 \
|
||||
--text "Error setting the polling rate"
|
||||
fi
|
||||
elif [ "${selectedPolling}" == "500hz" ] ; then
|
||||
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Setting polling rate to 500hz" \
|
||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
ratbagctl "${device_name}" rate set 500
|
||||
erroPoll=$?
|
||||
if [ ${erroPoll} -eq 0 ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
zenity --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=260 \
|
||||
--text "Error setting the polling rate"
|
||||
fi
|
||||
elif [ "${selectedPolling}" == "1000hz" ] ; then
|
||||
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Setting polling rate to 1000hz" \
|
||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
ratbagctl "${device_name}" rate set 1000
|
||||
erroPoll=$?
|
||||
if [ ${erroPoll} -eq 0 ] ; then
|
||||
echo > /dev/null
|
||||
else
|
||||
zenity --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=260 \
|
||||
--text "Error setting the polling rate"
|
||||
fi
|
||||
else
|
||||
echo null > /dev/null
|
||||
fi
|
||||
else
|
||||
zenity --title "zenidrv-g203 ${VERSION} (ratbagd required)" --window-icon=${iconPath} --warning --width=350 \
|
||||
--text "You cannot configure the polling rate. You need to have the ratbagd (libratbag) package installed.\n\nYou can install it from the repository or by accessing the following link:\nhttps://github.com/libratbag/libratbag"
|
||||
fi
|
||||
}
|
||||
|
||||
# Show menu with options.
|
||||
showMenu=0
|
||||
rootMessage
|
||||
|
@ -64,16 +139,17 @@ while [ ${showMenu} -eq 0 ] ; do
|
|||
checkNumbers=$(checkRatbag)
|
||||
if [ "${checkNumbers}" == "1" ] ; then
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
get_rate=$(ratbagctl "$device_name" rate get)
|
||||
get_dpi=$(ratbagctl "$device_name" dpi get | cut -d "d" -f 1)
|
||||
get_rate=$(ratbagctl "${device_name}" rate get)
|
||||
get_dpi=$(ratbagctl "${device_name}" dpi get | cut -d "d" -f 1)
|
||||
numberDPI="(${get_dpi})"
|
||||
numberPolling="(${get_rate})"
|
||||
fi
|
||||
opcion=$(zenity --width=280 --height=385 --list --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" \
|
||||
opcion=$(zenity --width=280 --height=410 --list --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" \
|
||||
--window-icon=${iconPath} --imagelist --column "Icon" --column "Effect/Option" ${imagesPath}/solid.png "Solid" \
|
||||
${imagesPath}/cycle.png "Cycle" ${imagesPath}/breathe.png "Breathe" ${imagesPath}/intro-on.png \
|
||||
"Intro (On)" ${imagesPath}/intro-off.png "Intro (Off)" ${imagesPath}/mouse-dpi.png "Set DPI ${numberDPI}" \
|
||||
${imagesPath}/light-off.png "Light off" ${imagesPath}/about.png "About" ${imagesPath}/exit.png "Exit")
|
||||
${imagesPath}/mouse-polling-rate.png "Polling Rate ${numberPolling}" ${imagesPath}/light-off.png "Light off" \
|
||||
${imagesPath}/about.png "About" ${imagesPath}/exit.png "Exit")
|
||||
if [ "${opcion}" == "${imagesPath}/solid.png" ] ; then
|
||||
color_selected=$(zenity --list --width=260 --height=570 --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" \
|
||||
--window-icon=${iconPath} --imagelist --column "Color" --column "Name color" ${imagesPath}/custom.png Custom \
|
||||
|
@ -394,13 +470,15 @@ while [ ${showMenu} -eq 0 ] ; do
|
|||
checkNumbers=$(checkRatbag)
|
||||
if [ "${checkNumbers}" == "1" ] ; then
|
||||
device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1)
|
||||
ratbagctl "$device_name" dpi set "${dpi_number}"
|
||||
ratbagctl "${device_name}" dpi set "${dpi_number}"
|
||||
fi
|
||||
else
|
||||
zenity --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
|
||||
--text "Device not found or connected"
|
||||
fi
|
||||
fi
|
||||
elif [ "${opcion}" == "${imagesPath}/mouse-polling-rate.png" ] ; then
|
||||
setPollingRate
|
||||
elif [ "${opcion}" == "${imagesPath}/light-off.png" ] ; then
|
||||
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Turning off the light on the mouse" \
|
||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
||||
|
|
Loading…
Reference in New Issue
Block a user