diff options
author | Robert Tari <robert@tari.in> | 2024-08-27 14:43:59 +0200 |
---|---|---|
committer | Robert Tari <robert@tari.in> | 2024-08-27 14:43:59 +0200 |
commit | 269aa4c7df03e1e581c01866c91bcfa5524d6334 (patch) | |
tree | 2fcd022cbfcb82537b15ae334b563cfaf16e5dde /ayatanasettings/psutil.py | |
parent | 4bfbd579171d9194956376c7153f378ff6eb9d4e (diff) | |
download | ayatana-settings-269aa4c7df03e1e581c01866c91bcfa5524d6334.tar.gz ayatana-settings-269aa4c7df03e1e581c01866c91bcfa5524d6334.tar.bz2 ayatana-settings-269aa4c7df03e1e581c01866c91bcfa5524d6334.zip |
Rewrite using C/CMake/Gtk4 and add some features/tweaks
Diffstat (limited to 'ayatanasettings/psutil.py')
-rw-r--r-- | ayatanasettings/psutil.py | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/ayatanasettings/psutil.py b/ayatanasettings/psutil.py deleted file mode 100644 index acdbe67..0000000 --- a/ayatanasettings/psutil.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -import psutil -import os -from .appdata import APPNAME - -def isRunning(): - - for pProc in psutil.process_iter(): - - sName = pProc.name - - if not isinstance(sName, str): - - sName = pProc.name() - - if sName == 'python3' or sName == 'python': - - lCmdLine = pProc.cmdline - - if not isinstance(lCmdLine, list): - - lCmdLine = pProc.cmdline() - - for sCmd in lCmdLine: - - if sCmd.endswith(APPNAME) and pProc.pid != os.getpid(): - - return True - - elif sName.endswith(APPNAME) and pProc.pid != os.getpid(): - - return True - - return False - -def isSystemd(): - - for pProc in psutil.process_iter(): - - sName = pProc.name - - if not isinstance(sName, str): - - sName = pProc.name() - - if sName == 'systemd': - - lCmdLine = pProc.cmdline - - if not isinstance(lCmdLine, list): - - lCmdLine = pProc.cmdline() - - for sCmd in lCmdLine: - - if sCmd == '--user': - - return True - - return False |