Changing orientation of the screen programmatically

We have an app which runs on WebOS and plan to add support for changing screen orientation (using degrees - 0°, 90°, 180°, 270° or at least switching portrait/landscape). I've searched though documentation, LS2 API in particular, and haven't found any appropriate method. The only thing I found is requestedWindowOrientation property on luna-send utility example usage: . But anyway it's no described how to modify this setting.
Would be glad to get any related information.
Kind regards.

1 Like

See for possible values. This is also confirmed by the values that were previously existing in Open webOS:

1 Like

Hello Herrie,
As I understood these properties are stored in application manifest file (appinfo.json) which contained in packaged application and they cannot be changed dynamically, right?

1 Like

I don't think there's a luna-send for it, however it seems the following code might still work if you add it to your apps code:

Values that would be accepted are "up", "down", "left", "right".

I got this from the legacy webOS Diagnostics App.

Thanks for your response,
I tried executing this method with different values ("up", "down", "left", "right") but nothing happened i.e. orientation didn't change, and there were no errors.

It does seem to be there in the code as per

Could be you don't need to use window prefix anymore. Otherwise might be good if someone from LG could chip in.

I tried to call setWindowOrientation() without window prefix and it doesn't work either.


You should set "screenRotation" using a command below.

luna-send -n 1 -f luna://com.webos.settingsservice/setSystemSettings '{"settings":{"screenRotation":"90"}, "category":"option"}'

You may choose one among "90", "180", "270" and "off" which stands for 0 degree.

1 Like