Skip to content

Commit

Permalink
New: Option to start OpenComic in startup (Windows and macOS only)
Browse files Browse the repository at this point in the history
  • Loading branch information
ollm committed Sep 13, 2023
1 parent ec3cb12 commit 7b9b8ec
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Show image in its original size [`30df2fc`](https://github.com/ollm/OpenComic/commit/30df2fc70dbaefecfe1942bc8032686e083e7d53)
- Show in first/last page buttons if has next/prev comic and go to next/prev comics scrolling [`2a3796e`](https://github.com/ollm/OpenComic/commit/2a3796eb82cdc86c70c69cae62e48da9baf41aa0)
- Improve the detection of the type of compressed files if the file extension is not correct [`b39605c`](https://github.com/ollm/OpenComic/commit/b39605c5d5ab72742cf32f14a23004976cccec7c)
- Option to start OpenComic in startup (Windows and macOS only)

##### 🐛 Bug Fixes

Expand Down
3 changes: 2 additions & 1 deletion languages/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@
},
"others": {
"main": "Altres configuracions",
"startInFullScreen": "Inicia OpenComic a pantalla completa"
"startInFullScreen": "Inicia OpenComic a pantalla completa",
"startOnStartup": "Iniciar OpenComic a l'inici",
},
"releases": {
"main": "Comprovar noves versions",
Expand Down
3 changes: 2 additions & 1 deletion languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@
},
"others": {
"main": "Others settings",
"startInFullScreen": "Start OpenComic in full screen"
"startInFullScreen": "Start OpenComic in full screen",
"startOnStartup": "Start OpenComic on startup"
},
"releases": {
"main": "Check for new versions",
Expand Down
3 changes: 2 additions & 1 deletion languages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@
},
"others": {
"main": "Otros ajustes",
"startInFullScreen": "Inicial OpenComic en pantalla completa"
"startInFullScreen": "Iniciar OpenComic en pantalla completa",
"startOnStartup": "Iniciar OpenComic al inicio"
},
"releases": {
"main": "Comprobar nuevas versiones",
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
},
"devDependencies": {
"@electron/rebuild": "^3.2.13",
"electron": "^27.0.0-beta.1",
"electron": "^27.0.0-beta.2",
"electron-builder": "^24.6.3",
"node-abi": "^3.46.0",
"nodemon": "^3.0.1"
Expand Down
10 changes: 9 additions & 1 deletion scripts/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const {app, BrowserWindow, Menu, nativeImage} = require('electron');
const {app, ipcMain, BrowserWindow, Menu, nativeImage} = require('electron');
const path = require('path');
const url = require('url');
const windowStateKeeper = require('electron-window-state');
Expand Down Expand Up @@ -138,6 +138,14 @@ app.on('activate', () => {
}
})

ipcMain.on('open-at-login', function(event, active = false){

app.setLoginItemSettings({
openAtLogin: active,
})

});

// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.

Expand Down
7 changes: 7 additions & 0 deletions scripts/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@ function setStartInFullScreen(value)
storage.updateVar('config', 'startInFullScreen', value);
}

function setStartOnStartup(value)
{
storage.updateVar('config', 'startOnStartup', value);
electron.ipcRenderer.send('open-at-login', value);
}

function setCheckReleases(value)
{
storage.updateVar('config', 'checkReleases', value);
Expand All @@ -206,6 +212,7 @@ module.exports = {
setShowFullPathLibrary: setShowFullPathLibrary,
setShowFullPathOpened: setShowFullPathOpened,
setStartInFullScreen: setStartInFullScreen,
setStartOnStartup: setStartOnStartup,
setCheckReleases: setCheckReleases,
setCheckPreReleases: setCheckPreReleases,
changeShortcut: changeShortcut,
Expand Down
1 change: 1 addition & 0 deletions scripts/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ var storageDefault = {
readingGlobalZoom: true,
controllerDeadZone: 0.06,
startInFullScreen: false,
startOnStartup: false,
renderMaxWidth: 12000,
checkReleases: true,
checkPreReleases: true,
Expand Down
8 changes: 8 additions & 0 deletions templates/settings.content.right.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ <h2 class="headline-small">{{language.settings.others.main}}</h2>
</div>
</div>

<div class="menu-simple-text gamepad-item">
{{language.settings.others.startOnStartup}} (Windows and macOS)
<div class="switch{{#if config.startOnStartup}} a{{/if}}" on="settings.setStartOnStartup(true)" off="settings.setStartOnStartup(false)">
<div></div>
<svg viewBox="0 0 52 32"><path d="M 8,0 C 3.58,0 0,3.58 0,8 0,12.42 3.58,16 8,16 8,16 8,16 8,16 12.42,16 16,12.42 16,8 16,3.58 12.42,0 8,0 8,0 8,0 8,0 Z"></path></svg>
</div>
</div>

<h2 class="headline-small">{{language.settings.releases.main}}</h2>

<div class="menu-simple-text gamepad-item">
Expand Down

0 comments on commit 7b9b8ec

Please sign in to comment.