Is there any list of builtin variables available?
Is there any list of builtin variables available? More specifically, I need to use a variable in bindings which provides the current width of the selected item.
From there I can use margins/borders to divide up the box as a proportion.
Help appreciated 🙂
]]>
< ![CDATA[
While writing a binding simply tap the + button.
If you need more information long tap the ‘add binding’ entry
]]>
< ![CDATA[
Thanks for your reply, however it doesn’t quite answer my question.
I need to know the actual name of the variable (eg. $box_width), which returns the width value of the item in question. I can then use it in the box binding with the borders.
]]>
< ![CDATA[
Well, I answered the general question.
Let’s go to the specific one.
There isn’t any variable to get the width of the item, unfortunately.
BUT
You have access to the item itself with the defined variable ‘item’ 😉
From there simply item.getWidth() will return the width you asked for.
Thing to keep in mind: as that is not a variable it won’t update automatically. To do so you need to force it adding a variable in the binding that will update when required.
Will the item always have the same width or will you change it somehow?
]]>
< ![CDATA[
Thanks very much, very helpful 🙂
The width may change, which is why I’d like to use the width as part of the binding.
To explain simply what I’m trying to do, I would like to get a bar which displays the battery percentage (much like the one in the notification bar).
The way I have thought about doing it includes filling a blank item up with a solid colour, then using the ‘box’ binding to decrease the border value using ($bat_value, therefore reducing colour as the battery depletes. However, this only works for a set size – if you change the width, it is out of proportion. So using the getWidth() would mean I could do maths in the binding, so it would work at any size.
Does this make any sense?!
]]>
< ![CDATA[
Yes it does.
As I said you can use item.getWidth() to get the current size, but it won’t update when changing the size unless you edit the binding and enter it again.
To change it there are several ways:
Add “var unused=$ll_second;” in your binding to force it to update every second. It works, but it updates more than it should.
A better solution is to add a custom variable, and hide a shortcut to change that variable so that it triggers the update. Or even set it in the resumed event of the item (this way simply open another app, go back to the launcher and it will be fine again)
]]>
< ![CDATA[
Thanks so much, it’s all sorted now – much appreciated!
]]>