From 684d16265a48794bb3fd670da67283fe4e2f591b Mon Sep 17 00:00:00 2001 From: Onur Alp Akin Date: Wed, 10 May 2023 12:45:38 +0300 Subject: [PATCH] Reverse-DNS scheme for icons & Broken initialize logic fix & Add appstream (#519) * Add appstream * rename platform files reverse-dns format * rename debian install file reverse-dns format * rename usages reverse-dns format * Respect XDG_CONFIG while initializing safeeyes Instead of using custom variable to define target; Continue respecting XDG specs https://github.com/slgobinath/SafeEyes/issues/432#issuecomment-883829334 * move appstream under platform * add flathub badge * update flathub badge & flatpak installation --- README.md | 7 +++ debian/safeeyes.install | 34 +++++------ ....png => io.github.slgobinath.SafeEyes.png} | Bin ....png => io.github.slgobinath.SafeEyes.png} | Bin ...o.github.slgobinath.SafeEyes-disabled.png} | Bin ...io.github.slgobinath.SafeEyes-enabled.png} | Bin ...> io.github.slgobinath.SafeEyes-timer.png} | Bin ....png => io.github.slgobinath.SafeEyes.png} | Bin ...o.github.slgobinath.SafeEyes-disabled.png} | Bin ...io.github.slgobinath.SafeEyes-enabled.png} | Bin ...> io.github.slgobinath.SafeEyes-timer.png} | Bin ....png => io.github.slgobinath.SafeEyes.png} | Bin ...o.github.slgobinath.SafeEyes-disabled.png} | Bin ...io.github.slgobinath.SafeEyes-enabled.png} | Bin ....png => io.github.slgobinath.SafeEyes.png} | Bin ...o.github.slgobinath.SafeEyes-disabled.png} | Bin ...io.github.slgobinath.SafeEyes-enabled.png} | Bin ....png => io.github.slgobinath.SafeEyes.png} | Bin ... => io.github.slgobinath.SafeEyes.desktop} | 2 +- ...io.github.slgobinath.SafeEyes.metainfo.xml | 55 ++++++++++++++++++ safeeyes/plugins/notification/plugin.py | 2 +- safeeyes/plugins/trayicon/plugin.py | 22 +++---- safeeyes/utility.py | 21 ++++--- setup.py | 22 +++---- 24 files changed, 113 insertions(+), 52 deletions(-) rename safeeyes/platform/icons/hicolor/128x128/apps/{safeeyes.png => io.github.slgobinath.SafeEyes.png} (100%) rename safeeyes/platform/icons/hicolor/16x16/apps/{safeeyes.png => io.github.slgobinath.SafeEyes.png} (100%) rename safeeyes/platform/icons/hicolor/16x16/status/{safeeyes_disabled.png => io.github.slgobinath.SafeEyes-disabled.png} (100%) rename safeeyes/platform/icons/hicolor/16x16/status/{safeeyes_enabled.png => io.github.slgobinath.SafeEyes-enabled.png} (100%) rename safeeyes/platform/icons/hicolor/16x16/status/{safeeyes_timer.png => io.github.slgobinath.SafeEyes-timer.png} (100%) rename safeeyes/platform/icons/hicolor/24x24/apps/{safeeyes.png => io.github.slgobinath.SafeEyes.png} (100%) rename safeeyes/platform/icons/hicolor/24x24/status/{safeeyes_disabled.png => io.github.slgobinath.SafeEyes-disabled.png} (100%) rename safeeyes/platform/icons/hicolor/24x24/status/{safeeyes_enabled.png => io.github.slgobinath.SafeEyes-enabled.png} (100%) rename safeeyes/platform/icons/hicolor/24x24/status/{safeeyes_timer.png => io.github.slgobinath.SafeEyes-timer.png} (100%) rename safeeyes/platform/icons/hicolor/32x32/apps/{safeeyes.png => io.github.slgobinath.SafeEyes.png} (100%) rename safeeyes/platform/icons/hicolor/32x32/status/{safeeyes_disabled.png => io.github.slgobinath.SafeEyes-disabled.png} (100%) rename safeeyes/platform/icons/hicolor/32x32/status/{safeeyes_enabled.png => io.github.slgobinath.SafeEyes-enabled.png} (100%) rename safeeyes/platform/icons/hicolor/48x48/apps/{safeeyes.png => io.github.slgobinath.SafeEyes.png} (100%) rename safeeyes/platform/icons/hicolor/48x48/status/{safeeyes_disabled.png => io.github.slgobinath.SafeEyes-disabled.png} (100%) rename safeeyes/platform/icons/hicolor/48x48/status/{safeeyes_enabled.png => io.github.slgobinath.SafeEyes-enabled.png} (100%) rename safeeyes/platform/icons/hicolor/64x64/apps/{safeeyes.png => io.github.slgobinath.SafeEyes.png} (100%) rename safeeyes/platform/{safeeyes.desktop => io.github.slgobinath.SafeEyes.desktop} (97%) create mode 100644 safeeyes/platform/io.github.slgobinath.SafeEyes.metainfo.xml diff --git a/README.md b/README.md index 3f38d94..617e009 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![PyPI version](https://badge.fury.io/py/safeeyes.svg)](https://badge.fury.io/py/safeeyes) [![Debian](https://badges.debian.net/badges/debian/unstable/safeeyes/version.svg)](https://packages.debian.org/unstable/safeeyes) [![AUR](https://img.shields.io/aur/version/safeeyes)](https://aur.archlinux.org/packages/safeeyes) +[![Flathub](https://img.shields.io/flathub/v/io.github.slgobinath.SafeEyes)](https://flathub.org/apps/details/io.github.slgobinath.SafeEyes) [![Translation status](https://hosted.weblate.org/widgets/safe-eyes/-/translations/svg-badge.svg)](https://hosted.weblate.org/engage/safe-eyes/?utm_source=widget) [![Awesome Humane Tech](https://raw.githubusercontent.com/humanetech-community/awesome-humane-tech/main/humane-tech-badge.svg?sanitize=true)](https://github.com/humanetech-community/awesome-humane-tech) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/slgobinath) @@ -84,6 +85,12 @@ sudo zypper install safeeyes sudo apk add safeeyes ``` +### Flatpak + +```bash +flatpak install flathub io.github.slgobinath.SafeEyes +``` + ### Other Linux & Run from source Ensure to meet the following dependencies: diff --git a/debian/safeeyes.install b/debian/safeeyes.install index 0a32b7b..ebbb108 100644 --- a/debian/safeeyes.install +++ b/debian/safeeyes.install @@ -1,17 +1,17 @@ -safeeyes/platform/safeeyes.desktop usr/share/applications -safeeyes/platform/icons/hicolor/128x128/apps/safeeyes.png usr/share/icons/hicolor/128x128/apps -safeeyes/platform/icons/hicolor/16x16/apps/safeeyes.png usr/share/icons/hicolor/16x16/apps -safeeyes/platform/icons/hicolor/16x16/status/safeeyes_disabled.png usr/share/icons/hicolor/16x16/status -safeeyes/platform/icons/hicolor/16x16/status/safeeyes_enabled.png usr/share/icons/hicolor/16x16/status -safeeyes/platform/icons/hicolor/16x16/status/safeeyes_timer.png usr/share/icons/hicolor/16x16/status -safeeyes/platform/icons/hicolor/24x24/apps/safeeyes.png usr/share/icons/hicolor/24x24/apps -safeeyes/platform/icons/hicolor/24x24/status/safeeyes_disabled.png usr/share/icons/hicolor/24x24/status -safeeyes/platform/icons/hicolor/24x24/status/safeeyes_enabled.png usr/share/icons/hicolor/24x24/status -safeeyes/platform/icons/hicolor/24x24/status/safeeyes_timer.png usr/share/icons/hicolor/24x24/status -safeeyes/platform/icons/hicolor/32x32/apps/safeeyes.png usr/share/icons/hicolor/32x32/apps -safeeyes/platform/icons/hicolor/32x32/status/safeeyes_disabled.png usr/share/icons/hicolor/32x32/status -safeeyes/platform/icons/hicolor/32x32/status/safeeyes_enabled.png usr/share/icons/hicolor/32x32/status -safeeyes/platform/icons/hicolor/48x48/apps/safeeyes.png usr/share/icons/hicolor/48x48/apps -safeeyes/platform/icons/hicolor/48x48/status/safeeyes_disabled.png usr/share/icons/hicolor/48x48/status -safeeyes/platform/icons/hicolor/48x48/status/safeeyes_enabled.png usr/share/icons/hicolor/48x48/status -safeeyes/platform/icons/hicolor/64x64/apps/safeeyes.png usr/share/icons/hicolor/64x64/apps \ No newline at end of file +safeeyes/platform/io.github.slgobinath.SafeEyes.desktop usr/share/applications +safeeyes/platform/icons/hicolor/128x128/apps/io.github.slgobinath.SafeEyes.png usr/share/icons/hicolor/128x128/apps +safeeyes/platform/icons/hicolor/16x16/apps/io.github.slgobinath.SafeEyes.png usr/share/icons/hicolor/16x16/apps +safeeyes/platform/icons/hicolor/16x16/status/io.github.slgobinath.SafeEyes-disabled.png usr/share/icons/hicolor/16x16/status +safeeyes/platform/icons/hicolor/16x16/status/io.github.slgobinath.SafeEyes-enabled.png usr/share/icons/hicolor/16x16/status +safeeyes/platform/icons/hicolor/16x16/status/io.github.slgobinath.SafeEyes-timer.png usr/share/icons/hicolor/16x16/status +safeeyes/platform/icons/hicolor/24x24/apps/io.github.slgobinath.SafeEyes.png usr/share/icons/hicolor/24x24/apps +safeeyes/platform/icons/hicolor/24x24/status/io.github.slgobinath.SafeEyes-disabled.png usr/share/icons/hicolor/24x24/status +safeeyes/platform/icons/hicolor/24x24/status/io.github.slgobinath.SafeEyes-enabled.png usr/share/icons/hicolor/24x24/status +safeeyes/platform/icons/hicolor/24x24/status/io.github.slgobinath.SafeEyes-timer.png usr/share/icons/hicolor/24x24/status +safeeyes/platform/icons/hicolor/32x32/apps/io.github.slgobinath.SafeEyes.png usr/share/icons/hicolor/32x32/apps +safeeyes/platform/icons/hicolor/32x32/status/io.github.slgobinath.SafeEyes-disabled.png usr/share/icons/hicolor/32x32/status +safeeyes/platform/icons/hicolor/32x32/status/io.github.slgobinath.SafeEyes-enabled.png usr/share/icons/hicolor/32x32/status +safeeyes/platform/icons/hicolor/48x48/apps/io.github.slgobinath.SafeEyes.png usr/share/icons/hicolor/48x48/apps +safeeyes/platform/icons/hicolor/48x48/status/io.github.slgobinath.SafeEyes-disabled.png usr/share/icons/hicolor/48x48/status +safeeyes/platform/icons/hicolor/48x48/status/io.github.slgobinath.SafeEyes-enabled.png usr/share/icons/hicolor/48x48/status +safeeyes/platform/icons/hicolor/64x64/apps/io.github.slgobinath.SafeEyes.png usr/share/icons/hicolor/64x64/apps \ No newline at end of file diff --git a/safeeyes/platform/icons/hicolor/128x128/apps/safeeyes.png b/safeeyes/platform/icons/hicolor/128x128/apps/io.github.slgobinath.SafeEyes.png similarity index 100% rename from safeeyes/platform/icons/hicolor/128x128/apps/safeeyes.png rename to safeeyes/platform/icons/hicolor/128x128/apps/io.github.slgobinath.SafeEyes.png diff --git a/safeeyes/platform/icons/hicolor/16x16/apps/safeeyes.png b/safeeyes/platform/icons/hicolor/16x16/apps/io.github.slgobinath.SafeEyes.png similarity index 100% rename from safeeyes/platform/icons/hicolor/16x16/apps/safeeyes.png rename to safeeyes/platform/icons/hicolor/16x16/apps/io.github.slgobinath.SafeEyes.png diff --git a/safeeyes/platform/icons/hicolor/16x16/status/safeeyes_disabled.png b/safeeyes/platform/icons/hicolor/16x16/status/io.github.slgobinath.SafeEyes-disabled.png similarity index 100% rename from safeeyes/platform/icons/hicolor/16x16/status/safeeyes_disabled.png rename to safeeyes/platform/icons/hicolor/16x16/status/io.github.slgobinath.SafeEyes-disabled.png diff --git a/safeeyes/platform/icons/hicolor/16x16/status/safeeyes_enabled.png b/safeeyes/platform/icons/hicolor/16x16/status/io.github.slgobinath.SafeEyes-enabled.png similarity index 100% rename from safeeyes/platform/icons/hicolor/16x16/status/safeeyes_enabled.png rename to safeeyes/platform/icons/hicolor/16x16/status/io.github.slgobinath.SafeEyes-enabled.png diff --git a/safeeyes/platform/icons/hicolor/16x16/status/safeeyes_timer.png b/safeeyes/platform/icons/hicolor/16x16/status/io.github.slgobinath.SafeEyes-timer.png similarity index 100% rename from safeeyes/platform/icons/hicolor/16x16/status/safeeyes_timer.png rename to safeeyes/platform/icons/hicolor/16x16/status/io.github.slgobinath.SafeEyes-timer.png diff --git a/safeeyes/platform/icons/hicolor/24x24/apps/safeeyes.png b/safeeyes/platform/icons/hicolor/24x24/apps/io.github.slgobinath.SafeEyes.png similarity index 100% rename from safeeyes/platform/icons/hicolor/24x24/apps/safeeyes.png rename to safeeyes/platform/icons/hicolor/24x24/apps/io.github.slgobinath.SafeEyes.png diff --git a/safeeyes/platform/icons/hicolor/24x24/status/safeeyes_disabled.png b/safeeyes/platform/icons/hicolor/24x24/status/io.github.slgobinath.SafeEyes-disabled.png similarity index 100% rename from safeeyes/platform/icons/hicolor/24x24/status/safeeyes_disabled.png rename to safeeyes/platform/icons/hicolor/24x24/status/io.github.slgobinath.SafeEyes-disabled.png diff --git a/safeeyes/platform/icons/hicolor/24x24/status/safeeyes_enabled.png b/safeeyes/platform/icons/hicolor/24x24/status/io.github.slgobinath.SafeEyes-enabled.png similarity index 100% rename from safeeyes/platform/icons/hicolor/24x24/status/safeeyes_enabled.png rename to safeeyes/platform/icons/hicolor/24x24/status/io.github.slgobinath.SafeEyes-enabled.png diff --git a/safeeyes/platform/icons/hicolor/24x24/status/safeeyes_timer.png b/safeeyes/platform/icons/hicolor/24x24/status/io.github.slgobinath.SafeEyes-timer.png similarity index 100% rename from safeeyes/platform/icons/hicolor/24x24/status/safeeyes_timer.png rename to safeeyes/platform/icons/hicolor/24x24/status/io.github.slgobinath.SafeEyes-timer.png diff --git a/safeeyes/platform/icons/hicolor/32x32/apps/safeeyes.png b/safeeyes/platform/icons/hicolor/32x32/apps/io.github.slgobinath.SafeEyes.png similarity index 100% rename from safeeyes/platform/icons/hicolor/32x32/apps/safeeyes.png rename to safeeyes/platform/icons/hicolor/32x32/apps/io.github.slgobinath.SafeEyes.png diff --git a/safeeyes/platform/icons/hicolor/32x32/status/safeeyes_disabled.png b/safeeyes/platform/icons/hicolor/32x32/status/io.github.slgobinath.SafeEyes-disabled.png similarity index 100% rename from safeeyes/platform/icons/hicolor/32x32/status/safeeyes_disabled.png rename to safeeyes/platform/icons/hicolor/32x32/status/io.github.slgobinath.SafeEyes-disabled.png diff --git a/safeeyes/platform/icons/hicolor/32x32/status/safeeyes_enabled.png b/safeeyes/platform/icons/hicolor/32x32/status/io.github.slgobinath.SafeEyes-enabled.png similarity index 100% rename from safeeyes/platform/icons/hicolor/32x32/status/safeeyes_enabled.png rename to safeeyes/platform/icons/hicolor/32x32/status/io.github.slgobinath.SafeEyes-enabled.png diff --git a/safeeyes/platform/icons/hicolor/48x48/apps/safeeyes.png b/safeeyes/platform/icons/hicolor/48x48/apps/io.github.slgobinath.SafeEyes.png similarity index 100% rename from safeeyes/platform/icons/hicolor/48x48/apps/safeeyes.png rename to safeeyes/platform/icons/hicolor/48x48/apps/io.github.slgobinath.SafeEyes.png diff --git a/safeeyes/platform/icons/hicolor/48x48/status/safeeyes_disabled.png b/safeeyes/platform/icons/hicolor/48x48/status/io.github.slgobinath.SafeEyes-disabled.png similarity index 100% rename from safeeyes/platform/icons/hicolor/48x48/status/safeeyes_disabled.png rename to safeeyes/platform/icons/hicolor/48x48/status/io.github.slgobinath.SafeEyes-disabled.png diff --git a/safeeyes/platform/icons/hicolor/48x48/status/safeeyes_enabled.png b/safeeyes/platform/icons/hicolor/48x48/status/io.github.slgobinath.SafeEyes-enabled.png similarity index 100% rename from safeeyes/platform/icons/hicolor/48x48/status/safeeyes_enabled.png rename to safeeyes/platform/icons/hicolor/48x48/status/io.github.slgobinath.SafeEyes-enabled.png diff --git a/safeeyes/platform/icons/hicolor/64x64/apps/safeeyes.png b/safeeyes/platform/icons/hicolor/64x64/apps/io.github.slgobinath.SafeEyes.png similarity index 100% rename from safeeyes/platform/icons/hicolor/64x64/apps/safeeyes.png rename to safeeyes/platform/icons/hicolor/64x64/apps/io.github.slgobinath.SafeEyes.png diff --git a/safeeyes/platform/safeeyes.desktop b/safeeyes/platform/io.github.slgobinath.SafeEyes.desktop similarity index 97% rename from safeeyes/platform/safeeyes.desktop rename to safeeyes/platform/io.github.slgobinath.SafeEyes.desktop index 9d1ecbb..5d88bb9 100644 --- a/safeeyes/platform/safeeyes.desktop +++ b/safeeyes/platform/io.github.slgobinath.SafeEyes.desktop @@ -25,7 +25,7 @@ Comment[tr]=Gözünüzü yorgunluğa karşı koruyun Comment[uk]=Захистіть свої очі від втоми Comment[vi]=Bảo vệ đôi mắt của bạn khỏi sự mệt mỏi Exec=env GDK_BACKEND=x11 safeeyes -Icon=safeeyes +Icon=io.github.slgobinath.SafeEyes Terminal=false Type=Application Categories=Utility; diff --git a/safeeyes/platform/io.github.slgobinath.SafeEyes.metainfo.xml b/safeeyes/platform/io.github.slgobinath.SafeEyes.metainfo.xml new file mode 100644 index 0000000..82ee77c --- /dev/null +++ b/safeeyes/platform/io.github.slgobinath.SafeEyes.metainfo.xml @@ -0,0 +1,55 @@ + + + io.github.slgobinath.SafeEyes + + Safe Eyes + Gobinath + A Free and Open Source tool for Linux users to reduce and prevent repetitive strain + injury (RSI). + + CC0-1.0 + GPL-3.0 + + + Utility + Accessibility + + + +

+ Protect your eyes from eye strain using this simple and beautiful, yet extensible break + reminder +

+

+ Features: +

+

+ Remind you to take breaks with exercises to reduce RSI, Disable keyboard during breaks, + Notification before and after breaks, Smart pause if system is idle, Multi-screen + support, Customizable user interface, RPC API to control externally, Command-line + arguments to control the running instance, Customizable using plug-ins +

+
+ + io.github.slgobinath.SafeEyes.desktop + + + https://slgobinath.github.io/SafeEyes/assets/screenshots/safeeyes_1.png + + + https://slgobinath.github.io/SafeEyes/assets/screenshots/safeeyes_3.png + + + https://slgobinath.github.io/SafeEyes/assets/screenshots/safeeyes_6.png + + + + https://slgobinath.github.io/SafeEyes/ + + + + + + + +
\ No newline at end of file diff --git a/safeeyes/plugins/notification/plugin.py b/safeeyes/plugins/notification/plugin.py index 8dac053..ed4a0e8 100644 --- a/safeeyes/plugins/notification/plugin.py +++ b/safeeyes/plugins/notification/plugin.py @@ -60,7 +60,7 @@ def on_pre_break(break_obj): else: message += (_('Ready for a long break in %s seconds') % warning_time) - notification = Notify.Notification.new('Safe Eyes', message, icon='safeeyes_enabled') + notification = Notify.Notification.new('Safe Eyes', message, icon='io.github.slgobinath.SafeEyes-enabled') try: notification.show() except BaseException: diff --git a/safeeyes/plugins/trayicon/plugin.py b/safeeyes/plugins/trayicon/plugin.py index de90326..061535a 100644 --- a/safeeyes/plugins/trayicon/plugin.py +++ b/safeeyes/plugins/trayicon/plugin.py @@ -68,7 +68,7 @@ class TrayIcon: # Construct the tray icon self.indicator = appindicator.Indicator.new( - APPINDICATOR_ID, "safeeyes_enabled", appindicator.IndicatorCategory.APPLICATION_STATUS) + APPINDICATOR_ID, "io.github.slgobinath.SafeEyes-enabled", appindicator.IndicatorCategory.APPLICATION_STATUS) self.indicator.set_status(appindicator.IndicatorStatus.ACTIVE) # Construct the context menu @@ -77,7 +77,7 @@ class TrayIcon: # Next break info menu item self.item_info = Gtk.ImageMenuItem() img_timer = Gtk.Image() - img_timer.set_from_icon_name("safeeyes_timer", 16) + img_timer.set_from_icon_name("io.github.slgobinath.SafeEyes-timer", 16) self.item_info.set_image(img_timer) self.item_separator = Gtk.SeparatorMenuItem() @@ -206,18 +206,18 @@ class TrayIcon: if self.active: if self.date_time: self.__set_next_break_info() - self.indicator.set_icon("safeeyes_enabled") + self.indicator.set_icon("io.github.slgobinath.SafeEyes-enabled") else: if self.wakeup_time: self.item_info.set_label(_('Disabled until %s') % utility.format_time(self.wakeup_time)) else: self.item_info.set_label(_('Disabled until restart')) self.indicator.set_label('', '') - self.indicator.set_icon("safeeyes_disabled") + self.indicator.set_icon("io.github.slgobinath.SafeEyes-disabled") else: self.item_info.set_label(_('No Breaks Available')) self.indicator.set_label('', '') - self.indicator.set_icon("safeeyes_disabled") + self.indicator.set_icon("io.github.slgobinath.SafeEyes-disabled") self.item_info.set_sensitive(breaks_found and self.active) self.item_enable.set_sensitive(breaks_found and not self.active) self.item_disable.set_sensitive(breaks_found and self.active) @@ -360,7 +360,7 @@ class TrayIcon: if self.active: logging.info('Disable Safe Eyes') self.active = False - self.indicator.set_icon("safeeyes_disabled") + self.indicator.set_icon("io.github.slgobinath.SafeEyes-disabled") self.item_info.set_label(_('Disabled until restart')) self.indicator.set_label('', '') self.item_info.set_sensitive(False) @@ -375,7 +375,7 @@ class TrayIcon: if not self.active: logging.info('Enable Safe Eyes') self.active = True - self.indicator.set_icon("safeeyes_enabled") + self.indicator.set_icon("io.github.slgobinath.SafeEyes-enabled") self.item_info.set_sensitive(True) self.item_enable.set_sensitive(False) self.item_disable.set_sensitive(True) @@ -396,9 +396,9 @@ class TrayIcon: def start_animation(self): if not self.active or not self.animate: return - utility.execute_main_thread(lambda: self.indicator.set_icon("safeeyes_disabled")) + utility.execute_main_thread(lambda: self.indicator.set_icon("io.github.slgobinath.SafeEyes-disabled")) time.sleep(0.5) - utility.execute_main_thread(lambda: self.indicator.set_icon("safeeyes_enabled")) + utility.execute_main_thread(lambda: self.indicator.set_icon("io.github.slgobinath.SafeEyes-enabled")) if self.animate and self.active: time.sleep(0.5) if self.animate and self.active: @@ -407,9 +407,9 @@ class TrayIcon: def stop_animation(self): self.animate = False if self.active: - utility.execute_main_thread(lambda: self.indicator.set_icon("safeeyes_enabled")) + utility.execute_main_thread(lambda: self.indicator.set_icon("io.github.slgobinath.SafeEyes-enabled")) else: - utility.execute_main_thread(lambda: self.indicator.set_icon("safeeyes_disabled")) + utility.execute_main_thread(lambda: self.indicator.set_icon("io.github.slgobinath.SafeEyes-disabled")) def init(ctx, safeeyes_cfg, plugin_config): """ diff --git a/safeeyes/utility.py b/safeeyes/utility.py index 7e08735..76803e5 100644 --- a/safeeyes/utility.py +++ b/safeeyes/utility.py @@ -51,10 +51,11 @@ BIN_DIRECTORY = os.path.dirname(os.path.realpath(__file__)) HOME_DIRECTORY = os.environ.get('HOME') or os.path.expanduser('~') CONFIG_DIRECTORY = os.path.join(os.environ.get( 'XDG_CONFIG_HOME') or os.path.join(HOME_DIRECTORY, '.config'), 'safeeyes') +STYLE_SHEET_DIRECTORY = os.path.join(CONFIG_DIRECTORY, 'style') CONFIG_FILE_PATH = os.path.join(CONFIG_DIRECTORY, 'safeeyes.json') CONFIG_RESOURCE = os.path.join(CONFIG_DIRECTORY, 'resource') SESSION_FILE_PATH = os.path.join(CONFIG_DIRECTORY, 'session.json') -STYLE_SHEET_PATH = os.path.join(CONFIG_DIRECTORY, 'style/safeeyes_style.css') +STYLE_SHEET_PATH = os.path.join(STYLE_SHEET_DIRECTORY, 'safeeyes_style.css') SYSTEM_CONFIG_FILE_PATH = os.path.join(BIN_DIRECTORY, "config/safeeyes.json") SYSTEM_STYLE_SHEET_PATH = os.path.join( BIN_DIRECTORY, "config/style/safeeyes_style.css") @@ -62,7 +63,7 @@ LOG_FILE_PATH = os.path.join(HOME_DIRECTORY, 'safeeyes.log') SYSTEM_PLUGINS_DIR = os.path.join(BIN_DIRECTORY, 'plugins') USER_PLUGINS_DIR = os.path.join(CONFIG_DIRECTORY, 'plugins') LOCALE_PATH = os.path.join(BIN_DIRECTORY, 'config/locale') -SYSTEM_DESKTOP_FILE = os.path.join(BIN_DIRECTORY, "platform/safeeyes.desktop") +SYSTEM_DESKTOP_FILE = os.path.join(BIN_DIRECTORY, "platform/io.github.slgobinath.SafeEyes.desktop") SYSTEM_ICONS = os.path.join(BIN_DIRECTORY, "platform/icons") DESKTOP_ENVIRONMENT = None IS_WAYLAND = False @@ -371,17 +372,15 @@ def merge_configs(new_config, old_config): def initialize_safeeyes(): """ - Create the config file and style sheet in ~/.config/safeeyes directory. + Create the config file and style sheet in XDG_CONFIG_HOME(or ~/.config)/safeeyes directory. """ - logging.info('Copy the config files to ~/.config/safeeyes') - - style_dir_path = os.path.join(HOME_DIRECTORY, '.config/safeeyes/style') + logging.info('Copy the config files to XDG_CONFIG_HOME(or ~/.config)/safeeyes') # Remove the ~/.config/safeeyes/safeeyes.json file delete(CONFIG_FILE_PATH) - # Create the ~/.config/safeeyes/style directory - mkdir(style_dir_path) + # Create the XDG_CONFIG_HOME(or ~/.config)/safeeyes/style directory + mkdir(STYLE_SHEET_DIRECTORY) # Copy the safeeyes.json shutil.copy2(SYSTEM_CONFIG_FILE_PATH, CONFIG_FILE_PATH) @@ -400,7 +399,7 @@ def create_startup_entry(): Create start up entry. """ startup_dir_path = os.path.join(HOME_DIRECTORY, '.config/autostart') - startup_entry = os.path.join(startup_dir_path, 'safeeyes.desktop') + startup_entry = os.path.join(startup_dir_path, 'io.github.slgobinath.SafeEyes.desktop') # Create the folder if not exist mkdir(startup_dir_path) @@ -423,13 +422,13 @@ def initialize_platform(): applications_dir_path = os.path.join(HOME_DIRECTORY, '.local/share/applications') icons_dir_path = os.path.join(HOME_DIRECTORY, '.local/share/icons') - desktop_entry = os.path.join(applications_dir_path, 'safeeyes.desktop') + desktop_entry = os.path.join(applications_dir_path, 'io.github.slgobinath.SafeEyes.desktop') # Create the folder if not exist mkdir(icons_dir_path) # Create a desktop entry - if not os.path.exists(os.path.join(sys.prefix, "share/applications/safeeyes.desktop")): + if not os.path.exists(os.path.join(sys.prefix, "share/applications/io.github.slgobinath.SafeEyes.desktop")): # Create the folder if not exist mkdir(applications_dir_path) diff --git a/setup.py b/setup.py index d04e820..4c2d736 100644 --- a/setup.py +++ b/setup.py @@ -41,17 +41,17 @@ def __data_files(): Collect the data files. """ root_dir = sys.prefix - return [(os.path.join(root_dir, "share/applications"), ["safeeyes/platform/safeeyes.desktop"]), - (os.path.join(root_dir, "share/icons/hicolor/24x24/status"), ["safeeyes/platform/icons/hicolor/24x24/status/safeeyes_disabled.png", "safeeyes/platform/icons/hicolor/24x24/status/safeeyes_enabled.png", "safeeyes/platform/icons/hicolor/24x24/status/safeeyes_timer.png"]), - (os.path.join(root_dir, "share/icons/hicolor/24x24/apps"), ["safeeyes/platform/icons/hicolor/24x24/apps/safeeyes.png"]), - (os.path.join(root_dir, "share/icons/hicolor/16x16/status"), ["safeeyes/platform/icons/hicolor/16x16/status/safeeyes_disabled.png", "safeeyes/platform/icons/hicolor/16x16/status/safeeyes_enabled.png", "safeeyes/platform/icons/hicolor/16x16/status/safeeyes_timer.png"]), - (os.path.join(root_dir, "share/icons/hicolor/16x16/apps"), ["safeeyes/platform/icons/hicolor/16x16/apps/safeeyes.png"]), - (os.path.join(root_dir, "share/icons/hicolor/32x32/status"), ["safeeyes/platform/icons/hicolor/32x32/status/safeeyes_disabled.png", "safeeyes/platform/icons/hicolor/32x32/status/safeeyes_enabled.png"]), - (os.path.join(root_dir, "share/icons/hicolor/32x32/apps"), ["safeeyes/platform/icons/hicolor/32x32/apps/safeeyes.png"]), - (os.path.join(root_dir, "share/icons/hicolor/64x64/apps"), ["safeeyes/platform/icons/hicolor/64x64/apps/safeeyes.png"]), - (os.path.join(root_dir, "share/icons/hicolor/128x128/apps"), ["safeeyes/platform/icons/hicolor/128x128/apps/safeeyes.png"]), - (os.path.join(root_dir, "share/icons/hicolor/48x48/status"), ["safeeyes/platform/icons/hicolor/48x48/status/safeeyes_disabled.png", "safeeyes/platform/icons/hicolor/48x48/status/safeeyes_enabled.png"]), - (os.path.join(root_dir, "share/icons/hicolor/48x48/apps"), ["safeeyes/platform/icons/hicolor/48x48/apps/safeeyes.png"]),] + return [(os.path.join(root_dir, "share/applications"), ["safeeyes/platform/io.github.slgobinath.SafeEyes.desktop"]), + (os.path.join(root_dir, "share/icons/hicolor/24x24/status"), ["safeeyes/platform/icons/hicolor/24x24/status/io.github.slgobinath.SafeEyes-disabled.png", "safeeyes/platform/icons/hicolor/24x24/status/io.github.slgobinath.SafeEyes-enabled.png", "safeeyes/platform/icons/hicolor/24x24/status/io.github.slgobinath.SafeEyes-timer.png"]), + (os.path.join(root_dir, "share/icons/hicolor/24x24/apps"), ["safeeyes/platform/icons/hicolor/24x24/apps/io.github.slgobinath.SafeEyes.png"]), + (os.path.join(root_dir, "share/icons/hicolor/16x16/status"), ["safeeyes/platform/icons/hicolor/16x16/status/io.github.slgobinath.SafeEyes-disabled.png", "safeeyes/platform/icons/hicolor/16x16/status/io.github.slgobinath.SafeEyes-enabled.png", "safeeyes/platform/icons/hicolor/16x16/status/io.github.slgobinath.SafeEyes-timer.png"]), + (os.path.join(root_dir, "share/icons/hicolor/16x16/apps"), ["safeeyes/platform/icons/hicolor/16x16/apps/io.github.slgobinath.SafeEyes.png"]), + (os.path.join(root_dir, "share/icons/hicolor/32x32/status"), ["safeeyes/platform/icons/hicolor/32x32/status/io.github.slgobinath.SafeEyes-disabled.png", "safeeyes/platform/icons/hicolor/32x32/status/io.github.slgobinath.SafeEyes-enabled.png"]), + (os.path.join(root_dir, "share/icons/hicolor/32x32/apps"), ["safeeyes/platform/icons/hicolor/32x32/apps/io.github.slgobinath.SafeEyes.png"]), + (os.path.join(root_dir, "share/icons/hicolor/64x64/apps"), ["safeeyes/platform/icons/hicolor/64x64/apps/io.github.slgobinath.SafeEyes.png"]), + (os.path.join(root_dir, "share/icons/hicolor/128x128/apps"), ["safeeyes/platform/icons/hicolor/128x128/apps/io.github.slgobinath.SafeEyes.png"]), + (os.path.join(root_dir, "share/icons/hicolor/48x48/status"), ["safeeyes/platform/icons/hicolor/48x48/status/io.github.slgobinath.SafeEyes-disabled.png", "safeeyes/platform/icons/hicolor/48x48/status/io.github.slgobinath.SafeEyes-enabled.png"]), + (os.path.join(root_dir, "share/icons/hicolor/48x48/apps"), ["safeeyes/platform/icons/hicolor/48x48/apps/io.github.slgobinath.SafeEyes.png"]),] def __package_files(directory):