2

Can i set default config dir in home folder?

I dislike:

/home/user/Documents
/home/user/Music
/home/user/.progconf1
/home/user/.progconf2

I want:

/home/user/Documents
/home/user/Music
/home/user/.config/.progconf1
/home/user/.config/.progconf2

2 Answers 2

2

Generally this is not possible, as programs tend to hardcode (put the path directly into the source code) the config directory path (exceptions exist, see the darent's answer).

For example:

I use stackapplet which informs me of status changes on my askubuntu account. In its code it says (config_store.py):

CONFIG_FILE_PATH = os.path.join(os.path.expanduser("~"),".stackapplet") 

which sets the CONFIG_FILE_PATH to ~/.stackapplet. I would have to change the source code manually to override this.


Another example: wireshark

homedir = getenv("HOME");
if (homedir == NULL) {
    pwd = getpwuid(getuid());
    if (pwd != NULL) {
        homedir = g_strdup(pwd->pw_dir);
    } else
        homedir = "/tmp";
}
persconffile_dir = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", homedir, PF_DIR);

This gets the home directory path either from the HOME environment variable, or from the /etc/passwd entry for the current user, or it sets it to /tmp if all fails.


Different programs get the HOME path in different ways, you just can't change all the "home" references to /home/user/.config.

1
  • 1
    i think so too, but maybe we have alternatives? e.g set default ~ variable and make:<br/> /home/user/files/Music/home/user/.config1 <br/>//arrrrrrr stupid engine. need newline in comments. Religion forbids using nl2br?
    – Shara
    Sep 7, 2011 at 21:51
1

That depends on each program more than on the system. In some cases you can launch them with shortcuts to specific configurations. ie:

conky -c /home/user/.config/.conkyrc

dosbox /home/user/.config/.dosbox/

Those comands would save their configurations inside .config (i also dislike having my home full of small files and folders). But I don't know if there's a way to make it default or you'd have to set the configuration and the launche for each program (that if they allow you to set it). I don't think since that would mean changing your whole $HOME value. Somebody correct me if I'm wrong.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .