Howto: Enable all orientations (including portrait inverted) for apps

(I didn’t know were to put this, but I thought I’d share this for others having a similar problem.)

TL;DR: To enable all orientations on a SailfishOS device execute this terminal/SSH command with user permissions:
dconf write /desktop/sailfish/silica/default_allowed_orientations 15

How I discovered this: Using my device (Sony Xperia X) often while charging I found myself often struggling with the charging cable making it annoying to hold the device in one hand while resting my palm on the desk. Similarly, I sometimes find myself wanting to place the device with some content open on a flat surface while it is charging. While running under Android all my custom ROMs had a feature where you could just enable the inverted landscape (often called 180°) mode from settings, but with SailfishOS I found no such option.

When stumbling over the Default allowed orientations patch in Coderus’ patch manager, I got the hint that it might be possible using the /desktop/sailfish/silica/default_allowed_orientations dconf property but there was no hint anywhere what the format of that property is, so my attempts at guessing a correct value failed.

Recently I rediscovered this property’s name in some system binary by accident and, having done some light QML UI work in the meantime, had some idea what the full message that that string was part of could mean: „Invalid default allowed orientations defined. Check your device configuration! Defaulting to: QFlags<DeclarativeOrientation::
“. Search the Internet, I tried a couple of values but they all failed until I found the documentation of the Screen.orientation QML property. The Qt::ScreenOrientation type mentioned there has some documentation mentioning integer constants and as it turns out, those integer values are exactly what the Silica framework expects to find in that /desktop/sailfish/silica/default_allowed_orientations dconf property. In particular the numeric value 15 enables all possible orientations on newly started apps. Yeah! :slightly_smiling_face:


I used it to fix the bug on Gemini PDA for File Browser, it didn’t help.
How do I remove the default_allowed_orientations key from dconf? The reset parameter did not help.

It should be dconf reset /desktop/sailfish/silica/default_allowed_orientations. If that doesn’t work I don’t know, sorry.

However, since you are on Gemini PDA, I believe that that value is always set there (the device is primarily landscape, I believe?), in that case reset should change the value back to 7 (everything but inverted landscape), rather than clearing it.

Have you tried the mentioned sailfishos-default-allowed-orientations-patch? The previous description implied that it was primarily meant for devices like yours, I believe.

Thanks, dconf reset helped me, but I had to restart the device.