Use os.getlogin() instead of whoami command for getting username

This commit is contained in:
TheNooB 2023-08-11 21:14:34 +08:00
parent a8b3feac86
commit 7b157b045a
No known key found for this signature in database
GPG Key ID: B80F1826EB256C6E

View File

@ -149,7 +149,7 @@ def grabclipboard():
loginctl = None
if loginctl is not None:
username = subprocess.check_output("whoami").decode().strip("\n")
username = os.getlogin()
sessionid = [
line.split()[0] for line in loginctl if username in line.split()
][0]