How to automatically hide wingpanel in elementary OS 0.4 Loki?
elementary has a full screen mode that might get close to what you're looking for. It's disabled by default, but you can enable it by going into the Settings app, editing keyboard shortcuts, and assigning a key to fullscreen mode.
In full screen mode, the top bar and plank aren't shown, and each fullscreen app gets its own workspace (Super-Tab to cycle those).
This is not possible with wingpanel.
After quite some searching I figured out there is no easy way to do this.. But what I do to kind of patch this problem is I use full screen mode (meta+f) which really fullscreens the current app. That together with the use of hot corners available in the behaviour settings of desktop, makes the problem less important, since i usually need fullscreen in the apps I'm working.
(Personally i have enabled a hot corner to show all windows) The way FS mode works is by creating a separate workspace for the specific app, so meta+tab comes handy in stead of alt+tab quite often..
$ sudo add-apt-repository ppa: yunnxx / elementary
$ sudo apt update
$ sudo apt install elementary-wingautohide