Skip to content

Commit 9638772

Browse files
committed
remove dead rpc + psutil uniqueness code
1 parent 01ebfa9 commit 9638772

File tree

6 files changed

+0
-156
lines changed

6 files changed

+0
-156
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ Ensure to meet the following dependencies:
122122
- python3-babel
123123
- python3-croniter
124124
- python3-gi
125-
- python3-psutil
126125
- python3-packaging
127126
- python3-xlib
128127
- python3-pywayland (optional for KDE/other wayland)

debian/control

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Depends: ${misc:Depends}, ${python3:Depends},
1616
x11-utils,
1717
xprintidle,
1818
alsa-utils,
19-
python3-psutil,
2019
python3-croniter,
2120
python3-packaging,
2221
gir1.2-notify-0.7,

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ dependencies = [
2424
"pywayland",
2525
"PyGObject",
2626
"babel",
27-
"psutil",
2827
"packaging",
2928
"python-xlib",
3029
]
@@ -65,7 +64,6 @@ types = [
6564
"mypy==1.15.0",
6665
"PyGObject-stubs==2.13.0",
6766
"types-croniter==5.0.1.20250322",
68-
"types-psutil==7.0.0.20250218",
6967
"types-python-xlib==0.33.0.20240407",
7068
{include-group = "tests"},
7169
]

safeeyes/__main__.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,41 +23,11 @@
2323
import signal
2424
import sys
2525

26-
import psutil
2726
from safeeyes import translations
2827
from safeeyes.model import Config
2928
from safeeyes.safeeyes import SafeEyes
3029

3130

32-
def __running():
33-
"""Check if SafeEyes is already running."""
34-
process_count = 0
35-
current_user = psutil.Process().username()
36-
for proc in psutil.process_iter():
37-
if not proc.cmdline:
38-
continue
39-
try:
40-
# Check if safeeyes is in process arguments
41-
if callable(proc.cmdline):
42-
# Latest psutil has cmdline function
43-
cmd_line = proc.cmdline()
44-
else:
45-
# In older versions cmdline was a list object
46-
cmd_line = proc.cmdline
47-
if ("python3" in cmd_line[0] or "python" in cmd_line[0]) and (
48-
"safeeyes" in cmd_line[1] or "safeeyes" in cmd_line
49-
):
50-
if proc.username() == current_user:
51-
process_count += 1
52-
if process_count > 1:
53-
return True
54-
55-
# Ignore if process does not exist or does not have command line args
56-
except (IndexError, psutil.NoSuchProcess):
57-
pass
58-
return False
59-
60-
6131
def main():
6232
"""Start the Safe Eyes."""
6333
system_locale = translations.setup()

safeeyes/rpc.py

Lines changed: 0 additions & 99 deletions
This file was deleted.

safeeyes/safeeyes.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
from safeeyes.ui.break_screen import BreakScreen
3333
from safeeyes.ui.required_plugin_dialog import RequiredPluginDialog
3434
from safeeyes.model import State, RequiredPluginException
35-
from safeeyes.rpc import RPCServer
3635
from safeeyes.translations import translate as _
3736
from safeeyes.plugin_manager import PluginManager
3837
from safeeyes.core import SafeEyesCore
@@ -63,7 +62,6 @@ def __init__(self, system_locale, config) -> None:
6362
self.context: typing.Any = {}
6463
self.plugins_manager = None
6564
self.settings_dialog_active = False
66-
self.rpc_server = None
6765
self._status = ""
6866
self.system_locale = system_locale
6967

@@ -286,9 +284,6 @@ def do_startup(self):
286284

287285
atexit.register(self.persist_session)
288286

289-
if self.config.get("use_rpc_server", True):
290-
self.__start_rpc_server()
291-
292287
if (
293288
not self.plugins_manager.needs_retry()
294289
and not self.required_plugin_dialog_active
@@ -397,7 +392,6 @@ def quit(self):
397392
self.plugins_manager.stop()
398393
self.safe_eyes_core.stop()
399394
self.plugins_manager.exit()
400-
self.__stop_rpc_server()
401395
self.persist_session()
402396

403397
self.release()
@@ -483,13 +477,6 @@ def save_settings(self, config):
483477
def restart(self, config, set_active=False):
484478
logging.info("Initialize SafeEyesCore with modified settings")
485479

486-
if self.rpc_server is None and config.get("use_rpc_server"):
487-
# RPC server wasn't running but now enabled
488-
self.__start_rpc_server()
489-
elif self.rpc_server is not None and not config.get("use_rpc_server"):
490-
# RPC server was running but now disabled
491-
self.__stop_rpc_server()
492-
493480
# Restart the core and initialize the components
494481
self.config = config
495482
self.safe_eyes_core.initialize(config)
@@ -576,13 +563,3 @@ def persist_session(self):
576563
utility.write_json(utility.SESSION_FILE_PATH, self.context["session"])
577564
else:
578565
utility.delete(utility.SESSION_FILE_PATH)
579-
580-
def __start_rpc_server(self):
581-
if self.rpc_server is None:
582-
self.rpc_server = RPCServer(self.config.get("rpc_port"), self.context)
583-
self.rpc_server.start()
584-
585-
def __stop_rpc_server(self):
586-
if self.rpc_server is not None:
587-
self.rpc_server.stop()
588-
self.rpc_server = None

0 commit comments

Comments
 (0)