Skip to content

Commit

Permalink
New: Option to open file location of current reading from the file menu
Browse files Browse the repository at this point in the history
  • Loading branch information
ollm committed Jan 25, 2024
1 parent 9520faa commit c9215dc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Show error message if continue reading file does not exist [`7aee55c`](https://github.com/ollm/OpenComic/commit/7aee55ca5dac6b937824728b7ded116dc00c28df)
- Support background music from folder: MP3, M4A, WEBM, WEBA, OGG, OPUS, WAV, FLAC [`26947a2`](https://github.com/ollm/OpenComic/commit/26947a297868e86069cc6daca77e1a3f016d0705)
- Now when applying Webtoon mode the vertical margin is 0 [`683a08a`](https://github.com/ollm/OpenComic/commit/683a08aad3a6d947004ad77476184d613718b098)
- Show the current reading title in app window
- Show the current reading title in app window [`9520faa`](https://github.com/ollm/OpenComic/commit/9520faa7486e4494bb878ffe2430e9fd198ee33a)
- Option to open file location of current reading from the file menu

##### 🐛 Bug Fixes

Expand Down
8 changes: 8 additions & 0 deletions scripts/opencomic.js
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,9 @@ function generateAppMenu(force = false)
let currentWindow = electronRemote.getCurrentWindow();
generateAppMenuData = {resetZoom: electron.webFrame.getZoomFactor(), onReading: onReading};

let readingCurrentPath = reading.readingCurrentPath();
let readingFolder = (onReading && fs.existsSync(readingCurrentPath) && fs.statSync(readingCurrentPath).isDirectory()) ? true : false;

var menuTemplate = [
{
label: language.menu.file.main,
Expand All @@ -765,6 +768,8 @@ function generateAppMenu(force = false)
{label: language.menu.file.addFile, click: function(){addComic()}},
{label: language.menu.file.addFolder, click: function(){addComic(true)}},
{type: 'separator'},
{label: readingFolder ? language.global.contextMenu.openFolderLocation : language.global.contextMenu.openFileLocation, click: function(){electron.shell.showItemInFolder(fileManager.firstCompressedFile(readingCurrentPath))}},
{type: 'separator'},
{role: 'quit', label: language.menu.file.quit, click: function(){electronRemote.app.quit();}},
]
},
Expand Down Expand Up @@ -808,6 +813,9 @@ function generateAppMenu(force = false)
}
];

if(!onReading)
menuTemplate[0].submenu.splice(4, 2);

var menu = electronRemote.Menu.buildFromTemplate(menuTemplate);
currentWindow.setMenu(menu);

Expand Down

0 comments on commit c9215dc

Please sign in to comment.