Added translated Spanish version

This commit is contained in:
q3aql 2021-07-19 13:44:56 +02:00
parent 8d6938285a
commit 7ac27ee82f
4 changed files with 914 additions and 0 deletions

44
es-ES/zenidrv-g203 Executable file
View File

@ -0,0 +1,44 @@
#!/bin/bash
#############################################################
# Zenity interface for G203 (Prodigy & Ligthsync) driver #
# Last change: 09-07-2021 #
# Author: q3aql #
# Contact: q3aql@protonmail.ch #
# License: GPL v2.0 #
#############################################################
VERSION="1.2"
M_DATE="090721"
# Variables
iconPath="/usr/share/icons/logitech/logitech-black.png"
# Function to check admin rights
function rootMessage() {
mkdir -p /etc/root &> /dev/null
administrador=$?
if [ ${administrador} -eq 0 ] ; then
rm -rf /etc/root
else
zenity --title "zenidrv-g203 v${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=340 --text "Son requeridos permisos de Administrador"
echo ""
echo "* zenidrv-g203 v${VERSION} (${M_DATE}) (GPL v2.0)"
echo ""
echo "* Son requeridos permisos de Administrador"
echo ""
exit
fi
}
rootMessage
zenity --question --title "zenidrv-g203 ${VERSION} (${M_DATE})" --window-icon=${iconPath} --cancel-label="Prodigy 1r Gen (Por defecto)" --ok-label="Lightsync 2nd Gen" --width=530 \
--text "Elige la version de tu Logitech G203 (Prodigy 1r Gen o Lightsync 2nd Gen)"
createLink=$?
if [ ${createLink} -eq 1 ] ; then
zenidrv-g203-prodigy
else
zenidrv-g203-lightsync
fi

78
es-ES/zenidrv-g203-admin Executable file
View File

@ -0,0 +1,78 @@
#!/bin/bash
#############################################################
# Zenity interface for G203 (Prodigy & Ligthsync) driver #
# Last change: 09-07-2021 #
# Author: q3aql #
# Contact: q3aql@protonmail.ch #
# License: GPL v2.0 #
#############################################################
VERSION="1.2"
M_DATE="090721"
# Variables
iconPath="/usr/share/icons/logitech/logitech-black.png"
# Link with gksudo,gksu o bessu
function showRootMessage() {
if [ -f /usr/bin/gksudo ] ; then
gksudo /usr/bin/zenidrv-g203
exit
elif [ -f /bin/gksudo ] ; then
gksudo /usr/bin/zenidrv-g203
exit
elif [ -f /usr/bin/gksu ] ; then
gksu /usr/bin/zenidrv-g203
exit
elif [ -f /bin/gksu ] ; then
gksu /usr/bin/zenidrv-g203
exit
elif [ -f /usr/bin/beesu ] ; then
beesu /usr/bin/zenidrv-g203
exit
elif [ -f /bin/beesu ] ; then
beesu /usr/bin/zenidrv-g203
exit
elif [ -f /bin/sudo ] ; then
xterm -T "zenidrv-g203 ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "sudo zenidrv-g203"
exit
elif [ -f /usr/bin/sudo ] ; then
xterm -T "zenidrv-g203 ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "sudo zenidrv-g203"
exit
elif [ -f /usr/bin/su ] ; then
xterm -T "zenidrv-g203 ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "su -c 'zenidrv-g203'"
exit
elif [ -f /bin/su ] ; then
xterm -T "zenidrv-g203 ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "su -c 'zenidrv-g203'"
exit
else
zenity -h &> /dev/null
output=$?
if [ ${output} -eq 0 ] ; then
zenity --title "zenidrv-g203 ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info \
--text "El programa 'zenidrv-g203' no pudo ser ejecutado como administrador\n\nPor favor, ejecuta el comando 'zenidrv-g203' como root en tu terminal"
else
xterm -T "zenidrv-g203 ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "zenidrv-g203-admin --error"
fi
fi
}
# Function to show error message
function errorMessage() {
echo ""
echo "* ATTENTION!:"
echo ""
echo "* El programa 'zenidrv-g203' no pudo ser ejecutado como administrador"
echo ""
echo "* Por favor, ejecuta el comando 'zenidrv-g203' como root en tu terminal"
echo ""
echo -n "* Pulsa ENTER para salir... " ; read continue
exit
}
# Startup script
if [ "${1}" == "--error" ] ; then
errorMessage
else
showRootMessage
fi

407
es-ES/zenidrv-g203-lightsync Executable file
View File

@ -0,0 +1,407 @@
#!/bin/bash
#############################################################
# Zenity interface for G203 (Prodigy & Ligthsync) driver #
# Last change: 09-07-2021 #
# Author: q3aql #
# Contact: q3aql@protonmail.ch #
# License: GPL v2.0 #
#############################################################
VERSION="1.2"
M_DATE="090721"
# Variables
iconPath="/usr/share/icons/logitech/logitech-black.png"
imagesPath="/usr/share/icons/logitech/images"
# Function to check admin rights.
function rootMessage() {
mkdir -p /etc/root &> /dev/null
administrador=$?
if [ ${administrador} -eq 0 ] ; then
rm -rf /etc/root
else
zenity --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning \
--width=340 --text "Son requeridos permisos de Administrador"
echo ""
echo "* zenidrv-g203-lightsync ${VERSION} (${M_DATE}) (GPL v2.0)"
echo ""
echo "* Son requeridos permisos de Administrador"
echo ""
exit
fi
}
# Show menu with options.
showMenu=0
rootMessage
while [ ${showMenu} -eq 0 ] ; do
clear
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")
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 \
${imagesPath}/white.png Blanco ${imagesPath}/red.png Rojo ${imagesPath}/lime.png Lima ${imagesPath}/blue.png Azul \
${imagesPath}/yellow.png Amarillo ${imagesPath}/cyan.png Cian ${imagesPath}/magenta.png Magenta \
${imagesPath}/silver.png Plateado ${imagesPath}/gray.png Gris ${imagesPath}/maroon.png Granate \
${imagesPath}/olive.png Olive ${imagesPath}/green.png Verde ${imagesPath}/purple.png Purpura ${imagesPath}/teal.png Cerceta \
${imagesPath}/navy.png Marino)
canceled=$?
if [ ${canceled} -eq 0 ] ; then
if [ "${color_selected}" == "${imagesPath}/custom.png" ] ; then
custom_color=$(zenity --color-selection)
# Crop numbers from rgb system
first_value=$(echo ${custom_color} | cut -d "(" -f 2 | cut -d "," -f 1)
second_value=$(echo ${custom_color} | cut -d "(" -f 2 | cut -d "," -f 2)
third_value_prev=$(echo ${custom_color} | cut -d "(" -f 2 | cut -d "," -f 3)
third_value=$(echo ${third_value_prev} | cut -d ")" -f 1)
# Convert rgb numbers to hex
first_hex=$(echo "obase=16; ${first_value}" | bc)
second_hex=$(echo "obase=16; ${second_value}" | bc)
third_hex=$(echo "obase=16; ${third_value}" | bc)
# Apply number 0 after if have only one number
if [ ${first_hex} == "0" ] ; then
first_hex="00"
elif [ ${first_hex} == "1" ] ; then
first_hex="01"
elif [ ${first_hex} == "2" ] ; then
first_hex="02"
elif [ ${first_hex} == "3" ] ; then
first_hex="03"
elif [ ${first_hex} == "4" ] ; then
first_hex="04"
elif [ ${first_hex} == "5" ] ; then
first_hex="05"
elif [ ${first_hex} == "6" ] ; then
first_hex="06"
elif [ ${first_hex} == "7" ] ; then
first_hex="07"
elif [ ${first_hex} == "8" ] ; then
first_hex="08"
elif [ ${first_hex} == "9" ] ; then
first_hex="09"
fi
if [ ${second_hex} == "0" ] ; then
second_hex="00"
elif [ ${second_hex} == "1" ] ; then
second_hex="01"
elif [ ${second_hex} == "2" ] ; then
second_hex="02"
elif [ ${second_hex} == "3" ] ; then
second_hex="03"
elif [ ${second_hex} == "4" ] ; then
second_hex="04"
elif [ ${second_hex} == "5" ] ; then
second_hex="05"
elif [ ${second_hex} == "6" ] ; then
second_hex="06"
elif [ ${second_hex} == "7" ] ; then
second_hex="07"
elif [ ${second_hex} == "8" ] ; then
second_hex="08"
elif [ ${second_hex} == "9" ] ; then
second_hex="09"
fi
if [ ${third_hex} == "0" ] ; then
third_hex="00"
elif [ ${third_hex} == "1" ] ; then
third_hex="01"
elif [ ${third_hex} == "2" ] ; then
third_hex="02"
elif [ ${third_hex} == "3" ] ; then
third_hex="03"
elif [ ${third_hex} == "4" ] ; then
third_hex="04"
elif [ ${third_hex} == "5" ] ; then
third_hex="05"
elif [ ${third_hex} == "6" ] ; then
third_hex="06"
elif [ ${third_hex} == "7" ] ; then
third_hex="07"
elif [ ${third_hex} == "8" ] ; then
third_hex="08"
elif [ ${third_hex} == "9" ] ; then
third_hex="09"
fi
# Custom color in hex
color_custom=$(echo ${first_hex}${second_hex}${third_hex})
color_apply="${color_custom}"
elif [ "${color_selected}" == "${imagesPath}/white.png" ] ; then
color_apply="FFFFFF"
elif [ "${color_selected}" == "${imagesPath}/red.png" ] ; then
color_apply="FF0000"
elif [ "${color_selected}" == "${imagesPath}/lime.png" ] ; then
color_apply="00FF00"
elif [ "${color_selected}" == "${imagesPath}/blue.png" ] ; then
color_apply="0000FF"
elif [ "${color_selected}" == "${imagesPath}/yellow.png" ] ; then
color_apply="FFFF00"
elif [ "${color_selected}" == "${imagesPath}/cyan.png" ] ; then
color_apply="00FFFF"
elif [ "${color_selected}" == "${imagesPath}/magenta.png" ] ; then
color_apply="FF00FF"
elif [ "${color_selected}" == "${imagesPath}/silver.png" ] ; then
color_apply="C0C0C0"
elif [ "${color_selected}" == "${imagesPath}/gray.png" ] ; then
color_apply="808080"
elif [ "${color_selected}" == "${imagesPath}/maroon.png" ] ; then
color_apply="800000"
elif [ "${color_selected}" == "${imagesPath}/olive.png" ] ; then
color_apply="808000"
elif [ "${color_selected}" == "${imagesPath}/green.png" ] ; then
color_apply="008000"
elif [ "${color_selected}" == "${imagesPath}/purple.png" ] ; then
color_apply="800080"
elif [ "${color_selected}" == "${imagesPath}/teal.png" ] ; then
color_apply="008080"
elif [ "${color_selected}" == "${imagesPath}/navy.png" ] ; then
color_apply="000080"
fi
if [ -z "${color_apply}" ] ; then
color_apply="none"
else
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Aplicando efecto solido" \
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
g203-led.py lightsync solid "${color_apply}"
device_error=$?
if [ ${device_error} -eq 0 ] ; then
echo > /dev/null
else
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
--text "Dispositivo no encontrado o conectado"
fi
color_apply="none"
fi
else
color_apply="none"
fi
elif [ "${opcion}" == "${imagesPath}/cycle.png" ] ; then
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Aplicando efecto ciclo" \
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
g203-led.py lightsync cycle
device_error=$?
if [ ${device_error} -eq 0 ] ; then
echo > /dev/null
else
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
--text "Dispositivo no encontrado o conectado"
fi
elif [ "${opcion}" == "${imagesPath}/breathe.png" ] ; then
color_selected=$(zenity --list --width=260 --height=565 --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" \
--window-icon=${iconPath} --imagelist --column "Color" --column "Nombre color" ${imagesPath}/custom.png Personalizado \
${imagesPath}/white.png Blanco ${imagesPath}/red.png Rojo ${imagesPath}/lime.png Lima ${imagesPath}/blue.png Azul \
${imagesPath}/yellow.png Amarillo ${imagesPath}/cyan.png Cian ${imagesPath}/magenta.png Magenta \
${imagesPath}/silver.png Plateado ${imagesPath}/gray.png Gris ${imagesPath}/maroon.png Granate \
${imagesPath}/olive.png Olive ${imagesPath}/green.png Verde ${imagesPath}/purple.png Purpura ${imagesPath}/teal.png Cerceta \
${imagesPath}/navy.png Marino)
canceled=$?
if [ ${canceled} -eq 0 ] ; then
if [ "${color_selected}" == "${imagesPath}/custom.png" ] ; then
custom_color=$(zenity --color-selection)
# Crop numbers from rgb system
first_value=$(echo ${custom_color} | cut -d "(" -f 2 | cut -d "," -f 1)
second_value=$(echo ${custom_color} | cut -d "(" -f 2 | cut -d "," -f 2)
third_value_prev=$(echo ${custom_color} | cut -d "(" -f 2 | cut -d "," -f 3)
third_value=$(echo ${third_value_prev} | cut -d ")" -f 1)
# Convert rgb numbers to hex
first_hex=$(echo "obase=16; ${first_value}" | bc)
second_hex=$(echo "obase=16; ${second_value}" | bc)
third_hex=$(echo "obase=16; ${third_value}" | bc)
# Apply number 0 after if have only one number
if [ ${first_hex} == "0" ] ; then
first_hex="00"
elif [ ${first_hex} == "1" ] ; then
first_hex="01"
elif [ ${first_hex} == "2" ] ; then
first_hex="02"
elif [ ${first_hex} == "3" ] ; then
first_hex="03"
elif [ ${first_hex} == "4" ] ; then
first_hex="04"
elif [ ${first_hex} == "5" ] ; then
first_hex="05"
elif [ ${first_hex} == "6" ] ; then
first_hex="06"
elif [ ${first_hex} == "7" ] ; then
first_hex="07"
elif [ ${first_hex} == "8" ] ; then
first_hex="08"
elif [ ${first_hex} == "9" ] ; then
first_hex="09"
fi
if [ ${second_hex} == "0" ] ; then
second_hex="00"
elif [ ${second_hex} == "1" ] ; then
second_hex="01"
elif [ ${second_hex} == "2" ] ; then
second_hex="02"
elif [ ${second_hex} == "3" ] ; then
second_hex="03"
elif [ ${second_hex} == "4" ] ; then
second_hex="04"
elif [ ${second_hex} == "5" ] ; then
second_hex="05"
elif [ ${second_hex} == "6" ] ; then
second_hex="06"
elif [ ${second_hex} == "7" ] ; then
second_hex="07"
elif [ ${second_hex} == "8" ] ; then
second_hex="08"
elif [ ${second_hex} == "9" ] ; then
second_hex="09"
fi
if [ ${third_hex} == "0" ] ; then
third_hex="00"
elif [ ${third_hex} == "1" ] ; then
third_hex="01"
elif [ ${third_hex} == "2" ] ; then
third_hex="02"
elif [ ${third_hex} == "3" ] ; then
third_hex="03"
elif [ ${third_hex} == "4" ] ; then
third_hex="04"
elif [ ${third_hex} == "5" ] ; then
third_hex="05"
elif [ ${third_hex} == "6" ] ; then
third_hex="06"
elif [ ${third_hex} == "7" ] ; then
third_hex="07"
elif [ ${third_hex} == "8" ] ; then
third_hex="08"
elif [ ${third_hex} == "9" ] ; then
third_hex="09"
fi
# Custom color in hex
color_custom=$(echo ${first_hex}${second_hex}${third_hex})
color_apply="${color_custom}"
elif [ "${color_selected}" == "${imagesPath}/white.png" ] ; then
color_apply="FFFFFF"
elif [ "${color_selected}" == "${imagesPath}/red.png" ] ; then
color_apply="FF0000"
elif [ "${color_selected}" == "${imagesPath}/lime.png" ] ; then
color_apply="00FF00"
elif [ "${color_selected}" == "${imagesPath}/blue.png" ] ; then
color_apply="0000FF"
elif [ "${color_selected}" == "${imagesPath}/yellow.png" ] ; then
color_apply="FFFF00"
elif [ "${color_selected}" == "${imagesPath}/cyan.png" ] ; then
color_apply="00FFFF"
elif [ "${color_selected}" == "${imagesPath}/magenta.png" ] ; then
color_apply="FF00FF"
elif [ "${color_selected}" == "${imagesPath}/silver.png" ] ; then
color_apply="C0C0C0"
elif [ "${color_selected}" == "${imagesPath}/gray.png" ] ; then
color_apply="808080"
elif [ "${color_selected}" == "${imagesPath}/maroon.png" ] ; then
color_apply="800000"
elif [ "${color_selected}" == "${imagesPath}/olive.png" ] ; then
color_apply="808000"
elif [ "${color_selected}" == "${imagesPath}/green.png" ] ; then
color_apply="008000"
elif [ "${color_selected}" == "${imagesPath}/purple.png" ] ; then
color_apply="800080"
elif [ "${color_selected}" == "${imagesPath}/teal.png" ] ; then
color_apply="008080"
elif [ "${color_selected}" == "${imagesPath}/navy.png" ] ; then
color_apply="000080"
fi
if [ -z "${color_apply}" ] ; then
color_apply="none"
else
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Aplicando efecto respiracion" \
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
g203-led.py lightsync breathe "${color_apply}"
device_error=$?
if [ ${device_error} -eq 0 ] ; then
echo > /dev/null
else
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
--text "Dispositivo no encontrado o conectado"
fi
color_apply="none"
fi
else
color_apply="none"
fi
elif [ "${opcion}" == "${imagesPath}/wave.png" ] ; then
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Aplicando efecto ola" \
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
g203-led.py lightsync wave
device_error=$?
if [ ${device_error} -eq 0 ] ; then
echo > /dev/null
else
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
--text "Dispositivo no encontrado o conectado"
fi
elif [ "${opcion}" == "${imagesPath}/blend.png" ] ; then
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Aplicando efecto mezcla" \
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
g203-led.py lightsync blend
device_error=$?
if [ ${device_error} -eq 0 ] ; then
echo > /dev/null
else
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
--text "Dispositivo no encontrado o conectado"
fi
elif [ "${opcion}" == "${imagesPath}/intro-on.png" ] ; then
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Activando efecto de arranque" \
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
g203-led.py lightsync intro on
device_error=$?
if [ ${device_error} -eq 0 ] ; then
echo > /dev/null
else
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
--text "Dispositivo no encontrado o conectado"
fi
elif [ "${opcion}" == "${imagesPath}/intro-off.png" ] ; then
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Desactivando efecto de arranque" \
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
g203-led.py lightsync intro off
device_error=$?
if [ ${device_error} -eq 0 ] ; then
echo > /dev/null
else
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
--text "Dispositivo no encontrado o conectado"
fi
elif [ "${opcion}" == "${imagesPath}/mouse-dpi.png" ] ; then
dpi_number=$(zenity --entry --title "Set DPI (from 50 to 8000)" --window-icon=${iconPath} --text "Introduce el numero de DPI (desde 50 hasta 8000):" --entry-text "800")
if [ -z ${dpi_number} ] ; then
echo > /dev/null
else
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Configurando DPI a ${dpi_number}" \
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
g203-led.py lightsync dpi ${dpi_number}
device_error=$?
if [ ${device_error} -eq 0 ] ; then
echo > /dev/null
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}/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
g203-led.py lightsync breathe 000000 1000 0
device_error=$?
if [ ${device_error} -eq 0 ] ; then
echo > /dev/null
else
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
--text "Dispositivo no encontrado o conectado"
fi
elif [ "${opcion}" == "${imagesPath}/exit.png" ] ; then
showMenu=1
else
zenity --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning \
--width=300 --text "Elige una de las opciones del menu"
fi
done

385
es-ES/zenidrv-g203-prodigy Executable file
View File

@ -0,0 +1,385 @@
#!/bin/bash
#############################################################
# Zenity interface for G203 (Prodigy & Ligthsync) driver #
# Last change: 09-07-2021 #
# Author: q3aql #
# Contact: q3aql@protonmail.ch #
# License: GPL v2.0 #
#############################################################
VERSION="1.2"
M_DATE="090721"
# Variables
iconPath="/usr/share/icons/logitech/logitech-black.png"
imagesPath="/usr/share/icons/logitech/images"
# Function to check admin rights.
function rootMessage() {
mkdir -p /etc/root &> /dev/null
administrador=$?
if [ ${administrador} -eq 0 ] ; then
rm -rf /etc/root
else
zenity --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning \
--width=340 --text "Son requeridos permisos de Administrador"
echo ""
echo "* zenidrv-g203-prodigy ${VERSION} (${M_DATE}) (GPL v2.0)"
echo ""
echo "* Son requeridos permisos de Administrador"
echo ""
exit
fi
}
# Show menu with options.
showMenu=0
rootMessage
while [ ${showMenu} -eq 0 ] ; do
clear
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" \
${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)" \
--window-icon=${iconPath} --imagelist --column "Color" --column "Nombre color" ${imagesPath}/custom.png Personalizado \
${imagesPath}/white.png Blanco ${imagesPath}/red.png Rojo ${imagesPath}/lime.png Lima ${imagesPath}/blue.png Azul \
${imagesPath}/yellow.png Amarillo ${imagesPath}/cyan.png Cian ${imagesPath}/magenta.png Magenta \
${imagesPath}/silver.png Plateado ${imagesPath}/gray.png Gris ${imagesPath}/maroon.png Granate \
${imagesPath}/olive.png Olive ${imagesPath}/green.png Verde ${imagesPath}/purple.png Purpura ${imagesPath}/teal.png Cerceta \
${imagesPath}/navy.png Marino)
canceled=$?
if [ ${canceled} -eq 0 ] ; then
if [ "${color_selected}" == "${imagesPath}/custom.png" ] ; then
custom_color=$(zenity --color-selection)
# Crop numbers from rgb system
first_value=$(echo ${custom_color} | cut -d "(" -f 2 | cut -d "," -f 1)
second_value=$(echo ${custom_color} | cut -d "(" -f 2 | cut -d "," -f 2)
third_value_prev=$(echo ${custom_color} | cut -d "(" -f 2 | cut -d "," -f 3)
third_value=$(echo ${third_value_prev} | cut -d ")" -f 1)
# Convert rgb numbers to hex
first_hex=$(echo "obase=16; ${first_value}" | bc)
second_hex=$(echo "obase=16; ${second_value}" | bc)
third_hex=$(echo "obase=16; ${third_value}" | bc)
# Apply number 0 after if have only one number
if [ ${first_hex} == "0" ] ; then
first_hex="00"
elif [ ${first_hex} == "1" ] ; then
first_hex="01"
elif [ ${first_hex} == "2" ] ; then
first_hex="02"
elif [ ${first_hex} == "3" ] ; then
first_hex="03"
elif [ ${first_hex} == "4" ] ; then
first_hex="04"
elif [ ${first_hex} == "5" ] ; then
first_hex="05"
elif [ ${first_hex} == "6" ] ; then
first_hex="06"
elif [ ${first_hex} == "7" ] ; then
first_hex="07"
elif [ ${first_hex} == "8" ] ; then
first_hex="08"
elif [ ${first_hex} == "9" ] ; then
first_hex="09"
fi
if [ ${second_hex} == "0" ] ; then
second_hex="00"
elif [ ${second_hex} == "1" ] ; then
second_hex="01"
elif [ ${second_hex} == "2" ] ; then
second_hex="02"
elif [ ${second_hex} == "3" ] ; then
second_hex="03"
elif [ ${second_hex} == "4" ] ; then
second_hex="04"
elif [ ${second_hex} == "5" ] ; then
second_hex="05"
elif [ ${second_hex} == "6" ] ; then
second_hex="06"
elif [ ${second_hex} == "7" ] ; then
second_hex="07"
elif [ ${second_hex} == "8" ] ; then
second_hex="08"
elif [ ${second_hex} == "9" ] ; then
second_hex="09"
fi
if [ ${third_hex} == "0" ] ; then
third_hex="00"
elif [ ${third_hex} == "1" ] ; then
third_hex="01"
elif [ ${third_hex} == "2" ] ; then
third_hex="02"
elif [ ${third_hex} == "3" ] ; then
third_hex="03"
elif [ ${third_hex} == "4" ] ; then
third_hex="04"
elif [ ${third_hex} == "5" ] ; then
third_hex="05"
elif [ ${third_hex} == "6" ] ; then
third_hex="06"
elif [ ${third_hex} == "7" ] ; then
third_hex="07"
elif [ ${third_hex} == "8" ] ; then
third_hex="08"
elif [ ${third_hex} == "9" ] ; then
third_hex="09"
fi
# Custom color in hex
color_custom=$(echo ${first_hex}${second_hex}${third_hex})
color_apply="${color_custom}"
elif [ "${color_selected}" == "${imagesPath}/white.png" ] ; then
color_apply="FFFFFF"
elif [ "${color_selected}" == "${imagesPath}/red.png" ] ; then
color_apply="FF0000"
elif [ "${color_selected}" == "${imagesPath}/lime.png" ] ; then
color_apply="00FF00"
elif [ "${color_selected}" == "${imagesPath}/blue.png" ] ; then
color_apply="0000FF"
elif [ "${color_selected}" == "${imagesPath}/yellow.png" ] ; then
color_apply="FFFF00"
elif [ "${color_selected}" == "${imagesPath}/cyan.png" ] ; then
color_apply="00FFFF"
elif [ "${color_selected}" == "${imagesPath}/magenta.png" ] ; then
color_apply="FF00FF"
elif [ "${color_selected}" == "${imagesPath}/silver.png" ] ; then
color_apply="C0C0C0"
elif [ "${color_selected}" == "${imagesPath}/gray.png" ] ; then
color_apply="808080"
elif [ "${color_selected}" == "${imagesPath}/maroon.png" ] ; then
color_apply="800000"
elif [ "${color_selected}" == "${imagesPath}/olive.png" ] ; then
color_apply="808000"
elif [ "${color_selected}" == "${imagesPath}/green.png" ] ; then
color_apply="008000"
elif [ "${color_selected}" == "${imagesPath}/purple.png" ] ; then
color_apply="800080"
elif [ "${color_selected}" == "${imagesPath}/teal.png" ] ; then
color_apply="008080"
elif [ "${color_selected}" == "${imagesPath}/navy.png" ] ; then
color_apply="000080"
fi
if [ -z "${color_apply}" ] ; then
color_apply="none"
else
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Aplicando efecto solido" \
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
g203-led.py solid "${color_apply}"
device_error=$?
if [ ${device_error} -eq 0 ] ; then
echo > /dev/null
else
zenity --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
--text "Dispositivo no encontrado o conectado"
fi
color_apply="none"
fi
else
color_apply="none"
fi
elif [ "${opcion}" == "${imagesPath}/cycle.png" ] ; then
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Aplicando efecto ciclo" \
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
g203-led.py cycle
device_error=$?
if [ ${device_error} -eq 0 ] ; then
echo > /dev/null
else
zenity --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
--text "Dispositivo no encontrado o conectado"
fi
elif [ "${opcion}" == "${imagesPath}/breathe.png" ] ; then
color_selected=$(zenity --list --width=260 --height=565 --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" \
--window-icon=${iconPath} --imagelist --column "Color" --column "Nombre color" ${imagesPath}/custom.png Personalizado \
${imagesPath}/white.png Blanco ${imagesPath}/red.png Rojo ${imagesPath}/lime.png Lima ${imagesPath}/blue.png Azul \
${imagesPath}/yellow.png Amarillo ${imagesPath}/cyan.png Cian ${imagesPath}/magenta.png Magenta \
${imagesPath}/silver.png Plateado ${imagesPath}/gray.png Gris ${imagesPath}/maroon.png Granate \
${imagesPath}/olive.png Olive ${imagesPath}/green.png Verde ${imagesPath}/purple.png Purpura ${imagesPath}/teal.png Cerceta \
${imagesPath}/navy.png Marino)
canceled=$?
if [ ${canceled} -eq 0 ] ; then
if [ "${color_selected}" == "${imagesPath}/custom.png" ] ; then
custom_color=$(zenity --color-selection)
# Crop numbers from rgb system
first_value=$(echo ${custom_color} | cut -d "(" -f 2 | cut -d "," -f 1)
second_value=$(echo ${custom_color} | cut -d "(" -f 2 | cut -d "," -f 2)
third_value_prev=$(echo ${custom_color} | cut -d "(" -f 2 | cut -d "," -f 3)
third_value=$(echo ${third_value_prev} | cut -d ")" -f 1)
# Convert rgb numbers to hex
first_hex=$(echo "obase=16; ${first_value}" | bc)
second_hex=$(echo "obase=16; ${second_value}" | bc)
third_hex=$(echo "obase=16; ${third_value}" | bc)
# Apply number 0 after if have only one number
if [ ${first_hex} == "0" ] ; then
first_hex="00"
elif [ ${first_hex} == "1" ] ; then
first_hex="01"
elif [ ${first_hex} == "2" ] ; then
first_hex="02"
elif [ ${first_hex} == "3" ] ; then
first_hex="03"
elif [ ${first_hex} == "4" ] ; then
first_hex="04"
elif [ ${first_hex} == "5" ] ; then
first_hex="05"
elif [ ${first_hex} == "6" ] ; then
first_hex="06"
elif [ ${first_hex} == "7" ] ; then
first_hex="07"
elif [ ${first_hex} == "8" ] ; then
first_hex="08"
elif [ ${first_hex} == "9" ] ; then
first_hex="09"
fi
if [ ${second_hex} == "0" ] ; then
second_hex="00"
elif [ ${second_hex} == "1" ] ; then
second_hex="01"
elif [ ${second_hex} == "2" ] ; then
second_hex="02"
elif [ ${second_hex} == "3" ] ; then
second_hex="03"
elif [ ${second_hex} == "4" ] ; then
second_hex="04"
elif [ ${second_hex} == "5" ] ; then
second_hex="05"
elif [ ${second_hex} == "6" ] ; then
second_hex="06"
elif [ ${second_hex} == "7" ] ; then
second_hex="07"
elif [ ${second_hex} == "8" ] ; then
second_hex="08"
elif [ ${second_hex} == "9" ] ; then
second_hex="09"
fi
if [ ${third_hex} == "0" ] ; then
third_hex="00"
elif [ ${third_hex} == "1" ] ; then
third_hex="01"
elif [ ${third_hex} == "2" ] ; then
third_hex="02"
elif [ ${third_hex} == "3" ] ; then
third_hex="03"
elif [ ${third_hex} == "4" ] ; then
third_hex="04"
elif [ ${third_hex} == "5" ] ; then
third_hex="05"
elif [ ${third_hex} == "6" ] ; then
third_hex="06"
elif [ ${third_hex} == "7" ] ; then
third_hex="07"
elif [ ${third_hex} == "8" ] ; then
third_hex="08"
elif [ ${third_hex} == "9" ] ; then
third_hex="09"
fi
# Custom color in hex
color_custom=$(echo ${first_hex}${second_hex}${third_hex})
color_apply="${color_custom}"
elif [ "${color_selected}" == "${imagesPath}/white.png" ] ; then
color_apply="FFFFFF"
elif [ "${color_selected}" == "${imagesPath}/red.png" ] ; then
color_apply="FF0000"
elif [ "${color_selected}" == "${imagesPath}/lime.png" ] ; then
color_apply="00FF00"
elif [ "${color_selected}" == "${imagesPath}/blue.png" ] ; then
color_apply="0000FF"
elif [ "${color_selected}" == "${imagesPath}/yellow.png" ] ; then
color_apply="FFFF00"
elif [ "${color_selected}" == "${imagesPath}/cyan.png" ] ; then
color_apply="00FFFF"
elif [ "${color_selected}" == "${imagesPath}/magenta.png" ] ; then
color_apply="FF00FF"
elif [ "${color_selected}" == "${imagesPath}/silver.png" ] ; then
color_apply="C0C0C0"
elif [ "${color_selected}" == "${imagesPath}/gray.png" ] ; then
color_apply="808080"
elif [ "${color_selected}" == "${imagesPath}/maroon.png" ] ; then
color_apply="800000"
elif [ "${color_selected}" == "${imagesPath}/olive.png" ] ; then
color_apply="808000"
elif [ "${color_selected}" == "${imagesPath}/green.png" ] ; then
color_apply="008000"
elif [ "${color_selected}" == "${imagesPath}/purple.png" ] ; then
color_apply="800080"
elif [ "${color_selected}" == "${imagesPath}/teal.png" ] ; then
color_apply="008080"
elif [ "${color_selected}" == "${imagesPath}/navy.png" ] ; then
color_apply="000080"
fi
if [ -z "${color_apply}" ] ; then
color_apply="none"
else
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Aplicando efecto respiracion" \
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
g203-led.py breathe "${color_apply}"
device_error=$?
if [ ${device_error} -eq 0 ] ; then
echo > /dev/null
else
zenity --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
--text "Dispositivo no encontrado o conectado"
fi
color_apply="none"
fi
else
color_apply="none"
fi
elif [ "${opcion}" == "${imagesPath}/intro-on.png" ] ; then
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Activando efecto de arranque" \
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
g203-led.py intro on
device_error=$?
if [ ${device_error} -eq 0 ] ; then
echo > /dev/null
else
zenity --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
--text "Dispositivo no encontrado o conectado"
fi
elif [ "${opcion}" == "${imagesPath}/intro-off.png" ] ; then
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Desactivando efecto de arranque" \
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
g203-led.py intro off
device_error=$?
if [ ${device_error} -eq 0 ] ; then
echo > /dev/null
else
zenity --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
--text "Dispositivo no encontrado o conectado"
fi
elif [ "${opcion}" == "${imagesPath}/mouse-dpi.png" ] ; then
dpi_number=$(zenity --entry --title "Set DPI (from 200 to 8000)" --window-icon=${iconPath} --text "Introduce el numero de DPI (desde 200 hasta 8000):" --entry-text "800")
if [ -z ${dpi_number} ] ; then
echo > /dev/null
else
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Configurando DPI a ${dpi_number}" \
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
g203-led.py dpi ${dpi_number}
device_error=$?
if [ ${device_error} -eq 0 ] ; then
echo > /dev/null
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}/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
g203-led.py breathe 000000 1000 0
device_error=$?
if [ ${device_error} -eq 0 ] ; then
echo > /dev/null
else
zenity --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
--text "Dispositivo no encontrado o conectado"
fi
elif [ "${opcion}" == "${imagesPath}/exit.png" ] ; then
showMenu=1
else
zenity --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning \
--width=300 --text "Elige una de las opciones del menu"
fi
done