Skip to content

Commit

Permalink
Add support for Flatpak (#1013)
Browse files Browse the repository at this point in the history
Co-authored-by: Jan Hovancik <[email protected]>
  • Loading branch information
jwillikers and hovancik authored Sep 24, 2022
1 parent 2a4c4be commit 25611dc
Show file tree
Hide file tree
Showing 9 changed files with 182 additions and 4 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/flatpak-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Flatpak Lint

on:
push:
branches:
- release

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Install the required packages
run: sudo apt -y install appstream-util desktop-file-utils
- name: Verify the AppStream metadata file
run: appstream-util validate net.hovancik.Stretchly.metainfo.xml
- name: Verify the desktop file
run: desktop-file-validate net.hovancik.Stretchly.desktop
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ dist
coverage
.history
.vscode
.idea
.idea
.flatpak-builder/
*build-dir/
repo/
flatpak-node-generator.py
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
### Added
- support for Flatpak

### Changed
- updated many translations
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ You can help to translate Stretchly on [Weblate](https://hosted.weblate.org/enga
- João Barreiros, [@unstablectrl](https://github.com/unstablectrl)
- Vova Babii, [@JARVIS-VOVA](https://github.com/JARVIS-VOVA)
- Ben Hammond, [@benhamondmusic](https://github.com/benhammondmusic)
- Jordan Williams, [@jwillikers](https://github.com/jwillikers)
- Nai You-Ran, [@skyran1278](https://github.com/skyran1278)

Also see Github's list of [contributors](https://github.com/hovancik/stretchly/graphs/contributors).
Expand Down
5 changes: 3 additions & 2 deletions app/utils/defaultSettings.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const defaultBreakIdeas = require('./defaultBreakIdeas')
const defaultMicrobreakIdeas = require('./defaultMicrobreakIdeas')
const Utils = require('./utils')

module.exports = {
microbreakDuration: 20000,
Expand Down Expand Up @@ -35,7 +36,7 @@ module.exports = {
allScreens: true,
useIdeasFromSettings: false,
language: 'en',
notifyNewVersion: true,
notifyNewVersion: !Utils.insideFlatpak(),
isFirstRun: true,
posLatitude: 0.0,
posLongitude: 0.0,
Expand All @@ -49,7 +50,7 @@ module.exports = {
endBreakShortcut: 'CmdOrCtrl+X',
breakWindowWidth: 0.85,
breakWindowHeight: 0.85,
checkNewVersion: true,
checkNewVersion: !Utils.insideFlatpak(),
breakIdeas: defaultBreakIdeas,
microbreakIdeas: defaultMicrobreakIdeas,
showBreaksAsRegularWindows: false,
Expand Down
9 changes: 8 additions & 1 deletion app/utils/utils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const fs = require('fs')
const semver = require('semver')
const humanizeDuration = require('humanize-duration')

Expand Down Expand Up @@ -51,12 +52,18 @@ function shouldShowNotificationTitle (platform, systemVersion) {
return true
}

function insideFlatpak () {
const flatpakInfoPath = '/.flatpak-info'
return fs.existsSync(flatpakInfoPath)
}

module.exports = {
formatTimeRemaining,
formatTimeIn,
canPostpone,
canSkip,
formatKeyboardShortcut,
minutesRemaining,
shouldShowNotificationTitle
shouldShowNotificationTitle,
insideFlatpak
}
2 changes: 2 additions & 0 deletions examples/stretchly.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ After=default.target
Type=simple
ExecStartPre=/bin/sleep 1
ExecStart=/usr/bin/stretchly
# Flatpak
# ExecStart=flatpak run net.hovancik.Stretchly
Restart=on-failure
RestartSec=10
KillMode=process
Expand Down
9 changes: 9 additions & 0 deletions net.hovancik.Stretchly.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Desktop Entry]
Name=Stretchly
Exec=run.sh %U
Terminal=false
Type=Application
Icon=net.hovancik.Stretchly
StartupWMClass=Stretchly
Comment=The break time reminder app
Categories=Utility;
133 changes: 133 additions & 0 deletions net.hovancik.Stretchly.metainfo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>net.hovancik.Stretchly</id>
<launchable type="desktop-id">net.hovancik.Stretchly.desktop</launchable>
<provides>
<id>stretchly.desktop</id>
</provides>
<metadata_license>CC0-1.0</metadata_license>
<project_license>BSD-2-Clause</project_license>
<content_rating type="oars-1.1" />
<name>Stretchly</name>
<developer_name>Jan Hovancik</developer_name>
<summary>The break time reminder app</summary>
<description>
<p>
Stretchly is a cross-platform Electron app that reminds you to take breaks when working on your computer.
</p>
</description>
<url type="bugtracker">https://github.com/hovancik/stretchly/issues</url>
<url type="donation">https://hovancik.net/stretchly/sponsor/</url>
<url type="help">https://hovancik.net/stretchly/features/</url>
<url type="homepage">https://hovancik.net/stretchly/</url>
<url type="translate">https://hosted.weblate.org/engage/stretchly/</url>
<screenshots>
<screenshot type="default">
<image>https://hovancik.net/stretchly/img/minibreak.png</image>
<caption>Stretchly minibreak screen</caption>
</screenshot>
<screenshot>
<image>https://hovancik.net/stretchly/img/welcome.png</image>
<caption>Stretchly welcome screen</caption>
</screenshot>
<screenshot>
<image>https://hovancik.net/stretchly/img/dark.png</image>
<caption>Stretchly dark mode preferences</caption>
</screenshot>
</screenshots>
<releases>
<release version="1.11.0" date="2022-08-07">
<description>
<p>Added</p>
<ul>
<li>Japanese translations</li>
<li>break ideas are translatable</li>
<li>unregister shortcuts on app's quit</li>
</ul>
<p>Changed</p>
<ul>
<li>updated many translations</li>
<li>no Linux 32 builds, as Electron does not support them anymore</li>
</ul>
<p>Fixed</p>
<ul>
<li>crashing when skipping to break and time to break in tray</li>
<li>Portuguese and Brazilian labels in welcome screen</li>
<li>partial minutes in break preferences</li>
<li>counting break time when break starts</li>
<li>breaks not being finished when exclusion starts</li>
<li>incorrect format in logs</li>
<li>Preferences bigger then available height</li>
</ul>
</description>
</release>
<release version="1.10.0" date="2022-02-22">
<description>
<p>Added</p>
<ul>
<li>advanced option for app exclusion check interval</li>
<li>build for Apple silicon</li>
<li>ability to schedule break from command line</li>
</ul>
</description>
</release>
<release version="1.9.0" date="2021-12-24">
<description>
<p>Fixed</p>
<ul>
<li>typo in quotes</li>
<li>break not being resumed after DND if device was locked meanwhile on macOS</li>
<li>transparency not working in breaks</li>
<li>command line arguments</li>
<li>Turkish option in Welcome window</li>
<li>no break texts and time in break window</li>
</ul>
<p>Changed</p>
<ul>
<li>updated many translations</li>
</ul>
<p>Added</p>
<ul>
<li>advanced option to show current time in break window</li>
</ul>
</description>
</release>
<release version="1.8.1" date="2021-11-24"/>
<release version="1.8.0" date="2021-11-21">
<description>
<p>Added</p>
<ul>
<li>new break ideas</li>
<li>advanced option for showing minutes remaining in app tray</li>
<li>30 minute pause option</li>
</ul>
<p>Changed</p>
<ul>
<li>improve tray status messages</li>
<li>updated and added many translations</li>
<li>increase new version check to 48 hours</li>
<li>change font to Nato Sans for better support</li>
</ul>
<p>Fixed</p>
<ul>
<li>prevent empty break windows</li>
<li>improve window positioning</li>
<li>error on Windows and Linux systems when temporary directory is not executable</li>
</ul>
</description>
</release>
<release version="1.7.0" date="2021-05-04">
<description>
<p>
Added advanced preferences for Pause/Resume Breaks global shortcuts and for picking the monitor to show the break on.
Added initial support for the RTL languages for the UI.
The endBreakShortcut can now be disabled by settin it to an empty string.
Updated many translations.
Prevent memory leak after break has ended.
</p>
</description>
</release>
<release version="1.6.0" date="2021-04-16"/>
<release version="1.5.0" date="2021-04-07"/>
</releases>
</component>

0 comments on commit 25611dc

Please sign in to comment.