User Tools

Site Tools


About the script

How to use the script

This will change the home page of a desktop (not the home desktop). Instructions:

  • Copy paste this script as a new one, and check 'appear in lightning menu'
  • long click the background of the container you want to change, scripts, run this script.
  • input the position of the new home desktop, this can be a bit confusing, I hope the pop-up helps you. You can also scroll to the desired home desktop, it will be detected and shown as default in the inputs.

If the number of cells don't fit the screen (for example if the cells have a fixed size) you will be warned to exit.

Horizontal pinned items are not moved horizontally. The same with verticals and both.

Script code

var cont = LL.getEvent().getContainer();

var items=cont.getItems();
var distX=cont.getWidth();
var distY=cont.getHeight();
var cellsFloatX=distX/cont.getCellWidth();
var cellsFloatY=distY/cont.getCellHeight();
var cellsX=Math.round(cellsFloatX);
var cellsY=Math.round(cellsFloatY);

if(Math.abs(cellsFloatX-cellsX)>0.00001)if(!confirm("Warning, the cells don't fill the screen as an exact horizontal number.\nDo you want to continue?"))return;

if(Math.abs(cellsFloatY-cellsY)>0.00001)if(!confirm("Warning, the cells don't fill the screen as an exact vertical number.\nDo you want to continue?"))return;

var moveX = parseInt(prompt("Which page do you want to be the home one? (horizontal)(left ones are negative)",Math.round(cont.getPositionX()/distX))) || 0;

var moveY = parseInt(prompt("Which page do you want to be the home one? (vertical)(top ones are negative)",Math.round(cont.getPositionY()/distY))) || 0;
for(var i=items.getLength() - 1;i>=0; -- i){
	var item=items.getAt(i);
	var prop=item.getProperties()

	var xx=1;
	var yy=1;

	var pinmode = prop.getString("i.pinMode");
	else if(pinmode=="Y")yy=0;
	else if(pinmode=="XY")xx=yy=0;

		var cell=item.getCell();
		item.setCell(cell.getLeft() - cellsX * moveX * xx,cell.getTop() - cellsY * moveY * yy,cell.getRight() - cellsX * moveX * xx ,cell.getBottom() - cellsY * moveY * yy);
		item.setPosition(item.getPositionX() - distX * moveX * xx,item.getPositionY() - distY * moveY * yy);


cont.setPosition(cont.getPositionX() - moveX * distX,cont.getPositionY() - moveY * distY,cont.getPositionScale(),false);

script_change_home_page.txt · Last modified: 2019/09/18 01:24 by f43nd1r