diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..c475c77
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,67 @@
+name: Release
+on:
+ push:
+ branches: [ release ]
+
+jobs:
+ release:
+ name: Release
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+ token: ${{ secrets.GH_API_SECRET }}
+
+ - name: Set up Python 3.10
+ uses: actions/setup-python@v3
+ with:
+ python-version: "3.10"
+
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install build
+
+ - name: Get Current Version
+ run: |
+ project_version=$(python3 setup.py --version)
+ echo "project_version=$project_version" >> $GITHUB_OUTPUT
+ id: get_current_version
+
+ - name: Create Tag
+ uses: mathieudutour/github-tag-action@v6.1
+ with:
+ custom_tag: "v${{steps.get_current_version.outputs.project_version}}"
+ github_token: ${{ secrets.GH_API_SECRET }}
+
+ - name: Build Changelog
+ id: build_changelog
+ uses: mikepenz/release-changelog-builder-action@v3.4.0
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_API_SECRET }}
+
+ - name: Create Release
+ uses: softprops/action-gh-release@v1
+ with:
+ tag_name: 'v${{steps.get_current_version.outputs.project_version}}'
+ body: ${{steps.build_changelog.outputs.changelog}}
+ token: ${{ secrets.GH_API_SECRET }}
+
+ - name: Build Python Package
+ run: rm -Rf build *.egg-info/ && python3 setup.py sdist bdist_wheel
+
+ - name: Publish to PyPi
+ uses: pypa/gh-action-pypi-publish@v1.6.4
+ with:
+ password: ${{ secrets.PYPI_API_TOKEN }}
+
+ - name: Sync Release with Master
+ run: |
+ git fetch origin
+ git checkout release
+ git pull origin release
+ git checkout master
+ git pull origin master
+ git merge release --ff-only
+ git push origin master
diff --git a/debian/changelog b/debian/changelog
index ddd0f91..1837ba4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-safeeyes (2.1.4-3) lunar; urgency=high
+safeeyes (2.1.5-0) lunar; urgency=high
* Minor bug fixes
* Fix the ecd ..rror if there is no long break
diff --git a/safeeyes/glade/about_dialog.glade b/safeeyes/glade/about_dialog.glade
index c78679f..16780f7 100644
--- a/safeeyes/glade/about_dialog.glade
+++ b/safeeyes/glade/about_dialog.glade
@@ -71,7 +71,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.center
10
10
- Safe Eyes 2.1.4
+ Safe Eyes 2.1.5
center
diff --git a/safeeyes/plugins/donotdisturb/plugin.py b/safeeyes/plugins/donotdisturb/plugin.py
index 207f6ba..5d17990 100644
--- a/safeeyes/plugins/donotdisturb/plugin.py
+++ b/safeeyes/plugins/donotdisturb/plugin.py
@@ -80,16 +80,15 @@ def is_active_window_skipped_xorg(pre_break):
# Extract the process name
process_names = re.findall('"(.+?)"', stdout)
if process_names:
- process = process_names[1].lower()
- if process in skip_break_window_classes:
+ process_name = process_names[1].lower()
+ if _window_class_matches(process_name, skip_break_window_classes):
return True
- elif process in take_break_window_classes:
+ elif _window_class_matches(process_name, take_break_window_classes):
if is_fullscreen and unfullscreen_allowed and not pre_break:
try:
active_window.unfullscreen()
- except BaseException:
- logging.error(
- 'Error in unfullscreen the window ' + process)
+ except BaseException as e:
+ logging.error('Error in unfullscreen the window ' + process_name, exc_info=e)
return False
return is_fullscreen
@@ -97,6 +96,10 @@ def is_active_window_skipped_xorg(pre_break):
return False
+def _window_class_matches(window_class: str, classes: list) -> bool:
+ return any(map(lambda w: w in classes, window_class.split()))
+
+
def is_on_battery():
"""
Check if the computer is running on battery.
@@ -131,12 +134,16 @@ def init(ctx, safeeyes_config, plugin_config):
global dnd_while_on_battery
logging.debug('Initialize Skip Fullscreen plugin')
context = ctx
- skip_break_window_classes = plugin_config['skip_break_windows'].split()
- take_break_window_classes = plugin_config['take_break_windows'].split()
+ skip_break_window_classes = _normalize_window_classes(plugin_config['skip_break_windows'])
+ take_break_window_classes = _normalize_window_classes(plugin_config['take_break_windows'])
unfullscreen_allowed = plugin_config['unfullscreen']
dnd_while_on_battery = plugin_config['while_on_battery']
+def _normalize_window_classes(classes_as_str: str):
+ return [w.lower() for w in classes_as_str.split()]
+
+
def on_pre_break(break_obj):
"""
Lifecycle method executes before the pre-break period.
diff --git a/safeeyes/safeeyes.py b/safeeyes/safeeyes.py
index cf24f08..9ce47eb 100644
--- a/safeeyes/safeeyes.py
+++ b/safeeyes/safeeyes.py
@@ -40,7 +40,7 @@ from safeeyes.ui.settings_dialog import SettingsDialog
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
-SAFE_EYES_VERSION = "2.1.4"
+SAFE_EYES_VERSION = "2.1.5"
class SafeEyes:
diff --git a/setup.py b/setup.py
index 4709aef..d04e820 100644
--- a/setup.py
+++ b/setup.py
@@ -78,14 +78,14 @@ def __package_data():
setuptools.setup(
name="safeeyes",
- version="2.1.4",
+ version="2.1.5",
description="Protect your eyes from eye strain using this continuous breaks reminder.",
long_description=long_description,
long_description_content_type="text/markdown",
author="Gobinath Loganathan",
author_email="slgobinath@gmail.com",
url="https://github.com/slgobinath/SafeEyes",
- download_url="https://github.com/slgobinath/SafeEyes/archive/v2.1.4.tar.gz",
+ download_url="https://github.com/slgobinath/SafeEyes/archive/v2.1.5.tar.gz",
packages=setuptools.find_packages(),
package_data={'safeeyes': __package_data()},
data_files=__data_files(),