8

I am on Ubuntu 18.04. After I wake from hibernation, my chrome looks like this.

Even when I open new tabs. It still does not render things properly. The only thing that works is closing all open windows of chrome and reopening the tabs.

I have the same issue with Slack (I have to quit and close even the snippet in the corner of the screen and then reopen).

EDIT: This is the same question as Problems with chrome browser after suspend the computer on Ubuntu 20.04 and Chrome causing weird flickering since upgrade to 85.0.4183.83

But a solution that does not involve disabling hardware acceleration (which makes Chrome slow) is still missing. Furthermore, the issue with Slack hasn't been mentioned either.

Does any one have an idea of how to fix this? Thanks

1 Answers1

7

I just encounter the same problem after installing Xubuntu 20.10 in an Nvidia Optimus laptop.

As you mentioned, the issue with chrome is already addressed in other posts, but no mention on Slack.

For me the solution of Andrew Bruce (based on tiangolo's answer) fixed the issue with Chrome, so I tried the same for Slack and it worked!

Basically, you have to kill the graphic process of each glitched program (I think it applies to all chromium based apps). The relevant part is pkill -f 'the_process_name \-\-type=gpu-process'.

So for Chrome and Slack the complete script is:

#!/bin/sh

set -e

if [ "$2" = "suspend" ] || [ "$2" = "hybrid-sleep" ] then case "$1" in pre) true ;; post) sleep 1 pkill -f 'chrome --type=gpu-process' pkill -f 'slack --type=gpu-process' ;; esac fi

Which goes in /lib/systemd/system-sleep/fix-glitched-apps and must be executable (chmod +x /lib/systemd/system-sleep/fix-glitched-apps).

  • That's a nice find. Thank you very much. I didn't find an explanation for what are the cases pre and post doing there. Neither what are the parameters $1 and $2. Do you know how this works? – Homero Esmeraldo Nov 11 '20 at 01:23
  • 1
    "Immediately before entering system suspend and/or hibernation (...) will run all executables in /usr/lib/systemd/system-sleep/ and pass two arguments to them. The first argument will be "pre", the second either "suspend", "hibernate", "hybrid-sleep", or "suspend-then-hibernate" depending on the chosen action. Immediately after leaving system suspend and/or hibernation the same executables are run, but the first argument is now "post"."

    https://www.freedesktop.org/software/systemd/man/systemd-suspend.service.html

    – Micaela Martino Nov 12 '20 at 02:29