The supported way to achieve such effect would be to install the Gnome Shell extension Pixelsaver straight from the software center. You can install it with the following command:
sudo apt install gnome-shell-extension-pixelsaver
You may need to enable the extension using the tool "Extensions" (only in Ubuntu 20.04 and higher) or using "Gnome Tweaks". You can install Gnome Tweaks from the software center, or install it with the command:
sudo apt install gnome-tweaks
An unsupported way to install gnome Shell extensions is by using the Gnome Extensions website. To enable this, you need some preparations. You will also find Pixel Saver there, but the extension Unite appears to be better maintained.
Caveat: these extensions may only work when your desktop is running on the Xorg graphics system. Ubuntu 18.04 by default will run on Xorg. However, by default, Ubuntu 17.10 used Wayland. You can switch between using Xorg or Wayland using the cog on the log in screen.
The supported way to achieve such effect would be to install the Gnome Shell extension Pixelsaver straight from the software center. You can install it with the following command:
sudo apt install gnome-shell-extension-pixelsaver
You may need to enable the extension using the tool "Extensions" (only in Ubuntu 20.04 and higher) or using "Gnome Tweaks". You can install Gnome Tweaks from the software center, or install it with the command:
sudo apt install gnome-tweaks
An unsupported way to install gnome Shell extensions is by using the Gnome Extensions website. To enable this, you need some preparations. You will also find Pixel Saver there, but the extension Unite appears to be better maintained.
Caveat: these extensions may only work when your desktop is running on the Xorg graphics system. Ubuntu 18.04 by default will run on Xorg. However, by default, Ubuntu 17.10 used Wayland. You can switch between using Xorg or Wayland using the cog on the log in screen.