mirror of
https://github.com/fairyglade/ly.git
synced 2025-12-20 19:24:53 +00:00
put xauthority file in XDG_CONFIG if specified
This commit is contained in:
15
src/login.c
15
src/login.c
@@ -304,10 +304,10 @@ void remove_utmp_entry(struct utmp *entry) {
|
||||
endutent();
|
||||
}
|
||||
|
||||
void xauth(const char* display_name, const char* shell, const char* home)
|
||||
void xauth(const char* display_name, const char* shell, const char* dir)
|
||||
{
|
||||
char xauthority[256];
|
||||
snprintf(xauthority, 256, "%s/%s", home, ".lyxauth");
|
||||
snprintf(xauthority, 256, "%s/%s", dir, ".lyxauth");
|
||||
setenv("XAUTHORITY", xauthority, 1);
|
||||
|
||||
FILE* fp = fopen(xauthority, "ab+");
|
||||
@@ -344,7 +344,16 @@ void xorg(
|
||||
const char* desktop_cmd)
|
||||
{
|
||||
// generate xauthority file
|
||||
xauth(display_name, pwd->pw_shell, pwd->pw_dir);
|
||||
const char* xauth_dir;
|
||||
|
||||
xauth_dir = getenv("XDG_CONFIG_HOME");
|
||||
|
||||
if ((xauth_dir == NULL) || (*xauth_dir == '\0'))
|
||||
{
|
||||
xauth_dir = pwd->pw_dir;
|
||||
}
|
||||
|
||||
xauth(display_name, pwd->pw_shell, xauth_dir);
|
||||
|
||||
// start xorg
|
||||
pid_t pid = fork();
|
||||
|
||||
Reference in New Issue
Block a user