Skip to content

Commit

Permalink
Feature: zoom in and out support (#45)
Browse files Browse the repository at this point in the history
* Feature: zoom in and out support

* Minor version bump, new feature backwards compat
  • Loading branch information
johnnyshankman authored Jan 14, 2025
1 parent 8cc5424 commit 4da88d2
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 32 deletions.
4 changes: 2 additions & 2 deletions release/app/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 release/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hihat",
"version": "1.1.1",
"version": "1.2.0",
"description": "A minimalist offline music player for OSX audiophiles :: Based on iTunes circa 2002 :: by White Lights",
"license": "MIT",
"author": {
Expand Down
110 changes: 81 additions & 29 deletions src/main/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,29 +200,22 @@ export default class MenuBuilder {
label: 'View',
submenu: [
{
label: 'Reload',
label: 'reload',
accelerator: 'Command+R',
click: () => {
this.mainWindow.webContents.reload();
},
},
{
label: 'Toggle Full Screen',
accelerator: 'Ctrl+Command+F',
click: () => {
this.mainWindow.setFullScreen(!this.mainWindow.isFullScreen());
},
},
{
label: 'Toggle Developer Tools',
label: 'toggle dev tools',
accelerator: 'Alt+Command+I',
click: () => {
this.mainWindow.webContents.toggleDevTools();
},
},
{ type: 'separator' },
{
label: 'Toggle Browser View',
label: 'toggle browser view',
accelerator: 'Command+B',
click: () => {
this.mainWindow.webContents.send('menu-toggle-browser');
Expand All @@ -234,58 +227,117 @@ export default class MenuBuilder {
this.mainWindow.webContents.send('menu-reset-library');
},
},
{ type: 'separator' },
{
label: 'zoom in',
accelerator: 'CmdOrCtrl+Plus',
click: () => {
const focusedWindow = BrowserWindow.getFocusedWindow();
if (focusedWindow) {
const currentZoom = focusedWindow.webContents.getZoomFactor();
focusedWindow.webContents.setZoomFactor(currentZoom + 0.1);
}
},
},
{
label: 'zoom out',
accelerator: 'CmdOrCtrl+-',
click: () => {
const focusedWindow = BrowserWindow.getFocusedWindow();
if (focusedWindow) {
const currentZoom = focusedWindow.webContents.getZoomFactor();
focusedWindow.webContents.setZoomFactor(currentZoom - 0.1);
}
},
},
{
label: 'reset zoom',
accelerator: 'CmdOrCtrl+0',
click: () => {
const focusedWindow = BrowserWindow.getFocusedWindow();
if (focusedWindow) {
focusedWindow.webContents.setZoomFactor(1);
}
},
},
],
};
const subMenuAdvanced: DarwinMenuItemConstructorOptions = {
label: 'Advanced',
const subMenuViewProd: MenuItemConstructorOptions = {
label: 'View',
submenu: [
{
label: 'change library folder',
label: 'toggle browser view',
accelerator: 'Command+B',
click: () => {
this.mainWindow.webContents.send('menu-select-library');
this.mainWindow.webContents.send('menu-toggle-browser');
},
},
{ type: 'separator' },
{
label: 'backup / sync library',
label: 'zoom in',
accelerator: 'CmdOrCtrl+Plus',
click: () => {
this.mainWindow.webContents.send('menu-backup-library');
const focusedWindow = BrowserWindow.getFocusedWindow();
if (focusedWindow) {
const currentZoom = focusedWindow.webContents.getZoomFactor();
focusedWindow.webContents.setZoomFactor(currentZoom + 0.1);
}
},
},
{ type: 'separator' },
{
label: 'hide duplicate songs',
label: 'zoom out',
accelerator: 'CmdOrCtrl+-',
click: () => {
this.mainWindow.webContents.send('menu-hide-dupes');
const focusedWindow = BrowserWindow.getFocusedWindow();
if (focusedWindow) {
const currentZoom = focusedWindow.webContents.getZoomFactor();
focusedWindow.webContents.setZoomFactor(currentZoom - 0.1);
}
},
},
{
label: 'delete duplicate songs',
label: 'reset zoom',
accelerator: 'CmdOrCtrl+0',
click: () => {
this.mainWindow.webContents.send('menu-delete-dupes');
const focusedWindow = BrowserWindow.getFocusedWindow();
if (focusedWindow) {
focusedWindow.webContents.setZoomFactor(1);
}
},
},
],
};
const subMenuViewProd: MenuItemConstructorOptions = {
label: 'View',
const subMenuAdvanced: DarwinMenuItemConstructorOptions = {
label: 'Advanced',
submenu: [
{
label: 'Toggle Full Screen',
accelerator: 'Ctrl+Command+F',
label: 'change library folder',
click: () => {
this.mainWindow.webContents.send('menu-select-library');
},
},
{
label: 'backup / sync library',
click: () => {
this.mainWindow.setFullScreen(!this.mainWindow.isFullScreen());
this.mainWindow.webContents.send('menu-backup-library');
},
},
{ type: 'separator' },
{
label: 'Toggle Browser View',
accelerator: 'Command+B',
label: 'hide duplicate songs',
click: () => {
this.mainWindow.webContents.send('menu-toggle-browser');
this.mainWindow.webContents.send('menu-hide-dupes');
},
},
{
label: 'delete duplicate songs',
click: () => {
this.mainWindow.webContents.send('menu-delete-dupes');
},
},
],
};

const subMenuWindow: DarwinMenuItemConstructorOptions = {
label: 'Window',
submenu: [
Expand Down

0 comments on commit 4da88d2

Please sign in to comment.