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
This commit is contained in:
Onur Alp Akin 2023-05-10 12:45:38 +03:00 committed by GitHub
parent 45a633d31f
commit 684d16265a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 113 additions and 52 deletions

View File

@ -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:

View File

@ -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
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

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -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;

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>io.github.slgobinath.SafeEyes</id>
<name>Safe Eyes</name>
<developer_name>Gobinath</developer_name>
<summary>A Free and Open Source tool for Linux users to reduce and prevent repetitive strain
injury (RSI).</summary>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0</project_license>
<categories>
<category>Utility</category>
<category>Accessibility</category>
</categories>
<description>
<p>
Protect your eyes from eye strain using this simple and beautiful, yet extensible break
reminder
</p>
<p>
Features:
</p>
<p>
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
</p>
</description>
<launchable type="desktop-id">io.github.slgobinath.SafeEyes.desktop</launchable>
<screenshots>
<screenshot type="default">
<image>https://slgobinath.github.io/SafeEyes/assets/screenshots/safeeyes_1.png</image>
</screenshot>
<screenshot>
<image>https://slgobinath.github.io/SafeEyes/assets/screenshots/safeeyes_3.png</image>
</screenshot>
<screenshot>
<image>https://slgobinath.github.io/SafeEyes/assets/screenshots/safeeyes_6.png</image>
</screenshot>
</screenshots>
<url type="homepage">https://slgobinath.github.io/SafeEyes/</url>
<releases>
<release version="2.1.5" date="2023-01-06" />
</releases>
<content_rating type="oars-1.1" />
</component>

View File

@ -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:

View File

@ -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):
"""

View File

@ -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)

View File

@ -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):