diff --git a/js/constants/messages.js b/js/constants/messages.js index b4e12f92f54..f00cb8f83d3 100644 --- a/js/constants/messages.js +++ b/js/constants/messages.js @@ -38,6 +38,7 @@ const messages = { SHORTCUT_UNDO_CLOSED_FRAME: _, SHORTCUT_FRAME_MUTE: _, SHORTCUT_FRAME_RELOAD: _, /** @arg {number} key of frame */ + SHORTCUT_FRAME_CLONE: _, /** @arg {number} key of frame, @arg {object} options such as openInForeground */ SHORTCUT_NEXT_TAB: _, SHORTCUT_PREV_TAB: _, // Misc application events diff --git a/js/contextMenus.js b/js/contextMenus.js index 058675b087a..9c166abdeb1 100644 --- a/js/contextMenus.js +++ b/js/contextMenus.js @@ -353,7 +353,7 @@ function usernameTemplateInit (usernames, origin, action) { } function tabTemplateInit (frameProps) { - const tabKey = frameProps.get('key') + const frameKey = frameProps.get('key') const items = [] items.push( CommonMenu.newTabMenuItem(), @@ -362,14 +362,14 @@ function tabTemplateInit (frameProps) { label: locale.translation('reloadTab'), click: (item, focusedWindow) => { if (focusedWindow) { - focusedWindow.webContents.send(messages.SHORTCUT_FRAME_RELOAD, tabKey) + focusedWindow.webContents.send(messages.SHORTCUT_FRAME_RELOAD, frameKey) } } }, { label: locale.translation('clone'), click: (item, focusedWindow) => { if (focusedWindow) { - focusedWindow.webContents.send(messages.SHORTCUT_ACTIVE_FRAME_CLONE, { + focusedWindow.webContents.send(messages.SHORTCUT_FRAME_CLONE, frameKey, { openInForeground: true }) } @@ -425,7 +425,7 @@ function tabTemplateInit (frameProps) { click: (item, focusedWindow) => { if (focusedWindow) { // TODO: Don't switch active tabs when this is called - focusedWindow.webContents.send(messages.SHORTCUT_CLOSE_FRAME, tabKey) + focusedWindow.webContents.send(messages.SHORTCUT_CLOSE_FRAME, frameKey) } } }) @@ -435,21 +435,21 @@ function tabTemplateInit (frameProps) { label: locale.translation('closeOtherTabs'), click: (item, focusedWindow) => { if (focusedWindow) { - focusedWindow.webContents.send(messages.SHORTCUT_CLOSE_OTHER_FRAMES, tabKey, true, true) + focusedWindow.webContents.send(messages.SHORTCUT_CLOSE_OTHER_FRAMES, frameKey, true, true) } } }, { label: locale.translation('closeTabsToRight'), click: (item, focusedWindow) => { if (focusedWindow) { - focusedWindow.webContents.send(messages.SHORTCUT_CLOSE_OTHER_FRAMES, tabKey, true, false) + focusedWindow.webContents.send(messages.SHORTCUT_CLOSE_OTHER_FRAMES, frameKey, true, false) } } }, { label: locale.translation('closeTabsToLeft'), click: (item, focusedWindow) => { if (focusedWindow) { - focusedWindow.webContents.send(messages.SHORTCUT_CLOSE_OTHER_FRAMES, tabKey, false, true) + focusedWindow.webContents.send(messages.SHORTCUT_CLOSE_OTHER_FRAMES, frameKey, false, true) } } }, CommonMenu.separatorMenuItem) diff --git a/js/stores/windowStore.js b/js/stores/windowStore.js index 4bf029ebd58..3b30235c921 100644 --- a/js/stores/windowStore.js +++ b/js/stores/windowStore.js @@ -658,12 +658,12 @@ frameShortcuts.forEach((shortcut) => { emitChanges() }) // Listen for actions on frame N - if (['reload', 'mute'].includes(shortcut)) { - ipc.on(`shortcut-frame-${shortcut}`, (e, i) => { + if (['reload', 'mute', 'clone'].includes(shortcut)) { + ipc.on(`shortcut-frame-${shortcut}`, (e, i, args) => { const path = ['frames', FrameStateUtil.findIndexForFrameKey(windowState.get('frames'), i)] windowState = windowState.mergeIn(path, { activeShortcut: shortcut, - activeShortcutDetails: null + activeShortcutDetails: args }) emitChanges() })