User Tools

Site Tools


script_circle_icons

**This is an old revision of the document!** ----

A PCRE internal error occured. This might be caused by a faulty plugin

====== 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 'ai' that do not have a dot as the first character in the label will be positioned on a circle. - You can now delete the shortcut to the script. You can change the order of the items in the circle using "Move forward/backwards" button. I have tested this script on a 1080 x 1920 screen. If you have some other resolution you can change the offsets 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()!='ai' ) { /*alert(item.getType()+" "+item.getLabel());*/ continue; } if ( item.getLabel().substr(0,1)=='.' ) continue; a[na++] = item; } var x,y; /* radius is about 400 for a 1080x1920 screen */ var radius = 0.37 * Math.min(desktop.getWidth(), desktop.getHeight()); 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; /* move circle to the middle of the screen */ x+= desktop.getWidth()/2; y+= desktop.getHeight()/2; /* offset (would be nice to know item width) */ x-= 67; y+= 300; a[i].setPosition(x , y); } </code>

script_circle_icons.1393186042.txt.gz · Last modified: 2014/02/23 20:07 by tbog