Add custom color selection
This commit is contained in:
parent
697d6ccfcd
commit
fb8c1380e3
BIN
images/custom.png
Normal file
BIN
images/custom.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
|
@ -44,7 +44,7 @@ while [ ${showMenu} -eq 0 ] ; do
|
||||||
${imagesPath}/mouse-dpi.png "Set DPI" ${imagesPath}/light-off.png "Light off" ${imagesPath}/exit.png "Exit")
|
${imagesPath}/mouse-dpi.png "Set DPI" ${imagesPath}/light-off.png "Light off" ${imagesPath}/exit.png "Exit")
|
||||||
if [ "${opcion}" == "${imagesPath}/solid.png" ] ; then
|
if [ "${opcion}" == "${imagesPath}/solid.png" ] ; then
|
||||||
color_selected=$(zenity --list --width=260 --height=570 --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" \
|
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}/black.png Black \
|
--window-icon=${iconPath} --imagelist --column "Color" --column "Name color" ${imagesPath}/custom.png Custom \
|
||||||
${imagesPath}/white.png White ${imagesPath}/red.png Red ${imagesPath}/lime.png Lime ${imagesPath}/blue.png Blue \
|
${imagesPath}/white.png White ${imagesPath}/red.png Red ${imagesPath}/lime.png Lime ${imagesPath}/blue.png Blue \
|
||||||
${imagesPath}/yellow.png Yellow ${imagesPath}/cyan.png Cyan ${imagesPath}/magenta.png Magenta \
|
${imagesPath}/yellow.png Yellow ${imagesPath}/cyan.png Cyan ${imagesPath}/magenta.png Magenta \
|
||||||
${imagesPath}/silver.png Silver ${imagesPath}/gray.png Gray ${imagesPath}/maroon.png Maroon \
|
${imagesPath}/silver.png Silver ${imagesPath}/gray.png Gray ${imagesPath}/maroon.png Maroon \
|
||||||
|
@ -52,8 +52,84 @@ while [ ${showMenu} -eq 0 ] ; do
|
||||||
${imagesPath}/navy.png Navy)
|
${imagesPath}/navy.png Navy)
|
||||||
canceled=$?
|
canceled=$?
|
||||||
if [ ${canceled} -eq 0 ] ; then
|
if [ ${canceled} -eq 0 ] ; then
|
||||||
if [ "${color_selected}" == "${imagesPath}/black.png" ] ; then
|
if [ "${color_selected}" == "${imagesPath}/custom.png" ] ; then
|
||||||
color_apply="000000"
|
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
|
elif [ "${color_selected}" == "${imagesPath}/white.png" ] ; then
|
||||||
color_apply="FFFFFF"
|
color_apply="FFFFFF"
|
||||||
elif [ "${color_selected}" == "${imagesPath}/red.png" ] ; then
|
elif [ "${color_selected}" == "${imagesPath}/red.png" ] ; then
|
||||||
|
@ -85,17 +161,21 @@ while [ ${showMenu} -eq 0 ] ; do
|
||||||
elif [ "${color_selected}" == "${imagesPath}/navy.png" ] ; then
|
elif [ "${color_selected}" == "${imagesPath}/navy.png" ] ; then
|
||||||
color_apply="000080"
|
color_apply="000080"
|
||||||
fi
|
fi
|
||||||
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Applying Solid effect" \
|
if [ -z "${color_apply}" ] ; then
|
||||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
color_apply="none"
|
||||||
g203-led.py lightsync solid "${color_apply}"
|
|
||||||
device_error=$?
|
|
||||||
if [ ${device_error} -eq 0 ] ; then
|
|
||||||
echo > /dev/null
|
|
||||||
else
|
else
|
||||||
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
|
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Applying Solid effect" \
|
||||||
--text "Device not found or connected"
|
--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 "Device not found or connected"
|
||||||
|
fi
|
||||||
|
color_apply="none"
|
||||||
fi
|
fi
|
||||||
color_apply="none"
|
|
||||||
else
|
else
|
||||||
color_apply="none"
|
color_apply="none"
|
||||||
fi
|
fi
|
||||||
|
@ -112,7 +192,7 @@ while [ ${showMenu} -eq 0 ] ; do
|
||||||
fi
|
fi
|
||||||
elif [ "${opcion}" == "${imagesPath}/breathe.png" ] ; then
|
elif [ "${opcion}" == "${imagesPath}/breathe.png" ] ; then
|
||||||
color_selected=$(zenity --list --width=260 --height=565 --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" \
|
color_selected=$(zenity --list --width=260 --height=565 --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" \
|
||||||
--window-icon=${iconPath} --imagelist --column "Color" --column "Name color" ${imagesPath}/black.png Black \
|
--window-icon=${iconPath} --imagelist --column "Color" --column "Name color" ${imagesPath}/custom.png Custom \
|
||||||
${imagesPath}/white.png White ${imagesPath}/red.png Red ${imagesPath}/lime.png Lime ${imagesPath}/blue.png Blue \
|
${imagesPath}/white.png White ${imagesPath}/red.png Red ${imagesPath}/lime.png Lime ${imagesPath}/blue.png Blue \
|
||||||
${imagesPath}/yellow.png Yellow ${imagesPath}/cyan.png Cyan ${imagesPath}/magenta.png Magenta \
|
${imagesPath}/yellow.png Yellow ${imagesPath}/cyan.png Cyan ${imagesPath}/magenta.png Magenta \
|
||||||
${imagesPath}/silver.png Silver ${imagesPath}/gray.png Gray ${imagesPath}/maroon.png Maroon \
|
${imagesPath}/silver.png Silver ${imagesPath}/gray.png Gray ${imagesPath}/maroon.png Maroon \
|
||||||
|
@ -120,8 +200,84 @@ while [ ${showMenu} -eq 0 ] ; do
|
||||||
${imagesPath}/navy.png Navy)
|
${imagesPath}/navy.png Navy)
|
||||||
canceled=$?
|
canceled=$?
|
||||||
if [ ${canceled} -eq 0 ] ; then
|
if [ ${canceled} -eq 0 ] ; then
|
||||||
if [ "${color_selected}" == "${imagesPath}/black.png" ] ; then
|
if [ "${color_selected}" == "${imagesPath}/custom.png" ] ; then
|
||||||
color_apply="000000"
|
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
|
elif [ "${color_selected}" == "${imagesPath}/white.png" ] ; then
|
||||||
color_apply="FFFFFF"
|
color_apply="FFFFFF"
|
||||||
elif [ "${color_selected}" == "${imagesPath}/red.png" ] ; then
|
elif [ "${color_selected}" == "${imagesPath}/red.png" ] ; then
|
||||||
|
@ -153,17 +309,21 @@ while [ ${showMenu} -eq 0 ] ; do
|
||||||
elif [ "${color_selected}" == "${imagesPath}/navy.png" ] ; then
|
elif [ "${color_selected}" == "${imagesPath}/navy.png" ] ; then
|
||||||
color_apply="000080"
|
color_apply="000080"
|
||||||
fi
|
fi
|
||||||
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Applying Breathe effect" \
|
if [ -z "${color_apply}" ] ; then
|
||||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
color_apply="none"
|
||||||
g203-led.py lightsync breathe "${color_apply}"
|
|
||||||
device_error=$?
|
|
||||||
if [ ${device_error} -eq 0 ] ; then
|
|
||||||
echo > /dev/null
|
|
||||||
else
|
else
|
||||||
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
|
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Applying Breathe effect" \
|
||||||
--text "Device not found or connected"
|
--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 "Device not found or connected"
|
||||||
|
fi
|
||||||
|
color_apply="none"
|
||||||
fi
|
fi
|
||||||
color_apply="none"
|
|
||||||
else
|
else
|
||||||
color_apply="none"
|
color_apply="none"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -44,7 +44,7 @@ while [ ${showMenu} -eq 0 ] ; do
|
||||||
${imagesPath}/light-off.png "Light off" ${imagesPath}/exit.png "Exit")
|
${imagesPath}/light-off.png "Light off" ${imagesPath}/exit.png "Exit")
|
||||||
if [ "${opcion}" == "${imagesPath}/solid.png" ] ; then
|
if [ "${opcion}" == "${imagesPath}/solid.png" ] ; then
|
||||||
color_selected=$(zenity --list --width=260 --height=570 --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" \
|
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}/black.png Black \
|
--window-icon=${iconPath} --imagelist --column "Color" --column "Name color" ${imagesPath}/custom.png Custom \
|
||||||
${imagesPath}/white.png White ${imagesPath}/red.png Red ${imagesPath}/lime.png Lime ${imagesPath}/blue.png Blue \
|
${imagesPath}/white.png White ${imagesPath}/red.png Red ${imagesPath}/lime.png Lime ${imagesPath}/blue.png Blue \
|
||||||
${imagesPath}/yellow.png Yellow ${imagesPath}/cyan.png Cyan ${imagesPath}/magenta.png Magenta \
|
${imagesPath}/yellow.png Yellow ${imagesPath}/cyan.png Cyan ${imagesPath}/magenta.png Magenta \
|
||||||
${imagesPath}/silver.png Silver ${imagesPath}/gray.png Gray ${imagesPath}/maroon.png Maroon \
|
${imagesPath}/silver.png Silver ${imagesPath}/gray.png Gray ${imagesPath}/maroon.png Maroon \
|
||||||
|
@ -52,8 +52,84 @@ while [ ${showMenu} -eq 0 ] ; do
|
||||||
${imagesPath}/navy.png Navy)
|
${imagesPath}/navy.png Navy)
|
||||||
canceled=$?
|
canceled=$?
|
||||||
if [ ${canceled} -eq 0 ] ; then
|
if [ ${canceled} -eq 0 ] ; then
|
||||||
if [ "${color_selected}" == "${imagesPath}/black.png" ] ; then
|
if [ "${color_selected}" == "${imagesPath}/custom.png" ] ; then
|
||||||
color_apply="000000"
|
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
|
elif [ "${color_selected}" == "${imagesPath}/white.png" ] ; then
|
||||||
color_apply="FFFFFF"
|
color_apply="FFFFFF"
|
||||||
elif [ "${color_selected}" == "${imagesPath}/red.png" ] ; then
|
elif [ "${color_selected}" == "${imagesPath}/red.png" ] ; then
|
||||||
|
@ -85,17 +161,21 @@ while [ ${showMenu} -eq 0 ] ; do
|
||||||
elif [ "${color_selected}" == "${imagesPath}/navy.png" ] ; then
|
elif [ "${color_selected}" == "${imagesPath}/navy.png" ] ; then
|
||||||
color_apply="000080"
|
color_apply="000080"
|
||||||
fi
|
fi
|
||||||
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Applying Solid effect" \
|
if [ -z "${color_apply}" ] ; then
|
||||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
color_apply="none"
|
||||||
g203-led.py solid "${color_apply}"
|
|
||||||
device_error=$?
|
|
||||||
if [ ${device_error} -eq 0 ] ; then
|
|
||||||
echo > /dev/null
|
|
||||||
else
|
else
|
||||||
zenity --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
|
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Applying Solid effect" \
|
||||||
--text "Device not found or connected"
|
--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 "Device not found or connected"
|
||||||
|
fi
|
||||||
|
color_apply="none"
|
||||||
fi
|
fi
|
||||||
color_apply="none"
|
|
||||||
else
|
else
|
||||||
color_apply="none"
|
color_apply="none"
|
||||||
fi
|
fi
|
||||||
|
@ -112,7 +192,7 @@ while [ ${showMenu} -eq 0 ] ; do
|
||||||
fi
|
fi
|
||||||
elif [ "${opcion}" == "${imagesPath}/breathe.png" ] ; then
|
elif [ "${opcion}" == "${imagesPath}/breathe.png" ] ; then
|
||||||
color_selected=$(zenity --list --width=260 --height=565 --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" \
|
color_selected=$(zenity --list --width=260 --height=565 --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" \
|
||||||
--window-icon=${iconPath} --imagelist --column "Color" --column "Name color" ${imagesPath}/black.png Black \
|
--window-icon=${iconPath} --imagelist --column "Color" --column "Name color" ${imagesPath}/custom.png Custom \
|
||||||
${imagesPath}/white.png White ${imagesPath}/red.png Red ${imagesPath}/lime.png Lime ${imagesPath}/blue.png Blue \
|
${imagesPath}/white.png White ${imagesPath}/red.png Red ${imagesPath}/lime.png Lime ${imagesPath}/blue.png Blue \
|
||||||
${imagesPath}/yellow.png Yellow ${imagesPath}/cyan.png Cyan ${imagesPath}/magenta.png Magenta \
|
${imagesPath}/yellow.png Yellow ${imagesPath}/cyan.png Cyan ${imagesPath}/magenta.png Magenta \
|
||||||
${imagesPath}/silver.png Silver ${imagesPath}/gray.png Gray ${imagesPath}/maroon.png Maroon \
|
${imagesPath}/silver.png Silver ${imagesPath}/gray.png Gray ${imagesPath}/maroon.png Maroon \
|
||||||
|
@ -120,8 +200,84 @@ while [ ${showMenu} -eq 0 ] ; do
|
||||||
${imagesPath}/navy.png Navy)
|
${imagesPath}/navy.png Navy)
|
||||||
canceled=$?
|
canceled=$?
|
||||||
if [ ${canceled} -eq 0 ] ; then
|
if [ ${canceled} -eq 0 ] ; then
|
||||||
if [ "${color_selected}" == "${imagesPath}/black.png" ] ; then
|
if [ "${color_selected}" == "${imagesPath}/custom.png" ] ; then
|
||||||
color_apply="000000"
|
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
|
elif [ "${color_selected}" == "${imagesPath}/white.png" ] ; then
|
||||||
color_apply="FFFFFF"
|
color_apply="FFFFFF"
|
||||||
elif [ "${color_selected}" == "${imagesPath}/red.png" ] ; then
|
elif [ "${color_selected}" == "${imagesPath}/red.png" ] ; then
|
||||||
|
@ -153,17 +309,21 @@ while [ ${showMenu} -eq 0 ] ; do
|
||||||
elif [ "${color_selected}" == "${imagesPath}/navy.png" ] ; then
|
elif [ "${color_selected}" == "${imagesPath}/navy.png" ] ; then
|
||||||
color_apply="000080"
|
color_apply="000080"
|
||||||
fi
|
fi
|
||||||
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Applying Breathe effect" \
|
if [ -z "${color_apply}" ] ; then
|
||||||
--window-icon=${iconPath} --pulsate --no-cancel --auto-close
|
color_apply="none"
|
||||||
g203-led.py breathe "${color_apply}"
|
|
||||||
device_error=$?
|
|
||||||
if [ ${device_error} -eq 0 ] ; then
|
|
||||||
echo > /dev/null
|
|
||||||
else
|
else
|
||||||
zenity --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
|
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Applying Breathe effect" \
|
||||||
--text "Device not found or connected"
|
--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 "Device not found or connected"
|
||||||
|
fi
|
||||||
|
color_apply="none"
|
||||||
fi
|
fi
|
||||||
color_apply="none"
|
|
||||||
else
|
else
|
||||||
color_apply="none"
|
color_apply="none"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user