192 lines
4.1 KiB
Bash
192 lines
4.1 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
main()
|
||
|
{
|
||
|
clear
|
||
|
echo " __________________________________"
|
||
|
echo " | Welcome To the Idesk script! |"
|
||
|
echo " | This script intends to simplafy |"
|
||
|
echo " | The desktop icon making process! |"
|
||
|
echo "____________________________________________________"
|
||
|
echo "| |"
|
||
|
echo "| To make a new icon press 1! |"
|
||
|
echo "| To edit an already made desktop icon press 2! |"
|
||
|
echo "| To udpate icons on the desktop press 3! |"
|
||
|
echo "| To remove an icon press 4! |"
|
||
|
echo "| To open the Idesktop dir press 5! |"
|
||
|
echo "|___________________________________________________|"
|
||
|
echo "| To EXIT this screen press 6! |"
|
||
|
echo "|___________________________________________________|"
|
||
|
echo ""
|
||
|
read -p " What is it you wish to do? : " reply
|
||
|
if [ $reply == 1 ]; then
|
||
|
maker
|
||
|
elif [ $reply == 2 ]; then
|
||
|
edit
|
||
|
elif [ $reply == 3 ]; then
|
||
|
updtr
|
||
|
elif [ $reply == 4 ]; then
|
||
|
lnkdel
|
||
|
elif [ $reply == 5 ]; then
|
||
|
opndir
|
||
|
elif [ $reply == 6 ]; then
|
||
|
exr
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
maker()
|
||
|
{
|
||
|
clear
|
||
|
read -p "What is the Icon's name? : " cap
|
||
|
clear
|
||
|
read -p "What is the command to run the program? : " pcmd
|
||
|
clear
|
||
|
echo "Hint: To view other icon images; type in a terminal.
|
||
|
/usr/share/pixmaps/ Common ones are bellow :
|
||
|
evince.xpm , mc.xpm , calibre-gui.png , openjdk-7.xpm , smplayer.xpm
|
||
|
leafpd.png , abiword.png , firefox.png , steam.png , terminator.png"
|
||
|
echo ""
|
||
|
read -p "What will the icon img be? : " pix
|
||
|
clear
|
||
|
wid="32"
|
||
|
heigh="32"
|
||
|
x1="32"
|
||
|
y1="32"
|
||
|
clear
|
||
|
echo "
|
||
|
table Icon
|
||
|
Caption: $cap
|
||
|
Command: $pcmd
|
||
|
Icon: /usr/share/pixmaps/${pix}
|
||
|
Width: $wid
|
||
|
Height: $heigh
|
||
|
X: $x1
|
||
|
Y: $y1
|
||
|
end"
|
||
|
checker
|
||
|
}
|
||
|
|
||
|
edit()
|
||
|
{
|
||
|
clear
|
||
|
ls ~/.idesktop/
|
||
|
echo ""
|
||
|
echo ""
|
||
|
echo "Which do you wish to edit?"
|
||
|
echo "Type the name without the .lnk extension"
|
||
|
read -p "Selection : " inpt
|
||
|
leafpad ~/.idesktop/${inpt}.lnk
|
||
|
}
|
||
|
|
||
|
updtr()
|
||
|
{
|
||
|
touch /tmp/list.txt
|
||
|
sed -i 'd' /tmp/list.txt
|
||
|
ls ~/Desktop/ >> /tmp/list.txt
|
||
|
|
||
|
x=$(cat /tmp//list.txt | wc -l) >> /dev/null
|
||
|
|
||
|
i="1"
|
||
|
x1="32"
|
||
|
y1="32"; wid="32"; heigh="32"
|
||
|
|
||
|
while [ $i -le $x ]; do
|
||
|
line1=$(sed -n "${i}p" /tmp/list.txt)
|
||
|
cap=$(echo "$line1" | sed 's/.[^.]*$//g')
|
||
|
pcmd=$(echo "$line1" | sed 's/^.*\././g')
|
||
|
clear
|
||
|
if [ -f ${HOME}/.idesktop/${cap}.lnk ]; then
|
||
|
echo " ~/.idesktop/${cap}.lnk"
|
||
|
echo "Already present on desktop." ; sleep 1 ;
|
||
|
else
|
||
|
echo "Hint: look for something matching ${cap}${pcmd}"
|
||
|
echo " -- in /usr/share/pixmaps"
|
||
|
echo "Common icons are : "
|
||
|
echo "evince.xpm , mc.xpm , calibre-gui.png , openjdk-7.xpm , smplayer.xpm "
|
||
|
echo "leafpad.png , abiword.png , firefox.png , steam.png , terminator.png"
|
||
|
read -p "What'll be the icon image? : " pix
|
||
|
echo ""; echo "" ;
|
||
|
read -p "What'll run this program? : " mcd
|
||
|
|
||
|
echo "table Icon
|
||
|
Caption: ${cap}
|
||
|
Command: ${mcd} ~/Desktop/${cap}${pcmd}
|
||
|
Icon: /usr/share/pixmaps/${pix}
|
||
|
Width: $wid
|
||
|
Height: $heigh
|
||
|
X: $x1
|
||
|
Y: $y1
|
||
|
end" >> ~/.idesktop/${cap}.lnk ; fi
|
||
|
i=$[$i++1]
|
||
|
x1=$[$x1++32]
|
||
|
y1=$[$y1]
|
||
|
done
|
||
|
clear
|
||
|
main
|
||
|
}
|
||
|
|
||
|
lnkdel()
|
||
|
{
|
||
|
clear
|
||
|
ls ~/.idesktop/
|
||
|
echo ""
|
||
|
echo "Please don't type the .lnk extension!"
|
||
|
echo ""
|
||
|
read -p "Which do you wish to delete? : " sepl
|
||
|
rm -rf ~/.idesktop/${sepl}.lnk
|
||
|
clear
|
||
|
echo "Do you wish to remove other icons?"
|
||
|
read -p "Please type 1 for Yes and 2 for No : " ansrr
|
||
|
|
||
|
if [ $ansrr == 1 ]; then
|
||
|
lnkdel ; elif
|
||
|
[ $ansrr == 2 ]; then
|
||
|
main
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
opndir()
|
||
|
{
|
||
|
spacefm $HOME/.idesktop/ ;
|
||
|
main
|
||
|
}
|
||
|
|
||
|
exr()
|
||
|
{
|
||
|
clear
|
||
|
echo "THANKS FOR USEING!!"
|
||
|
sleep 2
|
||
|
clear
|
||
|
exit
|
||
|
}
|
||
|
|
||
|
checker()
|
||
|
{
|
||
|
echo ""
|
||
|
echo ""
|
||
|
echo "Hint: 1 is yes and 2 is no. "
|
||
|
echo ""
|
||
|
read -p "Is the above info correct? : " ans
|
||
|
|
||
|
if [ $ans == 1 ]; then
|
||
|
echo "table Icon
|
||
|
Caption: $cap
|
||
|
Command: $pcmd
|
||
|
Icon: /usr/share/pixmaps/${pix}
|
||
|
Width: $wid
|
||
|
Height: $heigh
|
||
|
X: $x1
|
||
|
Y: $y1
|
||
|
end" >> ~/.idesktop/${cap}.lnk
|
||
|
fi
|
||
|
if [ $ans == 2 ]; then
|
||
|
if [ $ans -ne 1 -o 2 ]; then
|
||
|
clear
|
||
|
echo "Please type 1 or 2 as your answer! "
|
||
|
checker
|
||
|
fi
|
||
|
main
|
||
|
fi
|
||
|
}
|
||
|
main
|