How to use KLWP to change your homescreen based on orientation

One of the most annoying things about homescreens is that they either look good in landscape or portrait, but not both. On iOS it’s less of a problem as the homescreen there is equally ugly regardless, but on Android it matters more as widgets and more advanced positioning and grid settings often don’t translate well to a different orientation.

KLWP can be a huge help here. Because everything you put in your live wallpaper is under your control, and orientation is an easily accessible value, you can simply tell the different parts of your wallpaper to behave differently depending on the orientation.

This is exactly what I’ve done on my Android tablet, which is more useful to be able to use in two orientations than my phone. I’ve chosen the simplest way possible, simply making two square groups of items and then changing their positions based on orientation. The end result looks like this:

Landscape and portrait orientation on my tablet. The icons here aren’t completely centered in the square for reasons that will be the topic of another post.

There are more complicated ways of doing this, completely rearranging items instead of just using two square boxes, but this gets you up and running fast. The formula I used here is in the X and Y Offset fields in the Position tab for each group. It’s a simple if statement with different values depending on whether the system info (si) function for landscape (land) returns 1 (“yes it is in landscape”) or not.

$si(land)$ - Screen Orientation (gives 0 in portrait, 1 if landscape)

You can obviously use the same method for other fields, not just numerical position offsets. Anchors, visibility, size, whatever. You could even have completely different items visible in each orientation, e.g. turning your normal phone homescreen into a news reader in landscape, or something to that end. For me, having a tablet that looks alright in both orientations is good enough for now.

Like what you read? Give Andreas Ødegård a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.