There is a shortcut key called “Show Docker Titles” that you can use. This will toggle show/hide the text and buttons on the title bar but it won’t remove the space the title bar occupies.
There is another plugin that has this feature that you might want to try:
(edit: just realized you are making something yourself, look at the other plugin’s source to see how it was accomplished)