diff --git a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js index a3a89fac5..d4ba51a4c 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js @@ -39,6 +39,7 @@ import { doesRequestMatchSearchText, doesFolderHaveItemsMatchSearchText } from ' import { getDefaultRequestPaneTab } from 'utils/collections'; import toast from 'react-hot-toast'; import StyledWrapper from './StyledWrapper'; +import { getKeyBindingsForActionAllOS } from 'providers/Hotkeys/keyMappings'; import NetworkError from 'components/ResponsePane/NetworkError/index'; import CollectionItemInfo from './CollectionItemInfo/index'; import CollectionItemIcon from './CollectionItemIcon'; @@ -561,7 +562,14 @@ const CollectionItem = ({ item, collectionUid, collectionPathname, searchText }) const isMac = navigator.userAgent?.includes('Mac') || navigator.platform?.startsWith('Mac'); const isModifierPressed = isMac ? e.metaKey : e.ctrlKey; - if (isModifierPressed && e.key.toLowerCase() === 'c') { + const [macRenameKey, winRenameKey] = getKeyBindingsForActionAllOS('renameItem'); + const renameKey = isMac ? macRenameKey : winRenameKey; + + if (e.key.toLowerCase() === renameKey) { + e.preventDefault(); + e.stopPropagation(); + setRenameItemModalOpen(true); + } else if (isModifierPressed && e.key.toLowerCase() === 'c') { e.preventDefault(); e.stopPropagation(); handleCopyItem(); diff --git a/packages/bruno-app/src/providers/Hotkeys/keyMappings.js b/packages/bruno-app/src/providers/Hotkeys/keyMappings.js index 291476a82..0c439baf2 100644 --- a/packages/bruno-app/src/providers/Hotkeys/keyMappings.js +++ b/packages/bruno-app/src/providers/Hotkeys/keyMappings.js @@ -35,7 +35,8 @@ const KeyMapping = { collapseSidebar: { mac: 'command+\\', windows: 'ctrl+\\', name: 'Collapse Sidebar' }, zoomIn: { mac: 'command+=', windows: 'ctrl+=', name: 'Zoom In' }, zoomOut: { mac: 'command+-', windows: 'ctrl+-', name: 'Zoom Out' }, - resetZoom: { mac: 'command+0', windows: 'ctrl+0', name: 'Reset Zoom' } + resetZoom: { mac: 'command+0', windows: 'ctrl+0', name: 'Reset Zoom' }, + renameItem: { mac: 'enter', windows: 'f2', name: 'Rename Collection Item' } }; /**