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 request: customisable global hotkey to open a new chat in ChatGPT #109

Open
heldheld opened this issue Dec 30, 2022 · 5 comments
Open
Labels
enhancement New feature or request

Comments

@heldheld
Copy link

The idea is to press a global hotkey and then immediately being able to start typing your prompt into ChatGPT for quick and convenient use.

@lencx lencx added the enhancement New feature or request label Dec 31, 2022
@heldheld
Copy link
Author

heldheld commented Jan 2, 2023

A different version could be to have a checkbox under the global show/hide shortcut setting to toggle whether a new chat should be opened when using the hotkey to show the window.

@virat-ram
Copy link

You can create a JS script that takes this html and uses the click() function on it but I don;t know how because no id tag:
<a class="flex py-3 px-3 items-center gap-3 rounded-md hover:bg-gray-500/10 transition-colors duration-200 text-white cursor-pointer text-sm mb-2 flex-shrink-0 border border-white/20"><svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>New chat</a>

@dsernst
Copy link

dsernst commented Nov 30, 2023

I was able to successfully target the New Chat button with this selector:

document.querySelector('.group.flex.px-2[href="/"]')

@dsernst
Copy link

dsernst commented Nov 30, 2023

Here's some code GPT4 gave to add this hotkey:

// Add Cmd+N hotkey to start New Chat
document.addEventListener('keydown', (event) => {
  // Check if 'Cmd' and 'N' are pressed together
  if (event.metaKey && event.key === 'n') {
    event.preventDefault() // Prevents default action of the key press

    const $newChatBtn = document.querySelector('.group.flex.px-2[href="/"]')
    if ($newChatBtn) $newChatBtn.click()
  }
})

Added it to my main.js Scripts file (from app's Control Center). Now it works every time 🎉

@AstudilloMarillo
Copy link

I was able to successfully target the New Chat button with this selector:

document.querySelector('.group.flex.px-2[href="/"]')

These days, there are hotkeys integrated in ChatGPT that also work in this app:
Ctrl+/ = Show shortcuts
Shift+ESC = Focus chat input
Ctrl+Shift+o = Open new chat and focus chat input
Ctrl+Shift+i = Set Custom Instructions
Ctrl+Shift+c = Copy last response
Ctrl+Shift+; = Copy last Code Block
Ctrl+Shift+s = Toggle sidebar
Ctrl+Shift+BackSpace = Delete current chat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants