diff --git a/es-ES/zenidrv-g203-lightsync b/es-ES/zenidrv-g203-lightsync index 0c78e74..15b72e8 100755 --- a/es-ES/zenidrv-g203-lightsync +++ b/es-ES/zenidrv-g203-lightsync @@ -14,6 +14,10 @@ M_DATE="090721" iconPath="/usr/share/icons/logitech/logitech-black.png" imagesPath="/usr/share/icons/logitech/images" +# Variables DPI & Polling rate +numberDPI="" +numberPolling="" + # Function to check admin rights. function rootMessage() { mkdir -p /etc/root &> /dev/null @@ -32,16 +36,38 @@ function rootMessage() { fi } +#Function to check ratbag dependence +function checkRatbag(){ + dependence="0" + if [ -f "/usr/bin/ratbagctl" ] ; then + dependence="1" + elif [ -f "/bin/ratbagctl" ] ; then + dependence="1" + elif [ -f "/usr/local/bin/ratbagctl" ] ; then + dependence="1" + fi + echo ${dependence} +} + # Show menu with options. showMenu=0 rootMessage while [ ${showMenu} -eq 0 ] ; do clear + # Check dpi & polling rate to show in menu + 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) + numberDPI="(${get_dpi})" + numberPolling="(${get_rate})" + fi opcion=$(zenity --width=280 --height=415 --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" ${imagesPath}/light-off.png "Apagar luz" ${imagesPath}/exit.png "Salir") + ${imagesPath}/mouse-dpi.png "Establecer DPI ${numberDPI}" ${imagesPath}/light-off.png "Apagar luz" ${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 \ @@ -381,7 +407,11 @@ while [ ${showMenu} -eq 0 ] ; do g203-led.py lightsync dpi ${dpi_number} device_error=$? if [ ${device_error} -eq 0 ] ; then - echo > /dev/null + checkNumbers=$(checkRatbag) + if [ "${checkNumbers}" == "1" ] ; then + device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1) + 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" diff --git a/es-ES/zenidrv-g203-prodigy b/es-ES/zenidrv-g203-prodigy index 89c4f91..f132be0 100755 --- a/es-ES/zenidrv-g203-prodigy +++ b/es-ES/zenidrv-g203-prodigy @@ -14,6 +14,10 @@ M_DATE="090721" iconPath="/usr/share/icons/logitech/logitech-black.png" imagesPath="/usr/share/icons/logitech/images" +# Variables DPI & Polling rate +numberDPI="" +numberPolling="" + # Function to check admin rights. function rootMessage() { mkdir -p /etc/root &> /dev/null @@ -32,15 +36,37 @@ function rootMessage() { fi } +#Function to check ratbag dependence +function checkRatbag(){ + dependence="0" + if [ -f "/usr/bin/ratbagctl" ] ; then + dependence="1" + elif [ -f "/bin/ratbagctl" ] ; then + dependence="1" + elif [ -f "/usr/local/bin/ratbagctl" ] ; then + dependence="1" + fi + echo ${dependence} +} + # Show menu with options. showMenu=0 rootMessage while [ ${showMenu} -eq 0 ] ; do clear + # Check dpi & polling rate to show in menu + 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) + numberDPI="(${get_dpi})" + numberPolling="(${get_rate})" + fi opcion=$(zenity --width=280 --height=365 --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" \ + "Intro (Activado)" ${imagesPath}/intro-off.png "Intro (Desactivado)" ${imagesPath}/mouse-dpi.png "Establecer DPI ${numberDPI}" \ ${imagesPath}/light-off.png "Apagar luz" ${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)" \ @@ -359,7 +385,11 @@ while [ ${showMenu} -eq 0 ] ; do g203-led.py dpi ${dpi_number} device_error=$? if [ ${device_error} -eq 0 ] ; then - echo > /dev/null + checkNumbers=$(checkRatbag) + if [ "${checkNumbers}" == "1" ] ; then + device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1) + 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" diff --git a/zenidrv-g203-lightsync b/zenidrv-g203-lightsync index c3b82ac..f2721e5 100755 --- a/zenidrv-g203-lightsync +++ b/zenidrv-g203-lightsync @@ -14,6 +14,10 @@ M_DATE="090721" iconPath="/usr/share/icons/logitech/logitech-black.png" imagesPath="/usr/share/icons/logitech/images" +# Variables DPI & Polling rate +numberDPI="" +numberPolling="" + # Function to check admin rights. function rootMessage() { mkdir -p /etc/root &> /dev/null @@ -32,16 +36,38 @@ function rootMessage() { fi } +#Function to check ratbag dependence +function checkRatbag(){ + dependence="0" + if [ -f "/usr/bin/ratbagctl" ] ; then + dependence="1" + elif [ -f "/bin/ratbagctl" ] ; then + dependence="1" + elif [ -f "/usr/local/bin/ratbagctl" ] ; then + dependence="1" + fi + echo ${dependence} +} + # Show menu with options. showMenu=0 rootMessage while [ ${showMenu} -eq 0 ] ; do clear + # Check dpi & polling rate to show in menu + 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) + numberDPI="(${get_dpi})" + numberPolling="(${get_rate})" + fi opcion=$(zenity --width=280 --height=415 --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" ${imagesPath}/light-off.png "Light off" ${imagesPath}/exit.png "Exit") + ${imagesPath}/mouse-dpi.png "Set DPI ${numberDPI}" ${imagesPath}/light-off.png "Light off" ${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 \ @@ -381,7 +407,11 @@ while [ ${showMenu} -eq 0 ] ; do g203-led.py lightsync dpi ${dpi_number} device_error=$? if [ ${device_error} -eq 0 ] ; then - echo > /dev/null + checkNumbers=$(checkRatbag) + if [ "${checkNumbers}" == "1" ] ; then + device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1) + 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" diff --git a/zenidrv-g203-prodigy b/zenidrv-g203-prodigy index 56a9578..6e743fa 100755 --- a/zenidrv-g203-prodigy +++ b/zenidrv-g203-prodigy @@ -14,6 +14,10 @@ M_DATE="090721" iconPath="/usr/share/icons/logitech/logitech-black.png" imagesPath="/usr/share/icons/logitech/images" +# Variables DPI & Polling rate +numberDPI="" +numberPolling="" + # Function to check admin rights. function rootMessage() { mkdir -p /etc/root &> /dev/null @@ -32,15 +36,37 @@ function rootMessage() { fi } +#Function to check ratbag dependence +function checkRatbag(){ + dependence="0" + if [ -f "/usr/bin/ratbagctl" ] ; then + dependence="1" + elif [ -f "/bin/ratbagctl" ] ; then + dependence="1" + elif [ -f "/usr/local/bin/ratbagctl" ] ; then + dependence="1" + fi + echo ${dependence} +} + # Show menu with options. showMenu=0 rootMessage while [ ${showMenu} -eq 0 ] ; do clear + # Check dpi & polling rate to show in menu + 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) + numberDPI="(${get_dpi})" + numberPolling="(${get_rate})" + fi opcion=$(zenity --width=280 --height=365 --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" \ + "Intro (On)" ${imagesPath}/intro-off.png "Intro (Off)" ${imagesPath}/mouse-dpi.png "Set DPI ${numberDPI}" \ ${imagesPath}/light-off.png "Light off" ${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)" \ @@ -359,7 +385,11 @@ while [ ${showMenu} -eq 0 ] ; do g203-led.py dpi ${dpi_number} device_error=$? if [ ${device_error} -eq 0 ] ; then - echo > /dev/null + checkNumbers=$(checkRatbag) + if [ "${checkNumbers}" == "1" ] ; then + device_name=$(ratbagctl list | head -1 | cut -d ":" -f 1) + 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"