fix: only grep for loginctl sessions with a seat

If a session has no seat, it’s a TTY session. This will still break if
a user has more than 1 graphical session. For now, that’s out of scope.
This commit is contained in:
alterNERDtive 2024-02-18 19:56:18 +01:00
parent a87584a1a8
commit bebc1aa0af
Signed by: alterNERDtive
GPG key ID: 547787A4FE6533F1

View file

@ -120,7 +120,7 @@ function getPidByProp() {
function detectEnvironment() {
if [ $(command -v loginctl) ]; then
local Desktop Type
eval "$(loginctl show-session $(loginctl | grep $(whoami) | awk '{print $1}') -p Type -p Desktop)"
eval "$(loginctl show-session $(loginctl | grep $(whoami) | grep seat | awk '{print $1}') -p Type -p Desktop)"
DESKTOP=$Desktop
SESSION=$Type
fi