1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-17 16:53:13 +00:00

Updated GDM/XAUTHORITY logic for SDDM

This commit is contained in:
Bryan Roe
2022-02-17 01:47:47 -08:00
parent 3f0cfeaae5
commit 8e36f4eb7f
3 changed files with 24 additions and 4 deletions

File diff suppressed because one or more lines are too long

View File

@@ -684,6 +684,21 @@ function monitorinfo()
{ {
ret.xauthority = '/run/lightdm/' + uname + '/xauthority'; ret.xauthority = '/run/lightdm/' + uname + '/xauthority';
} }
if(consoleuid == require('user-sessions').gdmUid && require('fs').existsSync('/run/sddm'))
{
var info;
var files = require('fs').readdirSync('/run/sddm');
var gdmuid = require('user-sessions').gdmUid;
for(var i=0;i<files.length;++i)
{
info = require('fs').statSync('/run/sddm/' + files[i]);
if(info.uid == gdmuid)
{
ret.xauthority = '/run/sddm/' + files[i];
break;
}
}
}
} }
if (ret.display == '' && ttys.length > 0) if (ret.display == '' && ttys.length > 0)
{ {

View File

@@ -468,6 +468,7 @@ function UserSessions()
try try
{ {
pwd = JSON.parse(child.stdout.str); pwd = JSON.parse(child.stdout.str);
console.info1(JSON.stringify(pwd, null, 1));
} }
catch(z) catch(z)
{ {
@@ -496,6 +497,7 @@ function UserSessions()
var info1 = JSON.parse(child.stdout.str); var info1 = JSON.parse(child.stdout.str);
var i; var i;
for (i = 0; i < info1.length; ++i) { uids.push(info1[i].uid); } for (i = 0; i < info1.length; ++i) { uids.push(info1[i].uid); }
console.info1(JSON.stringify(uids));
} }
catch(z) catch(z)
{ {
@@ -506,9 +508,12 @@ function UserSessions()
while(uids.length>0) while(uids.length>0)
{ {
var tst = uids.pop(); var tst = uids.pop();
if(pwd[tst].desc.indexOf('Display Manager')>=0 || pwd[tst].user == 'gdm' || pwd[tst].user == 'lightdm') if (pwd[tst].desc.indexOf('Display Manager') >= 0 || pwd[tst].user == 'gdm' || pwd[tst].user == 'lightdm' || pwd[tst].user == 'sddm')
{ {
return (parseInt(tst)); if (parseInt(tst) < min)
{
return (parseInt(tst));
}
} }
} }
} }