gnome-shell-extension-screen-autorotate
gnome-shell-extension-screen-autorotate copied to clipboard
Update for GNOME 42
Extension doesn't work in gnome 42.beta. Manually adding 42 to the metadata.json still fails, complaining that this._actions.get(...)
is undefined:
Some code accessed the property 'LOCK_ORIENTATION_ACTION_ID' on the module 'systemActions'. That property was defined with 'let' or 'const' inside the module. This was previously supported, but is not correct according to the ES6 standard. Any symbols to be exported from a module must be defined with 'var'. The property access will work as previously for the time being, but please fix your code anyway.
JS ERROR: Extension [email protected]: TypeError: this._actions.get(...) is undefined
_override_system_actions/this._system_actions._updateOrientationLock@/home/.../.local/share/gnome-shell/extensions/[email protected]/extension.js:123:27
_override_system_actions@/home/.../.local/share/gnome-shell/extensions/[email protected]/extension.js:126:30
ScreenAutorotate@/home/.../.local/share/gnome-shell/extensions/[email protected]/extension.js:106:14
enable@/home/.../.local/share/gnome-shell/extensions/[email protected]/extension.js:193:21
_callExtensionEnable@resource:///org/gnome/shell/ui/extensionSystem.js:182:32
loadExtension@resource:///org/gnome/shell/ui/extensionSystem.js:364:26
_loadExtensions/<@resource:///org/gnome/shell/ui/extensionSystem.js:620:18
collectFromDatadirs@resource:///org/gnome/shell/misc/fileUtils.js:27:28
_loadExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:595:19
_enableAllExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:626:18
_sessionUpdated@resource:///org/gnome/shell/ui/extensionSystem.js:646:14
init@resource:///org/gnome/shell/ui/extensionSystem.js:56:14
_initializeUI@resource:///org/gnome/shell/ui/main.js:293:22
start@resource:///org/gnome/shell/ui/main.js:170:5
@resource:///org/gnome/shell/ui/init.js:6:17
(I thought this extension might not be needed in 42 based on gnome gitlab chatter, but still not seeing rotation work on my device)
I ran into this issue aswell I have managed to mitigate this by changing the following(line 122 to 125) in extension.js:
From:
this._system_actions._updateOrientationLock = function() {
this._actions.get(SystemActions.LOCK_ORIENTATION_ACTION_ID).available = true;
this.notify('can-lock-orientation');
};
To:
this._system_actions._updateOrientationLock = function() {
try {
this._actions.get(SystemActions.LOCK_ORIENTATION_ACTION_ID).available = true;
this.notify('can-lock-orientation');
} catch (error) {
log(error)
}
};
This is by no means a clean solution but I am out of my depth when it comes to figuring out why this._actions
is not defined when this._system_actions._updateOrientationLock
is called at start up. This is something that would require tinkering around with gnome-shell to see what is causing this.
I have however been able to test this temporary solution and it seems to work fine using GNOME 42.0
@shyzus i just gave your suggestion a go and i can confirm it worked for me too. thanks!
@shyzus your solution works and I also love coffee.
@shyzus works for me as well!
@shyzus This worked for me too! Thank you!
@shyzus I confirm this removes the error and activates the extension for me however although the screen auto rotates, it starts in 180 degrees in the wrong orientation (upside down).
Currently my solution is to physically invert the laptop and lock the orientation.
Its a 2 in 1 Asus BR1100FKA
I confirm this removes the error and activates the extension for me however although the screen auto rotates, it starts in 180 degrees in the wrong orientation (upside down).
It might be possible that your particular device has its sensor installed the other way around (or at least, compared to how the iio module interprets it). You could add your own transformation matrix to correct this, if this is the case.
To confirm if this might be the case, try running monitor-sensor
. It should detect your sensor and output (live) what it detects. If whatever it's reporting is the wrong way around, it should confirm that the extension is not the issue.
If that's the case, and you want to try to fix this, you can create a transformation matrix that should correct this. this file has useful information in its header comments that you can use. And while it specifically covers the subject under Xorg (so not applicable if you're using Wayland), this link has useful transformation matrix examples that you can use.
Hi @jibsaramnim
I think you are correct; running monitor-sensor returns: === Has accelerometer (orientation: left-up)
When it should be normal
Im not familiar enough with xorg to confidently edit the Transformation Matrix but strongly think its related to the lack of support for 2 in 1 displays (laptop & tablet)
I think you are correct; running monitor-sensor returns: === Has accelerometer (orientation: left-up)
I’m guessing you might have corrected the display orientation post-login in your display settings then, right?
There’s a Grub configuration option you can add to correct the display orientation there, which should correct it everywhere (aside from the actual grub screen though), and hopefully includes corrected orientation for your touch/pen as-well.
You’d need to know the name of the port through which your display panel is connected internally. I think something like running ls /sys/class/drm/card*
should show you all ports, and if it’s not immediately obvious which port your display is using, you can poke around each one until you find the one your display uses. Maybe listing out available modes on each port until you find one that makes sense, for example; cat /sys/class/drm/card0-HDMI-A-1/modes
.
With that information, you can modify your grub config by adding the following kernel parameters:
fbcon=rotate:1 video=DSI-1:panel_orientation=right_side_up
Replace DSI-1
in this example with the name of the port your display is connected to. Depending on how the display is installed, you might have to adjust the right_side_up
part too, but you can start with this one.
That hopefully helps resolve the issue for you, but if it persists, and you for whatever reason must keep using Xorg (Wayland tends to handle these kinds of things better), you might still have to go the route of setting up a corrected matrix yourself, but hopefully this won’t be necessary.
FYI, this issue has lasted for over six months and now also affects Gnome 43 (used in Ubuntu 22.10). Any plans for a release @kosmospredanie or do you need new maintainer?
FYI, this issue has lasted for over six months and now also affects Gnome 43 (used in Ubuntu 22.10). Any plans for a release @kosmospredanie or do you need new maintainer?
Please view issue #10 .
Latest release (on the fork at https://github.com/shyzus/gnome-shell-extension-screen-autorotate ) resolves this I believe: https://extensions.gnome.org/extension/5389/screen-rotate/
Testing this on Fedora 37 + GNOME 43, and can confirm it's fixed on the fork.