diff --git a/README.md b/README.md index ca6446fe..480a62c6 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/safeeyes/glade/about_dialog.glade b/safeeyes/glade/about_dialog.glade index 34429962..9bb73a58 100644 --- a/safeeyes/glade/about_dialog.glade +++ b/safeeyes/glade/about_dialog.glade @@ -38,7 +38,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. Safe Eyes 0 - safeeyes + io.github.slgobinath.SafeEyes 1 diff --git a/safeeyes/glade/break_screen.glade b/safeeyes/glade/break_screen.glade index 23b1e455..94d63915 100644 --- a/safeeyes/glade/break_screen.glade +++ b/safeeyes/glade/break_screen.glade @@ -21,7 +21,7 @@ - safeeyes + io.github.slgobinath.SafeEyes 0 0 diff --git a/safeeyes/glade/new_break.glade b/safeeyes/glade/new_break.glade index a379c6ec..88bff455 100644 --- a/safeeyes/glade/new_break.glade +++ b/safeeyes/glade/new_break.glade @@ -47,7 +47,7 @@ 500 50 1 - safeeyes + io.github.slgobinath.SafeEyes 1 diff --git a/safeeyes/glade/settings_break.glade b/safeeyes/glade/settings_break.glade index df2ecd7a..77830a36 100644 --- a/safeeyes/glade/settings_break.glade +++ b/safeeyes/glade/settings_break.glade @@ -54,7 +54,7 @@ 500 50 1 - safeeyes + io.github.slgobinath.SafeEyes 1 diff --git a/safeeyes/glade/settings_plugin.glade b/safeeyes/glade/settings_plugin.glade index d946089a..1a6c8fb1 100644 --- a/safeeyes/glade/settings_plugin.glade +++ b/safeeyes/glade/settings_plugin.glade @@ -28,7 +28,7 @@ 400 10 1 - safeeyes + io.github.slgobinath.SafeEyes 1 diff --git a/safeeyes/safeeyes.py b/safeeyes/safeeyes.py index 6d24172b..a43fcb3e 100644 --- a/safeeyes/safeeyes.py +++ b/safeeyes/safeeyes.py @@ -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() @@ -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): @@ -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): diff --git a/safeeyes/ui/about_dialog.py b/safeeyes/ui/about_dialog.py index 1f860643..62f3ed07 100644 --- a/safeeyes/ui/about_dialog.py +++ b/safeeyes/ui/about_dialog.py @@ -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) diff --git a/safeeyes/ui/break_screen.py b/safeeyes/ui/break_screen.py index 5a3fc3c6..c385d7f0 100644 --- a/safeeyes/ui/break_screen.py +++ b/safeeyes/ui/break_screen.py @@ -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 @@ -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") diff --git a/safeeyes/ui/settings_dialog.py b/safeeyes/ui/settings_dialog.py index e2fecbd6..03adf447 100644 --- a/safeeyes/ui/settings_dialog.py +++ b/safeeyes/ui/settings_dialog.py @@ -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 = {} @@ -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") @@ -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): @@ -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() @@ -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 @@ -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"): @@ -505,6 +516,7 @@ class BreakSettingsDialog: def __init__( self, + application, break_config, is_short, parent_config, @@ -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") @@ -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")