Gnome’s top bar can auto-hide itself like the left dock panel does via a Gnome Shell extension.
In Ubuntu 18.04, you can enable the feature by installing the gnome shell extension easily from Ubuntu Software.
In Ubuntu 20.04, it’s still easy to install the hide top bar
extension, though the Software utility does not longer handle the extension packages.
For Ubuntu 22.04 user, please scroll down and see the update section.
1.) Press Ctrl+Alt+T on keyboard to open terminal. Then run the apt command to install the extension:
sudo apt install gnome-shell-extension-autohidetopbar
Type user password (no asterisk feedback) for sudo prompt and hit Enter.
2.) Once installed, restart Gnome Shell by pressing Alt+F2 and type r in the pop-up “Run a Command” box and hit Enter.
3.) Finally open either Extensions or Gnome Tweaks (both available to install in Software), and enable “Hide Top Bar” extension.
That’s it. Enjoy!
Update for Ubuntu 22.04 LTS
The extension works for Ubuntu 22.04 with GNOME 42, though it’s not available in system repository anymore.
Firstly, press Ctrl+Alt+T on keyboard to open terminal. When it opens, run the command below to install required packages first:
sudo apt install chrome-gnome-shell gnome-shell-extension-prefs
Next, go to the link page below, install browser extension if prompt and turn on the slider icon to install the extension:
NOTE: The pre-installed Firefox (Snap) does not support installing Gnome Extensions! Use another browser or install Firefox as classic Deb.
It will work immediately after you installed it. To manage its behavior, search for and open “Extensions” app and click the related “Settings” button.