Skip to content

Instantly share code, notes, and snippets.

@demaniak
Last active September 20, 2023 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save demaniak/1ac789b1858dba78cffb075beb2d9235 to your computer and use it in GitHub Desktop.
Save demaniak/1ac789b1858dba78cffb075beb2d9235 to your computer and use it in GitHub Desktop.
Work-a-round for black screen after sleep on Lenovo Lengion running linux with hybrid graphics
#!/bin/bash
# After the lenovo legion laptop with Nvidia discrete graphics is woken up from sleep mode,
# and the screen where X is running is black, go to a text terminal (CTRL+ALT+F1).
# Log in, then run this script.
# While it is running, go back to the screen X is running on, typically CTRL+ALT+F7.
# After a moment or two, your X-session should come back.
#
# PS: I found ths somewhere on the web, I don't remember where. It has helped me at least.
#
# Xubuntu Jammy, LTS, Nvidia driver 525.125.06, AMD Ryzen, running in Hybrid graphics mode.
#
# I have zero idea if this is usefull to any other system configuration.
while true; do DISPLAY=:0 xrandr --auto && break || sleep 1s; done
@demaniak
Copy link
Author

If the script worked, remember to go back to your text terminal and log out. Probably not good to leave a logged in account running ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment