So
A lot of people have been complaining about the padding in widgets, something that seems to be an android issue, even thought other launchers seem to ‘fix’.
…
This is Lightning launcher! And we can also fix that!
The issue is that the widgets seem to have a margin (20px in my case), and suddenly I thought…why not set the margin of the box of the widgets to -20?
This is not possible with the normal lightning UI…but it is with scripts ๐
When setting the properties, lightning don’t check if they are positive, so you can simply put a negative margin to ‘reduce’ the widgets.
I quickly made this script that lets you easily ‘fix’ a widget running the script from the widget, or even all in a container running the script from the container (it lets you ‘revert back’)
Note: as I said, for me the ‘ghost’ margin is 20px in all directions, you can test and change those values in the script in case you have different ones.
Pierre Hรฉbertโ: what about let the normal user set directly negative number in the box?
]]>
< ![CDATA[
var left=20;
var right=20;
var top=20;
var bottom=20;
var item=LL.getEvent().getItem();
if(item!=null){
if(confirm(“Do you want to ‘fix’ this widget?”+(item.getType()==”Widget”?””:”\n\n Wait, this item is not a widget. Are you sure? “)))fix(item,false);
}else{
var cont=LL.getEvent().getContainer();
if(cont==null||cont.getId()==-1){alert(“No item nor container selected”);return;}
var reset=false;
if(!confirm(“Do you want to ‘fix’ all widgets in this container?”))if(confirm(“Do you want to reset them back to normal?”)) reset=true; else return;
var all=cont.getItems();
for(var t=all.getLength()-1;t>=0;–t){
var one=all.getAt(t);
if(one.getType()!=”Widget”)continue;
fix(one,reset);
}
}
//i=item/container
//r=[true/false]=”set to zero?”
function fix(i,r){
if(i==null)return;
var p=i.getProperties().edit();
var t=p.getBox(“i.box”)
t.setSize(“pr”,r?0:-right)
t.setSize(“pl”,r?0:-left)
t.setSize(“pt”,r?0:-top)
t.setSize(“pb”,r?0:-bottom);
p.commit();
}
]]>
< ![CDATA[
If I recall correctly LL used to let you set negative padding a very long time ago.. Before we had the box model implemented..๏ปฟ
]]>
< ![CDATA[
It works! (But you knew that of course, haha) The main widget that occasionally bothers me is power toggles, but it seems like a very, very, very small price to pay for the vast resource that is lightning launcher. Now it seems totally irrelevant since you shared your genius revelation. Hats off to you Sir…
]]>
< ![CDATA[
Amazing! I am impressed by your imagination and audacity! This is genius: simple and very effective.This could have crashed the launcher or even worst… but it works!
I will allow negative values as suggested in the next version ๐
]]>
< ![CDATA[
Wow lmao you guys are too damn smart ๐๐๐๐
]]>
< ![CDATA[
This is great. I’ve wanted negative values there, but can’t script it.
]]>