mirror of
https://github.com/HorlogeSkynet/archey4
synced 2024-11-24 04:00:10 +01:00
121b1cc796
Co-authored-by: Michael Bromilow <12384431+ingrinder@users.noreply.github.com> Co-authored-by: Samuel FORESTIER <samuel+dev@forestier.app>
22 lines
524 B
Python
22 lines
524 B
Python
"""User session detection class"""
|
|
|
|
import getpass
|
|
|
|
from archey.entry import Entry
|
|
|
|
|
|
class User(Entry):
|
|
"""Retrieves the session name of the current logged in user"""
|
|
|
|
_ICON = "\uf007" # fa_user
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
|
|
try:
|
|
self.value = getpass.getuser()
|
|
except ImportError:
|
|
# From <https://github.com/python/cpython/blob/3.9/Lib/getpass.py#L167>,
|
|
# `pwd` module import _might_ fail.
|
|
pass
|