2

I was searching hard through all the forums, but could not find an answer on my question. I'm writing a desktop application and I want to auto-detect proxy settings on recent Ubuntu. There are many tutotials about how to set up the settings via GUI:

but no suggestions of how to find already defined settings.

This topic describes, how to set the proxy settings via command line tool gsettings:

but still no information about where it is stored. As far as I understand, gsettings stores all the settings in ~/.config/dconf/user. If true, and if it also stores proxy settings there, then is there any way for an external custom application to retrieve these settings from this file?

afrish
  • 510
  • 1
    @Mitch

    I don't think this is duplicate, because it does not answer my questions:

    1. Where is the actual proxy settings file located?

    2. How to get the settings automatically? Please note that gsettings is a user tool with CLI, and I need to obtain the proxy settings automatically from the system without any user interface.

    – afrish Apr 22 '13 at 08:23

1 Answers1

0

The idea of having a command like gsettings is that it doesn't matter where or how the settings are stored. Even if the actual location should change, gsettings will tell you the values. So have your program do something like

gsettings get org.gnome.system.proxy mode

and you're fine.

Jos
  • 29,224
  • your proposed option is great, when you are a user. What if you are developer of custom application and you need to obtain proxy settings in your application automatically from the system, then use the settings to make connections? How do I use gsettings in this case? Sure it's possible to execute the line above from your application and parse the result, but it's kind of dirty hack and I want to hear better solutions. – afrish Apr 22 '13 at 08:28
  • This is nice because it is robust to moving config files, and is still working 6 years later. But at the same time it seems gnome-specific, which makes it difficult for developers of cross-platform applications. – craq Aug 19 '19 at 22:55