Why does a bash-zenity script has that title on Unity Panel and that icon on Unity Launcher?
- by Sadi
I have this small bash script which helps use Infinality font rendering options via a more user-friendly Zenity window.
But whenever I launch it I have this "Color Picker" title on Unity Panel together with the icon assigned for "Color Picker" utility.
I wonder why and how this is happening and how I can change it?
#!/bin/bash
# A simple script to provide a basic, zenity-based GUI to change Infinality Style.
# v.1.2
#
infinality_current=`cat /etc/profile.d/infinality-settings.sh | grep "USE_STYLE=" | awk -F'"' '{print $2}'`
sudo_password="$( gksudo --print-pass --message 'Provide permission to make system changes: Enter your password to start or press Cancel to quit.' -- : 2>/dev/null )"
# Check for null entry or cancellation.
if [[ ${?} != 0 || -z ${sudo_password} ]]
then
# Add a zenity message here if you want.
exit 4
fi
# Check that the password is valid.
if ! sudo -kSp '' [ 1 ] <<<"${sudo_password}" 2>/dev/null
then
# Add a zenity message here if you want.
exit 4
fi
#
menu(){
im="zenity --width=500 --height=490 --list --radiolist --title=\"Change Infinality Style\" --text=\"Current <i>Infinality Style</i> is\: <b>$infinality_current</b>\n? To <i>change</i> it, select any other option below and press <b>OK</b>\n? To <i>quit without changing</i>, press <b>Cancel</b>\" "
im=$im" --column=\" \" --column \"Options\" --column \"Description\" "
im=$im"FALSE \"DEFAULT\" \"Use default settings - a compromise that should please most people\" "
im=$im"FALSE \"OSX\" \"Simulate OSX rendering\" "
im=$im"FALSE \"IPAD\" \"Simulate iPad rendering\" "
im=$im"FALSE \"UBUNTU\" \"Simulate Ubuntu rendering\" "
im=$im"FALSE \"LINUX\" \"Generic Linux style - no snapping or certain other tweaks\" "
im=$im"FALSE \"WINDOWS\" \"Simulate Windows rendering\" "
im=$im"FALSE \"WIN7\" \"Simulate Windows 7 rendering with normal glyphs\" "
im=$im"FALSE \"WINLIGHT\" \"Simulate Windows 7 rendering with lighter glyphs\" "
im=$im"FALSE \"VANILLA\" \"Just subpixel hinting\" "
im=$im"FALSE \"CLASSIC\" \"Infinality rendering circa 2010 - No snapping.\" "
im=$im"FALSE \"NUDGE\" \"Infinality - Classic with lightly stem snapping and tweaks\" "
im=$im"FALSE \"PUSH\" \"Infinality - Classic with medium stem snapping and tweaks\" "
im=$im"FALSE \"SHOVE\" \"Infinality - Full stem snapping and tweaks without sharpening\" "
im=$im"FALSE \"SHARPENED\" \"Infinality - Full stem snapping, tweaks, and Windows-style sharpening\" "
im=$im"FALSE \"INFINALITY\" \"Infinality - Standard\" "
im=$im"FALSE \"DISABLED\" \"Act without extra infinality enhancements - just subpixel hinting\" "
}
#
option(){
choice=`echo $im | sh -`
#
if echo $choice | grep "DEFAULT" > /dev/null;
then
sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"DEFAULT\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}"
fi
#
if echo $choice | grep "OSX" > /dev/null;
then
sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"OSX\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}"
fi
#
if echo $choice | grep "IPAD" > /dev/null;
then
sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"IPAD\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}"
fi
#
if echo $choice | grep "UBUNTU" > /dev/null;
then
sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"UBUNTU\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}"
fi
#
if echo $choice | grep "LINUX" > /dev/null;
then
sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"LINUX\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}"
fi
#
if echo $choice | grep "WINDOWS" > /dev/null;
then
sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"WINDOWS\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}"
fi
#
if echo $choice | grep "WIN7" > /dev/null;
then
sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"WINDOWS7\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}"
fi
#
if echo $choice | grep "WINLIGHT" > /dev/null;
then
sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"WINDOWS7LIGHT\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}"
fi
#
if echo $choice | grep "VANILLA" > /dev/null;
then
sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"VANILLA\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}"
fi
#
if echo $choice | grep "CLASSIC" > /dev/null;
then
sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"CLASSIC\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}"
fi
#
if echo $choice | grep "NUDGE" > /dev/null;
then
sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"NUDGE\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}"
fi
#
if echo $choice | grep "PUSH" > /dev/null;
then
sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"PUSH\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}"
fi
#
if echo $choice | grep "SHOVE" > /dev/null;
then
sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"SHOVE\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}"
fi
#
if echo $choice | grep "SHARPENED" > /dev/null;
then
sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"SHARPENED\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}"
fi
#
if echo $choice | grep "INFINALITY" > /dev/null;
then
sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"INFINALITY\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}"
fi
#
if echo $choice | grep "DISABLED" > /dev/null;
then
sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"DISABLED\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}"
fi
#
}
#
menu
option
#
if test ${#choice} -gt 0; then
echo "Operation completed"
fi
#
exit 0