From a62c469e9ced027b49e66550d91c24cd6461987a Mon Sep 17 00:00:00 2001 From: Archisman Panigrahi Date: Sun, 21 Sep 2025 11:24:03 -0400 Subject: [PATCH 1/2] Fix #777 (#784) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * check whether pywayland can be imported or not * disable smartpause plugin if it says NameError: name 'ExtIdleNotifierV1' is not defined * Update safeeyes/plugins/smartpause/ext_idle_notify.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update safeeyes/plugins/smartpause/ext_idle_notify.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Fix Ruff warnings * work on mypy * trying to fix mypy warning * Try fixing mypy error * fix typo * This should satisfy both ruff and mypy * reinstate the comments * Update ext_idle_notify.py * respect github warning, ignore local warning https://github.com/slgobinath/SafeEyes/pull/784#issuecomment-3283108746 😕 * remove unnecessary comment and remove # noqa : F401 * add comments about variable's values * More transparent code for exception handling --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../plugins/smartpause/ext_idle_notify.py | 23 +++++++++++++++---- safeeyes/plugins/smartpause/plugin.py | 12 +++++++++- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/safeeyes/plugins/smartpause/ext_idle_notify.py b/safeeyes/plugins/smartpause/ext_idle_notify.py index a975d5a0..8ccea26c 100644 --- a/safeeyes/plugins/smartpause/ext_idle_notify.py +++ b/safeeyes/plugins/smartpause/ext_idle_notify.py @@ -27,10 +27,25 @@ from pywayland.client import Display from pywayland.protocol.wayland.wl_seat import WlSeat -from pywayland.protocol.ext_idle_notify_v1 import ( - ExtIdleNotifierV1, - ExtIdleNotificationV1, -) + + +if typing.TYPE_CHECKING: + from pywayland.protocol.ext_idle_notify_v1 import ( + ExtIdleNotifierV1, + ExtIdleNotificationV1, + ) + +try: + from pywayland.protocol.ext_idle_notify_v1 import ( + ExtIdleNotifierV1, + ExtIdleNotificationV1, + ) +except Exception as e: + logging.warning("The ext_idle_notify_v1 feature is not available. Exception: %s", e) + logging.warning("This is likely due to an older version of Wayland.") + EXT_IDLE_NOTIFY_IMPORT_ERROR = True +else: + EXT_IDLE_NOTIFY_IMPORT_ERROR = False from .interface import IdleMonitorInterface from safeeyes import utility diff --git a/safeeyes/plugins/smartpause/plugin.py b/safeeyes/plugins/smartpause/plugin.py index 682a08ac..7d385684 100644 --- a/safeeyes/plugins/smartpause/plugin.py +++ b/safeeyes/plugins/smartpause/plugin.py @@ -159,8 +159,18 @@ def on_start() -> None: elif use_swayidle: idle_monitor = IdleMonitorSwayidle() elif use_ext_idle_notify: - from .ext_idle_notify import IdleMonitorExtIdleNotify + from .ext_idle_notify import ( + IdleMonitorExtIdleNotify, + EXT_IDLE_NOTIFY_IMPORT_ERROR, + ) + if EXT_IDLE_NOTIFY_IMPORT_ERROR: + logging.warning( + "SmartPause plugin disabled:" + " ext_idle_notify_v1 not available on this system." + ) + idle_monitor_unsupported = True + return idle_monitor = IdleMonitorExtIdleNotify() else: idle_monitor = IdleMonitorX11() From 8250808de002e572a635adb64d57d8d25c071792 Mon Sep 17 00:00:00 2001 From: Archisman Panigrahi Date: Sun, 21 Sep 2025 11:37:39 -0400 Subject: [PATCH 2/2] update version number (#792) --- debian/changelog | 8 ++++++++ pyproject.toml | 4 ++-- safeeyes/glade/about_dialog.glade | 2 +- .../platform/io.github.slgobinath.SafeEyes.metainfo.xml | 1 + 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 144f5736..e442c33a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +safeeyes (3.1.0) noble; urgency=medium + + * Ensure compatibility with older Wayland + + * Made xlib a mandatory dependency so that it does not break in x11. + + -- Archisman Panigrahi Sun, 21 Sep 2025 15:28:01 +0000 + safeeyes (3.0.1) noble; urgency=medium * bugfix release diff --git a/pyproject.toml b/pyproject.toml index 08d97c59..d17b740f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "safeeyes" -version = "3.0.1" +version = "3.1.0" description = "Protect your eyes from eye strain using this continuous breaks reminder." license = {text = "GPL-3.0-or-later"} keywords = ["linux utility health eye-strain safe-eyes"] @@ -30,7 +30,7 @@ requires-python = ">=3.10" [project.urls] Homepage = "https://github.com/slgobinath/SafeEyes" -Downloads = "https://github.com/slgobinath/SafeEyes/archive/v3.0.1.tar.gz" +Downloads = "https://github.com/slgobinath/SafeEyes/archive/v3.1.0.tar.gz" [project.scripts] safeeyes = "safeeyes.__main__:main" diff --git a/safeeyes/glade/about_dialog.glade b/safeeyes/glade/about_dialog.glade index 182a141e..b8888c30 100644 --- a/safeeyes/glade/about_dialog.glade +++ b/safeeyes/glade/about_dialog.glade @@ -64,7 +64,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.center 10 10 - Safe Eyes 3.0.1 + Safe Eyes 3.1.0 center 1 1 diff --git a/safeeyes/platform/io.github.slgobinath.SafeEyes.metainfo.xml b/safeeyes/platform/io.github.slgobinath.SafeEyes.metainfo.xml index 2d182df6..9bec243f 100644 --- a/safeeyes/platform/io.github.slgobinath.SafeEyes.metainfo.xml +++ b/safeeyes/platform/io.github.slgobinath.SafeEyes.metainfo.xml @@ -53,6 +53,7 @@ https://slgobinath.github.io/SafeEyes/ +