Inventory Input Solutions
Indeed, managing player input in games, especially those that require both direct control (e.g. first person movement, shooting, etc.) and indirect control (e.g. inventory management, item swapping, etc.) can be a challenge. You've already identified two common solutions: using a hold-down key or a toggle key to switch between these modes.
Here are some other strategies you might consider:
Pause Menu: This is a common approach in many games. When the player wants to manage their inventory, they hit a button (like ESC or I for inventory) and the game pauses, bringing up the inventory screen. This both releases the mouse for UI interaction and gives the player a breather.
Contextual Cursor: In some games, when the player hovers their mouse over a part of the UI (like a button or an inventory icon), the game automatically switches from look mode to UI interaction mode. When the mouse leaves the UI area, the game switches back.
Dual Input: If the game supports controller input, the sticks could be used for movement and looking around, while the cursor is left free for inventory management. This could also be implemented for keyboard and mouse - W,A,S,D keys for movement, mouse for interaction with the UI.
Eye Tracking: Some modern games are starting to incorporate eye tracking as a form of input. This is not widespread and requires specific hardware, but it could be an interesting option to explore if your target audience is likely to have this technology.
Voice Commands: If your game has a small number of frequent inventory interactions, you could consider implementing voice commands. Again, this requires specific hardware and can be difficult to implement well, but it could be a unique selling point for your game.
Remember that the best solution will depend on the specifics of your game and the preferences of your players. It can be helpful to playtest different options to see what works best in practice.