37

After upgrading from Ubuntu 18.04 to 22.04 maximized windows are not correctly restored - they get under the Dock when Ubuntu comes back from standby (maybe also after locking screen?).

enter image description here

If I unmaximize and maximize the window again it correctly autofits without the Dock panel covering the window.

How can this be solved?

Valentas
  • 1,138

3 Answers3

7

I had this problem and I unintentionally fixed it:

  1. I went to Settings/Appearance and enabled the "Auto-hide the Dock" toggle because this Dock problem was bothering me too much
  2. then I tested how the feature works by resizing windows from larger to smaller and then back to max
  3. I found out that auto-hide is not for me so I disabled the feature and found out that the problem was solved.
1

Worth mentioning, that disabling Wayland solves the problem: edit /etc/gdm3/custom.conf and uncomment the line #WaylandEnable=false, restart.

Wayland causes lots of other bugs anyways - at least for me. Plugging in external monitors is fully broken, the system usually hangs. Tearing in graphics apps, some broken GTK+ apps (with stay-on-top tooltips), maximized windows behind the Dock, and the list goes on...
At the same time, accidentally dragging some selected text in Firefox makes the window unresponsible for a while, only when Wayland is disabled...

0

Actually, auto-hide the dock or toggling panel mode, or another option - change panel position from left to right and back, these are all work, but not permanently (at least in my case).

I found solution for me in creating the service which runs the script on startup. This script is watching for screen lock/unlock. When the screen is being locked, it enables the auto-hide option. When the screen is being unlocked, it disables the auto-hide, thus resizing all of the windows. Why auto-hide - I discovered it works better than other two mentioned above options.

  1. Create script file:
mkdir ~/.local/script/ -p
nano ~/.local/script/screen_watcher.sh
#!/bin/bash

dbus-monitor --session "type='signal',interface='org.gnome.ScreenSaver'" |
( while true do read X if echo $X | grep "boolean false" &> /dev/null; then sleep 0.5 gsettings set org.gnome.shell.extensions.dash-to-dock dock-fixed 'true' elif echo $X | grep "boolean true" &> /dev/null; then gsettings set org.gnome.shell.extensions.dash-to-dock dock-fixed 'false' fi done )

  1. Allow execution
chmod +x ~/.local/script/screen_watcher.sh
  1. Create service entity file (I did it for user)
mkdir -p ~/.config/systemd/user/
nano ~/.config/systemd/user/screen_watcher.service
[Unit]
Description=Screen watcher script service
After=default.target
[Service]
Type=idle
ExecStart=%h/.local/script/screen_watcher.sh
[Install]
WantedBy=default.target
  1. Enable the service. (Note it must be done from user, not root)
systemctl --user enable screen_watcher && systemctl --user start screen_watcher
  1. Check if the service is up and running
systemctl --user status screen_watcher.service

Hope this helps till annoying overlapping behaviour is fixed.

Max
  • 1