User Tools

Site Tools


script_circle_icons

====== About the script ====== * Purpose : This script will take all app shortcuts and place them in a circle. * Author : TBog * Link: www.google.com/+BogdanTautuTBog ====== How to use the script ====== - Make sure the items are not on a grid. - Make a shortcut that runs this script and put a . as the first character of the label. - Click on the shortcut and all items of type 'Shortcut' that do not have a dot as the first character in the label will be positioned on a circle. - You can change the order of the items in the circle using "Move forward/backwards" button. The top-most item is at 12-o'clock and going clockwise. - If the order of the items is not to your liking, make changes then go to step 3. - You can now delete the shortcut to the script. Note: The top-most item will set the size of all other items. I have tested this script on a 1080 x 1920 screen (portrait). If you have some other resolution you can change the margin values and the radius (read comments in the script). ====== Script code ====== <code> var desktop = LL.getCurrentDesktop(); var a = []; var na = 0; var items = desktop.getItems(); for ( var i=items.getLength()-1; i>=0; i-=1 ) { var item = items.getAt(i); if ( item.getType()!='Shortcut' ) { alert(item.getType()+" "+item.getLabel()); continue; } if ( item.getLabel().substr(0,1)=='.' ) continue; a[na++] = item; } if (!na) return; var x, y; var size = Math.max(a[0].getWidth(), a[0].getHeight()); var radius = (Math.min( desktop.getWidth(), desktop.getHeight() ) - size) * 0.5; var margin = 0.2 * size; radius-= margin; for ( var i=0; i<na; i+=1 ) { x = Math.cos(Math.PI*2*i/na-Math.PI/2) * radius; y = Math.sin(Math.PI*2*i/na-Math.PI/2 ) * radius; x+= desktop.getWidth()/2; y+= desktop.getHeight()-radius; x-= size/2; y-= size + margin; a[i].setScale(1, 1); a[i].setSize(size, size); a[i].setPosition(x , y); } </code>

script_circle_icons.txt · Last modified: 2014/03/03 12:32 by tbog