Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: zoom in and out support #45

Merged
merged 2 commits into from
Jan 14, 2025
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
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
Loading