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
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
.
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.