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::
Orientation>(Portrait|LandscapeMask)
“. 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:

8 Likes

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.

Cool, I just got myself an Xperia 10 ii and almost immediately, I realised I cannot sit my phone on my usual phone holder due to the placement of the USB port.

Thanks +1

In all devices I used until now (Mi4 Cancro, Jolla1, Xperia X, XA2) the orientation of the apps and of the launcher was possible by changing the Page.qml file.
The support for all orientations was possible also with Xperia 10 ii until SFOS 4.0.
Now I’m on Sailfish OS 4.4.0.58 (Vanha Rauma) and got all apps rotate by 180 in inverted portrait except the Browser.
I modified Page.qml, checked Browser source code for “orientation”, modified the file OrientationChangeHandler by removing the line after “180deg rotation, no resize”
Neither the command
" dconf write /desktop/sailfish/silica/default_allowed_orientations 15 does something.

Anyone knows what can it be the change in Browser window handler that not allows anymore the 180deg (inverted portrait) mode?

Thanks,