77

installed PSQL10 but when pgAdmin is run from start then always open in browser.There is no option to run as a Desktop Application

user2006500
  • 781
  • 1
  • 5
  • 3
  • 3
    I updated PGAdmin 4 to version 3.0 just now and yes it does open in my browser which is quite different. It appears to only open in Chrome which is my default browser. I was a bit concerned that I couldn't access the query tool but after adjusting the blocked popup it all seems to be working as normal. – Slumdog May 27 '18 at 21:13
  • I have kind of a [same problem with pgadmin4 on Ubuntu](https://askubuntu.com/questions/1295125/pgadmin4-doesnt-open-the-correct-web-browser) – swiss_knight Nov 25 '20 at 08:52
  • how to access pgadmin once the browser tab is closed? – navyad Mar 28 '21 at 20:26

6 Answers6

86

With new chrome versions it is possible to run pgAdmin 4 as "native" desktop app. While the pgAdmin v4 web server is running, right click the icon in the Windows System Tray and select Configure... In the Browser Command input add the following:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --app=%URL%

Note that if you have Google Chrome installed in a different location, you will need to update the chrome.exe shortcut above accordingly.

enter image description here

Now when you start pgAdmin 4 it has its own window which you can pin to taskbar/tab to and so on. Like before.

cowgod
  • 8,626
  • 5
  • 40
  • 57
Andrej
  • 1,138
  • 8
  • 16
  • 7
    This will guarantee the app runs in a separate Chrome window, which is helpful. It even provides a pgadmin icon in the taskbar for the window. But I would not go so far as to compare it to a native desktop app (with or without air-quotes). (Still upvoting as useful.) – faintsignal Oct 22 '18 at 15:54
  • Love this solution works as expected now i don't have to search in my 30ish tabs :P – Peter Jun 26 '19 at 09:54
  • 2
    Works great under Linux as well! `/usr/bin/google-chrome --app=%URL%` – LuH Oct 15 '19 at 07:51
  • 3
    OS X: "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --app %URL% – C. Ramseyer Nov 17 '19 at 07:26
  • This worked like a charm on my Windows machine. Thanks much for this!! – Biju Nov 19 '19 at 12:57
  • @LuH can we do it with Firefox ? – RxT Mar 10 '20 at 00:48
  • @C. Ramseyer: this line of text looks good, but it did not succeed immediately in MacOS Mojave. It did create permanent icons in the dock, but each had a google image and when clicked they apparently did nothing, sorry. – Stato Machino Jun 22 '20 at 19:07
  • 1
    @RxT seems Firefox devs don't see this as a priority, and don't like it over security concerns (because localhost doesn't use https), if I checked the last few comments correctly: [Bugzilla Bug 1283670](https://bugzilla.mozilla.org/show_bug.cgi?id=1283670) – LuH Jul 23 '20 at 03:20
  • `--app=%URL%` is very obvious indeed. Tnx man! Works – niCk cAMel Aug 12 '20 at 13:37
18

Release notes say it now utilizes the browser to fix bugs in QtWebKit/QtWebEngine:

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.

https://www.postgresql.org/about/news/1846/

MDave
  • 1,245
  • 13
  • 29
12

Yes, that seems like the new direction pgAdmin seems to be going and they have their reasons for that which is all stated in their documentation. Here's a link to the documentation for more information: https://www.postgresql.org/about/news/1846/

Olumide
  • 410
  • 4
  • 14
  • 3
    I can understand the why but it would be nice for it to be configurable, maybe choose a browser. – Charlie Clark Jul 02 '18 at 13:24
  • I guess that's an issue that could be raised to the maintainers of the project @CharlieClark – Olumide Jul 02 '18 at 14:21
  • Sure, I was thinking that as I wrote the comment. – Charlie Clark Jul 02 '18 at 14:27
  • 3
    @CharlieClark You can choose a browser, just right click **pgAdmin** in the system tray, and press **Configure**. Then, under **Runtime** you can type a browser command. – Johannes Jul 08 '18 at 08:37
  • Thanks for this @Xydez – Olumide Jul 09 '18 at 11:21
  • No problem! Always happy to help. – Johannes Jul 09 '18 at 14:09
  • 4
    Thanks for the tip but "browser command" is a bit vague. I'm sure I'll be able to figure this out eventually but on MacOS `open %URL%` will, of course, just give me another tab in the default browser. Other attempts such as `Firefox %URL%` don't seem to work. – Charlie Clark Jul 09 '18 at 17:24
  • Charlie, the following worked for me: [ Internet Explorer: "C:\Program Files (x86)\Internet Explorer\iexplore.exe " %URL% ] [ Chrome: "C:\Program Files (x86)\Google\Chrome\Application\Chrome.exe " %URL% ] * Be sure to note the space before the final quote. * Firefox seems to have an issue opening the "Query Tools," throwing "Query Tools Initialized Error." Which is why I had to figure this out too. – critical_error Jul 12 '18 at 01:35
  • 1
    I was able to get it to launch in MicrosoftEdge, however, Edge suffers from the same query tools error as FF. The code to launch Edge ( note: there are *no* quotes !important ) [ powershell start shell:AppsFolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge ] – critical_error Jul 12 '18 at 02:30
  • For amateurs like me, the microsoft edge version also needs the %URL% part. Oh, and don't type the brackets or the spaces – Henrietta Martingale Sep 19 '18 at 15:09
  • On a separate note, that is not a link to their documentation. – swade Nov 05 '18 at 21:40
  • @StevenWade You're actually correct, but the link to the documentation can be found from the above link. Thanks for spotting this out – Olumide Nov 05 '18 at 22:30
1

As @Andrej mentioned, configuring the pgAdmin 4 Browser Command option of pgAdmin 4 gives you more control over how it is opened, and some browsers allow command-line arguments that can keep profiles, data, and dock icons separate. Some examples:

Chrome has a --profile-directory option will use a specific "person" or profile in Chrome. If you want Chrome showing only once in your dock and switching profile/person within Chrome by clicking on the profile icon or changing the profile/person in the dock, then you could just use this.

Chrome also has a --user-data-dir option which allows more separation of the data, perhaps less complexity in the interface, and allows Chrome to open as a different instance in the dock. It's also going to be a separate profile if you use this, but just in a different data directory.

For either, using a different skin/theme for the pgAdmin profile may be a good idea. Something like the Simple Red Theme that might be distinct could be a good choice.

For macOS and Chrome, you might use something like this Browser Command, as mentioned in https://apple.stackexchange.com/a/258760:

open -na "Google Chrome" --args --user-data-dir="/Users/yourusername/somedirname" %URL%

If you really want pgAdmin to run in the dock more similar to a regular desktop app, rather than having to use you could search for desktop webapp wrapper app and try one of those (e.g. Applicationize, Fluid, etc.).

Gary S. Weaver
  • 7,966
  • 4
  • 37
  • 61
1

The solution I use on my MacBook (running Mojave) is based on @Andrej's answer and the associated comments. It's not perfect, but gets me most of what I need.

First, install pgAdmin. I use Homebrew:

$ brew cask install pgadmin4

Start pgAdmin from the Applications menu.

This gives you an elephant-looking icon in the top menu bar. In there, select Configure... and change the Browser Command to:

"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --app %URL%

Check the checkbox for Fixed Port Number and choose an arbitrary port (I used 20000), and click OK.

Next, open a new browser window off the elephant menu using New pgAdmin 4 window. You may need to enter a passphrase to protect your database credentials.

When the window has opened, go Chrome's 3-dots menu on the right-hand side of the window, and choose More Tools > Create Shortcut. Make sure you check the checkbox to use a separate window.

Chrome will create a shortcut that pops up pgAdmin in a separate window with its own icon, and you can pin this window to the dock. If you forget to pin the shortcut to the dock, you can find it again at chrome://apps/.

Unfortunately, this shortcut doesn't automatically start pgAdmin and doesn't inherit the security context that you get when you use the New pgAdmin 4 window from the elephant menu. So, after a reboot or after quitting Chrome, you'll get an error like this:

Unauthorized The server could not verify that you are authorized to access the URL requested. You either supplied the wrong credentials (e.g. a bad password), or your browser doesn't understand how to supply the credentials required.

The fix is to start pgAdmin from the Applications menu and open a new window with New pgAdmin 4 window. After that, you can refresh your standalone window with ⌘-R, and then you can close the other browser window.

This is a little annoying, but it at least gets me a separate icon and window, which is what I mostly care about.

Ken Pronovici
  • 774
  • 1
  • 8
  • 20
0

I was facing the same issue.

Download PgAdmin III - it's separate query editor
official link v1.22.2/win32

MultiValidation
  • 823
  • 7
  • 21
  • Please don't just post some tool or library as an answer. At least demonstrate [how it solves the problem](https://meta.stackoverflow.com/a/251605) in the answer itself. – Yunnosch Oct 01 '20 at 18:35