feature: Add support to autoHide the menubar and showing it with the key. fixes #188

This commit is contained in:
Rick van Lieshout 2023-01-20 22:15:36 +01:00
parent 3a4d23738f
commit 63ccff97ea
4 changed files with 12 additions and 10 deletions

View File

@ -7,7 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## 4.4.0 ## 4.4.0
- Updated shortcut hint on the menubar to reflect the new `ctrl+=` shortcut. - Updated shortcut hint on the menubar to reflect the new `ctrl+=` shortcut.
- Reverted icon path to `icon.png` instead of the hardcoded linux path - Reverted icon path to `icon.png` instead of the hardcoded linux path.
- Add support to autoHide the menubar and showing it with the `alt` key.
## 4.3.1 ## 4.3.1

View File

@ -49,7 +49,10 @@ function setFlags() {
* *
*/ */
function syncMenuBarWithStore() { function syncMenuBarWithStore() {
mainWindow.setMenuBarVisibility(store.get(settings.menuBar)); const fixedMenuBar = store.get(settings.menuBar);
mainWindow.autoHideMenuBar = !fixedMenuBar;
mainWindow.setMenuBarVisibility(fixedMenuBar);
} }
/** /**
@ -78,6 +81,7 @@ function createWindow(options = {}) {
height: store && store.get(settings.windowBounds.height), height: store && store.get(settings.windowBounds.height),
icon, icon,
backgroundColor: options.backgroundColor, backgroundColor: options.backgroundColor,
autoHideMenuBar: true,
webPreferences: { webPreferences: {
preload: path.join(__dirname, "preload.js"), preload: path.join(__dirname, "preload.js"),
plugins: true, plugins: true,
@ -123,7 +127,7 @@ function registerHttpProtocols() {
protocol.registerHttpProtocol(PROTOCOL_PREFIX, (request, _callback) => { protocol.registerHttpProtocol(PROTOCOL_PREFIX, (request, _callback) => {
mainWindow.loadURL(`${tidalUrl}/${request.url.substring(PROTOCOL_PREFIX.length + 3)}`); mainWindow.loadURL(`${tidalUrl}/${request.url.substring(PROTOCOL_PREFIX.length + 3)}`);
}); });
if (!app.isDefaultProtocolClient(PROTOCOL_PREFIX)) { if (!app.isDefaultProtocolClient(PROTOCOL_PREFIX)) {
app.setAsDefaultProtocolClient(PROTOCOL_PREFIX); app.setAsDefaultProtocolClient(PROTOCOL_PREFIX);
} }
} }

View File

@ -68,8 +68,8 @@
<p class="group__title">UI</p> <p class="group__title">UI</p>
<div class="group__option"> <div class="group__option">
<div class="group__description"> <div class="group__description">
<h4>Menubar</h4> <h4>Fixed menubar</h4>
<p>Show TIDAL Hi-Fi's menu bar.</p> <p>Always show TIDAL Hi-Fi's menu bar.</p>
</div> </div>
<label class="switch"> <label class="switch">
<input id="menuBar" type="checkbox"> <input id="menuBar" type="checkbox">
@ -255,4 +255,4 @@
</div> </div>
</body> </body>
</html> </html>

View File

@ -328,7 +328,7 @@ setInterval(function () {
const title = elements.getText("title"); const title = elements.getText("title");
const artists = elements.getArtists(); const artists = elements.getArtists();
muteArtistIfFoundInMutedArtistsList(); // doing this here so that nothing can possibly fail before we call this function muteArtistIfFoundInMutedArtistsList(); // doing this here so that nothing can possibly fail before we call this function
const album = elements.getAlbumName(); const album = elements.getAlbumName();
const current = elements.getText("current"); const current = elements.getText("current");
const duration = elements.getText("duration"); const duration = elements.getText("duration");
@ -344,12 +344,9 @@ setInterval(function () {
duration, duration,
"app-name": appName, "app-name": appName,
}; };
const titleOrArtistChanged = currentSong !== songDashArtistTitle; const titleOrArtistChanged = currentSong !== songDashArtistTitle;
// update title, url and play info with new info // update title, url and play info with new info
setTitle(songDashArtistTitle); setTitle(songDashArtistTitle);
getTrackURL(); getTrackURL();