Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ python3 -m safeeyes

Safe Eyes installers install the required icons to `/usr/share/icons/hicolor`. When you run Safe Eyes from source without, some icons may not appear.

Note that on Wayland, this may still not be enough to get window icons working properly, as Wayland requires the .desktop file to match the running application, which is hard to do when running from source. If at all possible, prefer using an installed package.


### Install in a virtual environment

Expand Down Expand Up @@ -176,6 +178,8 @@ Some Linux systems like CentOS do not have matching dependencies available in th

For more details, please check the issue: [#329](https://github.com/slgobinath/SafeEyes/issues/329)

This method has the same caveats about icons/window icons as running from source.

## Features

- Remind you to take breaks with exercises to reduce RSI
Expand Down
2 changes: 1 addition & 1 deletion safeeyes/glade/about_dialog.glade
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ along with this program. If not, see &lt;https://www.gnu.org/licenses/&gt;.</pr
<object class="GtkWindow" id="window_about">
<property name="title">Safe Eyes</property>
<property name="resizable">0</property>
<property name="icon-name">safeeyes</property>
<property name="icon-name">io.github.slgobinath.SafeEyes</property>
<child>
<object class="GtkBox" id="layout_box">
<property name="visible">1</property>
Expand Down
2 changes: 1 addition & 1 deletion safeeyes/glade/break_screen.glade
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<interface>
<requires lib="gtk" version="4.0"/>
<object class="GtkWindow" id="window_main">
<property name="icon_name">safeeyes</property>
<property name="icon-name">io.github.slgobinath.SafeEyes</property>
<property name="decorated">0</property>
<property name="deletable">0</property>
<child>
Expand Down
2 changes: 1 addition & 1 deletion safeeyes/glade/new_break.glade
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<property name="default-width">500</property>
<property name="default-height">50</property>
<property name="destroy-with-parent">1</property>
<property name="icon-name">safeeyes</property>
<property name="icon-name">io.github.slgobinath.SafeEyes</property>
<child>
<object class="GtkBox" id="box_settings">
<property name="visible">1</property>
Expand Down
2 changes: 1 addition & 1 deletion safeeyes/glade/settings_break.glade
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<property name="default-width">500</property>
<property name="default-height">50</property>
<property name="destroy-with-parent">1</property>
<property name="icon-name">safeeyes</property>
<property name="icon-name">io.github.slgobinath.SafeEyes</property>
<child>
<object class="GtkBox" id="box_settings">
<property name="visible">1</property>
Expand Down
2 changes: 1 addition & 1 deletion safeeyes/glade/settings_plugin.glade
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<property name="default-width">400</property>
<property name="default-height">10</property>
<property name="destroy-with-parent">1</property>
<property name="icon-name">safeeyes</property>
<property name="icon-name">io.github.slgobinath.SafeEyes</property>
<child>
<object class="GtkBox" id="box_settings">
<property name="visible">1</property>
Expand Down
12 changes: 9 additions & 3 deletions safeeyes/safeeyes.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ def do_startup(self):
self.context["session"] = {"plugin": {}}

self.break_screen = BreakScreen(
self.context, self.on_skipped, self.on_postponed, utility.STYLE_SHEET_PATH
self,
self.context,
self.on_skipped,
self.on_postponed,
utility.STYLE_SHEET_PATH,
)
self.break_screen.initialize(self.config)
self.plugins_manager = PluginManager()
Expand Down Expand Up @@ -193,7 +197,9 @@ def show_settings(self):
if not self.settings_dialog_active:
logging.info("Show Settings dialog")
self.settings_dialog_active = True
settings_dialog = SettingsDialog(self.config.clone(), self.save_settings)
settings_dialog = SettingsDialog(
self, self.config.clone(), self.save_settings
)
settings_dialog.show()

def show_required_plugin_dialog(self, error: RequiredPluginException):
Expand Down Expand Up @@ -228,7 +234,7 @@ def show_about(self):
dialog.
"""
logging.info("Show About dialog")
about_dialog = AboutDialog(SAFE_EYES_VERSION)
about_dialog = AboutDialog(self, SAFE_EYES_VERSION)
about_dialog.show()

def quit(self):
Expand Down
3 changes: 2 additions & 1 deletion safeeyes/ui/about_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ class AboutDialog:
license and the GitHub url.
"""

def __init__(self, version):
def __init__(self, application, version):
builder = utility.create_gtk_builder(ABOUT_DIALOG_GLADE)
self.window = builder.get_object("window_about")
self.window.set_application(application)

self.window.connect("close-request", self.on_window_delete)
builder.get_object("btn_close").connect("clicked", self.on_close_clicked)
Expand Down
6 changes: 5 additions & 1 deletion safeeyes/ui/break_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ class BreakScreen:
interface.
"""

def __init__(self, context, on_skipped, on_postponed, style_sheet_path):
def __init__(
self, application, context, on_skipped, on_postponed, style_sheet_path
):
self.application = application
self.context = context
self.count_labels = []
self.x11_display = None
Expand Down Expand Up @@ -162,6 +165,7 @@ def __show_break_screen(self, message, image_path, widget, tray_actions):
builder.add_from_file(BREAK_SCREEN_GLADE)

window = builder.get_object("window_main")
window.set_application(self.application)
window.connect("close-request", self.on_window_delete)
window.set_title("SafeEyes-" + str(i))
lbl_message = builder.get_object("lbl_message")
Expand Down
26 changes: 20 additions & 6 deletions safeeyes/ui/settings_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
class SettingsDialog:
"""Create and initialize SettingsDialog instance."""

def __init__(self, config, on_save_settings):
def __init__(self, application, config, on_save_settings):
self.application = application
self.config = config
self.on_save_settings = on_save_settings
self.plugin_switches = {}
Expand All @@ -67,6 +68,7 @@ def __init__(self, config, on_save_settings):
builder = utility.create_gtk_builder(SETTINGS_DIALOG_GLADE)

self.window = builder.get_object("window_settings")
self.window.set_application(application)
self.box_short_breaks = builder.get_object("box_short_breaks")
self.box_long_breaks = builder.get_object("box_long_breaks")
self.box_plugins = builder.get_object("box_plugins")
Expand Down Expand Up @@ -291,7 +293,7 @@ def __create_plugin_item(self, plugin_config):

def __show_plugins_properties_dialog(self, plugin_config):
"""Show the PluginProperties dialog."""
dialog = PluginSettingsDialog(plugin_config)
dialog = PluginSettingsDialog(self.application, plugin_config)
dialog.show()

def __disable_errored_plugin(self, button, plugin_config):
Expand All @@ -304,7 +306,14 @@ def __show_break_properties_dialog(
):
"""Show the BreakProperties dialog."""
dialog = BreakSettingsDialog(
break_config, is_short, parent, self.plugin_map, on_close, on_add, on_remove
self.application,
break_config,
is_short,
parent,
self.plugin_map,
on_close,
on_add,
on_remove,
)
dialog.show()

Expand Down Expand Up @@ -363,9 +372,10 @@ def on_warn_bar_rpc_server_close(self, warnbar, *user_data):
"""Event handler for warning bar close action."""
self.warn_bar_rpc_server.hide()

def add_break(self, button):
def add_break(self, button) -> None:
"""Event handler for add break button."""
dialog = NewBreakDialog(
self.application,
self.config,
lambda is_short, break_config: self.__create_break_item(
break_config, is_short
Expand Down Expand Up @@ -413,12 +423,13 @@ def on_window_delete(self, *args):
class PluginSettingsDialog:
"""Builds a settings dialog based on the configuration of a plugin."""

def __init__(self, config):
def __init__(self, application, config):
self.config = config
self.property_controls = []

builder = utility.create_gtk_builder(SETTINGS_DIALOG_PLUGIN_GLADE)
self.window = builder.get_object("dialog_settings_plugin")
self.window.set_application(application)
box_settings = builder.get_object("box_settings")
self.window.set_title(_("Plugin Settings"))
for setting in config.get("settings"):
Expand Down Expand Up @@ -505,6 +516,7 @@ class BreakSettingsDialog:

def __init__(
self,
application,
break_config,
is_short,
parent_config,
Expand All @@ -523,6 +535,7 @@ def __init__(

builder = utility.create_gtk_builder(SETTINGS_DIALOG_BREAK_GLADE)
self.window = builder.get_object("dialog_settings_break")
self.window.set_application(application)
self.txt_break = builder.get_object("txt_break")
self.switch_override_interval = builder.get_object("switch_override_interval")
self.switch_override_duration = builder.get_object("switch_override_duration")
Expand Down Expand Up @@ -702,12 +715,13 @@ def show(self):
class NewBreakDialog:
"""Builds a new break dialog."""

def __init__(self, parent_config, on_add):
def __init__(self, application, parent_config, on_add):
self.parent_config = parent_config
self.on_add = on_add

builder = utility.create_gtk_builder(SETTINGS_DIALOG_NEW_BREAK_GLADE)
self.window = builder.get_object("dialog_new_break")
self.window.set_application(application)
self.txt_break = builder.get_object("txt_break")
self.cmb_type = builder.get_object("cmb_type")
list_types = builder.get_object("lst_break_types")
Expand Down