mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
port app/menus to ts
This commit is contained in:
parent
86f70f1610
commit
d8ad9ef066
7 changed files with 42 additions and 13 deletions
|
|
@ -1,8 +1,12 @@
|
|||
// This menu label is overrided by OSX to be the appName
|
||||
// The label is set to appName here so it matches actual behavior
|
||||
import {app} from 'electron';
|
||||
import {app, BrowserWindow, MenuItemConstructorOptions} from 'electron';
|
||||
|
||||
export default (commandKeys, execCommand, showAbout) => {
|
||||
export default (
|
||||
commandKeys: Record<string, string>,
|
||||
execCommand: (command: string, focusedWindow?: BrowserWindow) => void,
|
||||
showAbout: () => void
|
||||
): MenuItemConstructorOptions => {
|
||||
return {
|
||||
label: `${app.getName()}`,
|
||||
submenu: [
|
||||
|
|
@ -36,7 +40,7 @@ export default (commandKeys, execCommand, showAbout) => {
|
|||
role: 'hide'
|
||||
},
|
||||
{
|
||||
role: 'hideothers'
|
||||
role: 'hideOthers'
|
||||
},
|
||||
{
|
||||
role: 'unhide'
|
||||
|
|
@ -1,5 +1,10 @@
|
|||
export default (commandKeys, execCommand) => {
|
||||
const submenu = [
|
||||
import {BrowserWindow, MenuItemConstructorOptions} from 'electron';
|
||||
|
||||
export default (
|
||||
commandKeys: Record<string, string>,
|
||||
execCommand: (command: string, focusedWindow?: BrowserWindow) => void
|
||||
) => {
|
||||
const submenu: MenuItemConstructorOptions[] = [
|
||||
{
|
||||
label: 'Undo',
|
||||
accelerator: commandKeys['editor:undo'],
|
||||
|
|
@ -23,7 +28,7 @@ export default (commandKeys, execCommand) => {
|
|||
command: 'editor:copy',
|
||||
accelerator: commandKeys['editor:copy'],
|
||||
registerAccelerator: true
|
||||
},
|
||||
} as any,
|
||||
{
|
||||
role: 'paste',
|
||||
accelerator: commandKeys['editor:paste']
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
import {release} from 'os';
|
||||
import {app, shell} from 'electron';
|
||||
import {app, shell, MenuItemConstructorOptions} from 'electron';
|
||||
import {getConfig, getPlugins} from '../../config';
|
||||
const {arch, env, platform, versions} = process;
|
||||
import {version} from '../../package.json';
|
||||
|
||||
export default (commands, showAbout) => {
|
||||
const submenu = [
|
||||
export default (commands: Record<string, string>, showAbout: () => void): MenuItemConstructorOptions => {
|
||||
const submenu: MenuItemConstructorOptions[] = [
|
||||
{
|
||||
label: `${app.getName()} Website`,
|
||||
click() {
|
||||
|
|
@ -1,4 +1,9 @@
|
|||
export default (commands, execCommand) => {
|
||||
import {BrowserWindow, MenuItemConstructorOptions} from 'electron';
|
||||
|
||||
export default (
|
||||
commands: Record<string, string>,
|
||||
execCommand: (command: string, focusedWindow?: BrowserWindow) => void
|
||||
): MenuItemConstructorOptions => {
|
||||
return {
|
||||
label: 'Plugins',
|
||||
submenu: [
|
||||
|
|
@ -1,4 +1,9 @@
|
|||
export default (commandKeys, execCommand) => {
|
||||
import {BrowserWindow, MenuItemConstructorOptions} from 'electron';
|
||||
|
||||
export default (
|
||||
commandKeys: Record<string, string>,
|
||||
execCommand: (command: string, focusedWindow?: BrowserWindow) => void
|
||||
): MenuItemConstructorOptions => {
|
||||
const isMac = process.platform === 'darwin';
|
||||
|
||||
return {
|
||||
|
|
@ -1,4 +1,9 @@
|
|||
export default (commandKeys, execCommand) => {
|
||||
import {BrowserWindow, MenuItemConstructorOptions} from 'electron';
|
||||
|
||||
export default (
|
||||
commandKeys: Record<string, string>,
|
||||
execCommand: (command: string, focusedWindow?: BrowserWindow) => void
|
||||
): MenuItemConstructorOptions => {
|
||||
return {
|
||||
label: 'View',
|
||||
submenu: [
|
||||
|
|
@ -1,4 +1,9 @@
|
|||
export default (commandKeys, execCommand) => {
|
||||
import {BrowserWindow, MenuItemConstructorOptions} from 'electron';
|
||||
|
||||
export default (
|
||||
commandKeys: Record<string, string>,
|
||||
execCommand: (command: string, focusedWindow?: BrowserWindow) => void
|
||||
): MenuItemConstructorOptions => {
|
||||
// Generating tab:jump array
|
||||
const tabJump = [];
|
||||
for (let i = 1; i <= 9; i++) {
|
||||
Loading…
Reference in a new issue