pgAdmin 4 version 3 fails to open a second time
“Elephant” icon menu
When pgAdmin is running, an elephant icon menu appears. Look at the upper right corner of the screen. The elephant refers to Slonik, the Postgres mascot.
Choose New pgAdmin Window
menu item.
FYI, pgAdmin 4 is built as a web app, not a desktop app, even when run locally on your own computer. Note that the internal web server provided by pgAdmin 4 is running continuously, even after you close all windows. Use the Shutdown server
menu item, as seen above, if you want to stop that web server.
p.s. I agree, it is very confusing that clicking the icon does not do the same thing (when pgAdmin is already running).
Update For best solution, see Answer by Burmistrov.
Web browser
As for launching the app causing a page to open in your default web browser, Yes, that is the new normal.
Per an email on the psgsql-announce email sent by Dave Page on 2018-04-13:
The desktop runtime now runs as a system tray application and utilises the browser on the system to display pgAdmin. This resolves numerous bugs and issues caused by QtWebKit/QtWebEngine.
Second launching
As for the app doing nothing when launching after closing the first web browser window, one workaround: Bookmark the URL.
Here is an example of such a URL:
http://127.0.0.1:58353/browser/
The port number, 58353 in the example above, varies arbitrarily. To discover the port in use currently, do a port-scan.
Kill the pgAdmin server process
The pgAdmin 4 app is actually architected as a web app running inside a bundled web server. So the port number listed above is the port on which that bundled web server is listening.
So one workaround to our re-open-app problem is to kill the process of the web server of pgAdmin. Then run the pgAdmin 4 app again to re-launch the bundled web server, re-create the pgAdmin 4
process, and have your default web browser open a fresh window.
Alternate tool
Yes, pgAdmin 4 is annoying in this regard and in other regards as well. You may want to pursue using alternate admin tools. There are many to choose.
After installing pgadmin4-3.0, I removed it and reinstalled pgadmin4-2.1. The issues that this new version resolves are outweighed by the challenges it also introduces, in my view. After reverting to 4-2.1, I received the message "application server could not be contacted" when opening pgAdmin. To resolve this issue, I renamed ~/.pgadmin, but this resulted in losing my saved connections.