Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- new icon styles preference for tray (showing time to break or visual progress to break)
- Autostart functionality in Flatpaks
- updated appExclusions section on README to include description for Windows and substring matching
- portable version for Windows

### Fixed
- snap package not starting on Wayland
Expand Down
3 changes: 2 additions & 1 deletion app/css/commons.css
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ body {
.linux .linux-hidden,
.freebsd .linux-hidden,
.openbsd .linux-hidden,
.store .store-hidden {
.store .store-hidden,
.portable .portable-hidden {
display: none;
}

Expand Down
10 changes: 9 additions & 1 deletion app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { DateTime } from 'luxon'

import {
canPostpone, canSkip, formatTimeRemaining,
minutesRemaining, insideWindowsStore, insideFlatpak, insideSnap
minutesRemaining, insideWindowsStore, insideFlatpak, insideSnap, insideWindowsPortable
} from './utils/utils.js'
import IdeasLoader from './utils/ideasLoader.js'
import BreaksPlanner from './breaksPlanner.js'
Expand Down Expand Up @@ -78,6 +78,14 @@ let currentTrayIconPath = null
let currentTrayMenuTemplate = null
let trayUpdateIntervalObj = null

if (insideWindowsPortable()) {
const portableDataPath = join(process.env.PORTABLE_EXECUTABLE_DIR, 'Data')
if (!existsSync(portableDataPath)) {
mkdirSync(portableDataPath, { recursive: true })
}
app.setPath('userData', portableDataPath)
}

log.initialize({ preload: true })

// https://stackoverflow.com/questions/65859634/notification-from-electron-shows-electron-app-electron/65863174#65863174
Expand Down
3 changes: 3 additions & 0 deletions app/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ document.body.classList.add(window.runtime.platform())
if (window.runtime.windowsStore()) {
document.body.classList.add('store')
}
if (window.runtime.windowsPortable()) {
document.body.classList.add('portable')
}
export default {}
1 change: 1 addition & 0 deletions app/preferences-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ window.onload = async (e) => {
document.querySelector('#electron').innerHTML = await window.runtime.electron()
document.querySelector('#platform').innerHTML = await window.runtime.platform()
document.querySelector('#windowsStore').innerHTML = await window.runtime.windowsStore() || false
document.querySelector('#windowsPortable').innerHTML = await window.runtime.windowsPortable() || false
}
setWindowHeight()
}
Expand Down
5 changes: 3 additions & 2 deletions app/preferences.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
</a>
</nav>
<div class="settings">
<div class="store-hidden">
<div class="store-hidden portable-hidden">
<input type="checkbox" value="openAtLogin" id="openAtLogin">
<label data-i18next="preferences.settings.openAtLogin" for="openAtLogin"></label>
</div>
Expand Down Expand Up @@ -418,7 +418,8 @@
Chromium: <span id="chrome"></span>,
Electron: <span id="electron"></span>
<br />OS: <span id="platform"></span><span class="linux-hidden darwin-hidden">,
Windows Store: <span id="windowsStore"></span></span>
Windows Store: <span id="windowsStore"></span>,
Windows Portable: <span id="windowsPortable"></span></span>
</p>
<p>
<button>copy to clipboard</button>
Expand Down
1 change: 1 addition & 0 deletions app/utils/context-bridge-exposers.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function exposeRuntime () {
electron: () => process.versions.electron,
windowsStore: () => utils.insideWindowsStore(),
snap: () => utils.insideSnap(),
windowsPortable: () => utils.insideWindowsPortable(),
getSystemVersion: () => process.getSystemVersion()
})
}
Expand Down
4 changes: 2 additions & 2 deletions app/utils/defaultSettings.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import defaultBreakIdeas from './defaultBreakIdeas.js'
import defaultMicrobreakIdeas from './defaultMicrobreakIdeas.js'
import { insideFlatpak, insideWindowsStore, insideSnap } from './utils.js'
import { insideFlatpak, insideWindowsStore, insideSnap, insideWindowsPortable } from './utils.js'

export default {
microbreakDuration: 20000,
Expand Down Expand Up @@ -76,7 +76,7 @@ export default {
resetBreaksShortcut: '',
showTrayMenuInStrictMode: false,
customPreferencesMessage: '',
disableAppUpdateFeatures: insideFlatpak() || insideWindowsStore() || insideSnap(),
disableAppUpdateFeatures: insideFlatpak() || insideWindowsStore() || insideSnap() || insideWindowsPortable(),
hidePreferencesFileLocation: false,
hideStrictModePreferences: false,
miniBreakManualFinish: false,
Expand Down
7 changes: 6 additions & 1 deletion app/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ function insideSnap () {
return process.platform === 'linux' && !!process.env.SNAP
}

function insideWindowsPortable () {
return process.platform === 'win32' && !!process.env.PORTABLE_EXECUTABLE_DIR
}

export {
formatTimeRemaining,
formatElapsedDuration,
Expand All @@ -99,5 +103,6 @@ export {
shouldShowNotificationTitle,
insideFlatpak,
insideWindowsStore,
insideSnap
insideSnap,
insideWindowsPortable
}
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,17 @@
"target": [
"nsis",
"7z",
"appx"
"appx",
"portable"
],
"asarUnpack": [
"node_modules/windows-notification-state/**",
"node_modules/macos-notification-state/**"
]
},
"portable": {
"artifactName": "${productName} Portable ${version}.${ext}"
},
"nsis": {
"oneClick": false,
"allowToChangeInstallationDirectory": true
Expand Down