Screen rotates when unplugging power cord

,

On my ancient laptop the screen orientation changes counter-clockwise by 90 degrees when I unplug my charger. Reconnecting my charger does not change anything, but unplugging it again rotates the screen another 90 degrees. Is there any way to stop that from happening? Did not happen with old fedora versions, I think F37 was still fine. F38 however is problematic.

Is this Workstation (GNOME)?

Does it have a touchscreen and an accelerometer as reported by monitor-sensor? Is it a ‘2-in-1’ that can be folded into a tablet?

Yes, it is a GNOME Workstation. It is a regular laptop, about 10 years old (Ivy Bridge). It has no touchscreen and I do not think it has an accelerometer. At least I see no usecase for an accelerometer and the laptop was pretty cheap with a very plastic look.

Does monitor-sensor find anything anyway?

In any case, this sounds like a bug in mutter.

monitor-sensor only shows
Waiting for iio-sensor-proxy to appear
Nothing else, not even when I unplug the charger cable and the screen gets rotated.

OK, that disproves my hypothesis that it had something to do with autorotate.

Is there anything interesting in the journal when unplugging your charger? (journalctl -b)

You could also try testing with a fresh user account.

Nothing at all showing up in journalctl. Will try with a fresh user account on the weekend. Thanks for your help so far.

I tried with a new user account, same situation.
Device is old and will be replaced eventually, so for now I will probably stop debugging it further.
Only thing which would be useful would be a command I can type to rotate the screen back. That would be more convenient than using the mousepad on a rotated screen to change settings. Any suggestions?

You could try setting org.gnome.mutter.keybindings rotate-monitor in gsettings. If that doesn’t work, you can install gnome-monitor-config and make a shortcut that runs something like:

gnome-monitor-config set -Lp -M LVDS -t normal

It would probably be worth filing a bug upstream with mutter if you care to do so.

I know it’s an old thread, but i have had the same issue for a long time. I forget what version it started occurring on, and still happens to this day and i’ve done fresh installs since then. I get the same results as the original poster. I stoppd the iio-sensor-proxy service thinking this could be it. No change, screen still rotates. I don’t have a “lock screen rotation” button either. This is an old MSI GT70 laptop with hybrid graphics (intel and Nvidia). I’ve tried with and without the propriatry drivers no difference, and i’ve tried XORG and Wayland. My plug has become loose over the years and now this is becoming a problem. This laptop is an anchor, but i still enjoy it, lol.
Currently Fedora 39