Skip to content

Commit d64b830

Browse files
authored
Merge pull request slgobinath#758 from slgobinath/master
Release v3.0.0
2 parents 52b603e + 3c8b555 commit d64b830

File tree

8 files changed

+77
-45
lines changed

8 files changed

+77
-45
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ Some Linux systems like CentOS do not have matching dependencies available in th
157157
1. Install the necessary dependencies for CentOS 7
158158

159159
```bash
160-
sudo yum install python3-devel dbus dbus-devel cairo cairo-devel cairomm-devel libjpeg-turbo-devel pango pango-devel pangomm pangomm-devel gobject-introspection-devel cairo-gobject-devel
160+
sudo yum install python3-devel cairo cairo-devel cairomm-devel libjpeg-turbo-devel pango pango-devel pangomm pangomm-devel gobject-introspection-devel cairo-gobject-devel
161161
```
162162

163163
2. Create a virtual environment in your home folder

debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
safeeyes (3.0.0) noble; urgency=medium
2+
3+
* Internal fixes for flatpak.
4+
5+
-- Mel Dafert <[email protected]> Sun, 24 Aug 2025 10:30:00 +0000
6+
17
safeeyes (3.0.0b6) noble; urgency=medium
28

39
* Re-release due to broken github action

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "safeeyes"
3-
version = "3.0.0b6"
3+
version = "3.0.0"
44
description = "Protect your eyes from eye strain using this continuous breaks reminder."
55
keywords = ["linux utility health eye-strain safe-eyes"]
66
readme = "README.md"
@@ -31,7 +31,7 @@ requires-python = ">=3.10"
3131

3232
[project.urls]
3333
Homepage = "https://github.com/slgobinath/SafeEyes"
34-
Downloads = "https://github.com/slgobinath/SafeEyes/archive/v3.0.0b6.tar.gz"
34+
Downloads = "https://github.com/slgobinath/SafeEyes/archive/v3.0.0.tar.gz"
3535

3636
[project.scripts]
3737
safeeyes = "safeeyes.__main__:main"

safeeyes/glade/about_dialog.glade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ along with this program. If not, see &lt;https://www.gnu.org/licenses/&gt;.</pr
6464
<property name="valign">center</property>
6565
<property name="margin-top">10</property>
6666
<property name="margin-bottom">10</property>
67-
<property name="label">Safe Eyes 3.0.0b6</property>
67+
<property name="label">Safe Eyes 3.0.0</property>
6868
<property name="justify">center</property>
6969
<property name="hexpand">1</property>
7070
<property name="vexpand">1</property>

safeeyes/platform/io.github.slgobinath.SafeEyes.metainfo.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,22 @@
3838
<screenshots>
3939
<screenshot type="default">
4040
<caption>Safe Eyes short break screen.</caption>
41-
<image>https://slgobinath.github.io/SafeEyes/assets/screenshots/safeeyes_1.png</image>
41+
<image>https://slgobinath.github.io/SafeEyes/images/safeeyes_1.png</image>
4242
</screenshot>
4343
<screenshot>
4444
<caption>Safe Eyes long break screen.</caption>
45-
<image>https://slgobinath.github.io/SafeEyes/assets/screenshots/safeeyes_3.png</image>
45+
<image>https://slgobinath.github.io/SafeEyes/images/safeeyes_3.png</image>
4646
</screenshot>
4747
<screenshot>
4848
<caption>Safe Eyes settings window.</caption>
49-
<image>https://slgobinath.github.io/SafeEyes/assets/screenshots/safeeyes_6.png</image>
49+
<image>https://slgobinath.github.io/SafeEyes/images/safeeyes_6.png</image>
5050
</screenshot>
5151
</screenshots>
5252

5353
<url type="homepage">https://slgobinath.github.io/SafeEyes/</url>
5454

5555
<releases>
56+
<release version="3.0.0" date="2025-08-24" />
5657
<release version="3.0.0b6" date="2025-08-24" />
5758
<release version="3.0.0b5" date="2025-08-22" />
5859
<release version="3.0.0b4" date="2025-08-22" />

safeeyes/plugins/donotdisturb/dependency_checker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def validate(plugin_config, plugin_settings):
3030
return None
3131
command = "wlrctl"
3232
else:
33-
command = "xprop"
33+
return None
3434
if not utility.command_exist(command):
3535
return _("Please install the command-line tool '%s'") % command
3636
else:

safeeyes/plugins/screensaver/plugin.py

Lines changed: 62 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,39 @@
2222

2323
import logging
2424
import os
25+
import typing
26+
27+
import gi
28+
29+
gi.require_version("Gio", "2.0")
30+
from gi.repository import Gio
2531

2632
from safeeyes import utility
2733
from safeeyes.model import TrayAction
2834

2935
context = None
30-
lock_screen = False
36+
is_long_break: bool = False
3137
user_locked_screen = False
32-
lock_screen_command = None
38+
lock_screen_command: typing.Union[list[str], typing.Callable[[], None], None] = None
3339
min_seconds = 0
3440
seconds_passed = 0
3541
tray_icon_path = None
3642
icon_lock_later_path = None
3743

3844

39-
def __lock_screen_command():
45+
def __lock_screen_command() -> typing.Union[list[str], typing.Callable[[], None], None]:
4046
"""Function tries to detect the screensaver command based on the current
4147
envinroment.
4248
49+
Returns either a command to execute or function to call.
50+
4351
Possible results:
44-
Gnome, Unity, Budgie: ['gnome-screensaver-command', '--lock']
52+
Modern GNOME: DBus: org.gnome.ScreenSaver.Lock
53+
Old Gnome, Unity, Budgie: ['gnome-screensaver-command', '--lock']
4554
Cinnamon: ['cinnamon-screensaver-command', '--lock']
4655
Pantheon, LXDE: ['light-locker-command', '--lock']
4756
Mate: ['mate-screensaver-command', '--lock']
48-
KDE: ['qdbus', 'org.freedesktop.ScreenSaver',
49-
'/ScreenSaver', 'Lock']
57+
KDE: DBus: org.freedesktop.ScreenSaver.Lock
5058
XFCE: ['xflock4']
5159
Otherwise: None
5260
"""
@@ -63,6 +71,7 @@ def __lock_screen_command():
6371
elif desktop_session == "cinnamon" and utility.command_exist(
6472
"cinnamon-screensaver-command"
6573
):
74+
# This calls org.cinnamon.ScreenSaver.Lock internally
6675
return ["cinnamon-screensaver-command", "--lock"]
6776
elif (
6877
desktop_session == "pantheon" or desktop_session.startswith("lubuntu")
@@ -71,14 +80,23 @@ def __lock_screen_command():
7180
elif desktop_session == "mate" and utility.command_exist(
7281
"mate-screensaver-command"
7382
):
83+
# This calls org.mate.ScreenSaver.Lock internally
84+
# However, it warns not to rely on that
7485
return ["mate-screensaver-command", "--lock"]
7586
elif (
7687
desktop_session == "kde"
7788
or "plasma" in desktop_session
7889
or desktop_session.startswith("kubuntu")
7990
or os.environ.get("KDE_FULL_SESSION") == "true"
8091
):
81-
return ["qdbus", "org.freedesktop.ScreenSaver", "/ScreenSaver", "Lock"]
92+
# Note that this is unfortunately a non-standard KDE extension.
93+
# See https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/issues/632
94+
# for details.
95+
return lambda: __lock_screen_dbus(
96+
destination="org.freedesktop.ScreenSaver",
97+
path="/ScreenSaver",
98+
method="Lock",
99+
)
82100
elif (
83101
desktop_session in ["gnome", "unity", "budgie-desktop"]
84102
or desktop_session.startswith("ubuntu")
@@ -87,29 +105,49 @@ def __lock_screen_command():
87105
if utility.command_exist("gnome-screensaver-command"):
88106
return ["gnome-screensaver-command", "--lock"]
89107
# From Gnome 3.8 no gnome-screensaver-command
90-
return [
91-
"dbus-send",
92-
"--type=method_call",
93-
"--dest=org.gnome.ScreenSaver",
94-
"/org/gnome/ScreenSaver",
95-
"org.gnome.ScreenSaver.Lock",
96-
]
97-
elif os.environ.get("GNOME_DESKTOP_SESSION_ID"):
98-
if "deprecated" not in os.environ.get(
99-
"GNOME_DESKTOP_SESSION_ID"
100-
) and utility.command_exist("gnome-screensaver-command"):
108+
return lambda: __lock_screen_dbus(
109+
destination="org.gnome.ScreenSaver",
110+
path="/org/gnome/ScreenSaver",
111+
method="Lock",
112+
)
113+
elif gd_session := os.environ.get("GNOME_DESKTOP_SESSION_ID"):
114+
if "deprecated" not in gd_session and utility.command_exist(
115+
"gnome-screensaver-command"
116+
):
101117
# Gnome 2
102118
return ["gnome-screensaver-command", "--lock"]
103119
return None
104120

105121

122+
def __lock_screen_dbus(destination: str, path: str, method: str) -> None:
123+
"""This assumes that the interface is the same as the destination."""
124+
dbus_proxy = Gio.DBusProxy.new_for_bus_sync(
125+
bus_type=Gio.BusType.SESSION,
126+
flags=Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES,
127+
info=None,
128+
name=destination,
129+
object_path=path,
130+
interface_name=destination,
131+
)
132+
133+
dbus_proxy.call_sync(method, None, Gio.DBusCallFlags.NONE, -1)
134+
135+
106136
def __lock_screen_later():
107137
global user_locked_screen
108138
user_locked_screen = True
109139

110140

111141
def __lock_screen_now() -> None:
112-
utility.execute_command(lock_screen_command)
142+
global lock_screen_command
143+
144+
if lock_screen_command is None:
145+
return
146+
147+
if isinstance(lock_screen_command, list):
148+
utility.execute_command(lock_screen_command)
149+
else:
150+
lock_screen_command()
113151

114152

115153
def init(ctx, safeeyes_config, plugin_config):
@@ -134,15 +172,15 @@ def init(ctx, safeeyes_config, plugin_config):
134172

135173
def on_start_break(break_obj):
136174
"""Determine the break type and only if it is a long break, enable the
137-
lock_screen flag.
175+
is_long_break flag.
138176
"""
139-
global lock_screen
177+
global is_long_break
140178
global seconds_passed
141179
global user_locked_screen
142180
user_locked_screen = False
143181
seconds_passed = 0
144-
if lock_screen_command:
145-
lock_screen = break_obj.is_long_break()
182+
183+
is_long_break = break_obj.is_long_break()
146184

147185

148186
def on_countdown(countdown, seconds):
@@ -155,7 +193,7 @@ def on_stop_break():
155193
"""Lock the screen after a long break if the user has not skipped within
156194
min_seconds.
157195
"""
158-
if user_locked_screen or (lock_screen and seconds_passed >= min_seconds):
196+
if user_locked_screen or (is_long_break and seconds_passed >= min_seconds):
159197
__lock_screen_now()
160198

161199

safeeyes/plugins/trayicon/dependency_checker.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
# You should have received a copy of the GNU General Public License
1717
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1818

19-
from safeeyes import utility
2019
from safeeyes.model import PluginDependency
2120
from safeeyes.translations import translate as _
2221

@@ -48,15 +47,3 @@ def validate(plugin_config, plugin_settings):
4847
link="https://github.com/slgobinath/SafeEyes/wiki/How-to-install-backend-for-Safe-Eyes-tray-icon",
4948
retryable=True,
5049
)
51-
52-
command = None
53-
if utility.IS_WAYLAND:
54-
if utility.DESKTOP_ENVIRONMENT == "gnome":
55-
return None
56-
command = "wlrctl"
57-
else:
58-
command = "xprop"
59-
if not utility.command_exist(command):
60-
return _("Please install the command-line tool '%s'") % command
61-
else:
62-
return None

0 commit comments

Comments
 (0)