How to use KLWP to change your homescreen based on orientation

Andreas Ødegård
May 10, 2018 · 2 min read

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.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store