Custom Script to Send Messages with Ctrl/Cmd+Enter in Pickaxe Chats

Send Messages with Ctrl+Enter (or Cmd+Enter) in Pickaxe Chats

Quick productivity boost! Add keyboard shortcuts to your Pickaxe chat.

Script can be found at the bottom of this post (-:

Use case: Users can send messages with Ctrl+Enter (Windows/Linux) or Cmd+Enter (Mac) instead of clicking the send button. Works for Studio and script-embed.

  • custom-js
  • studio
  • script-embed
  • keyboard-shortcuts

What it does

  • Listens for Ctrl+Enter (or Cmd+Enter on Mac) when typing in the chat input.
  • Clicks the send button automatically.
  • Only triggers when focused on the input field (no conflicts with other shortcuts).
  • Respects disabled state (won't send if button is disabled).

How to use

  1. In Studio's "Settings->Website Code Injection->HEADER" (or after your script-embed on your site), paste the Code Snippet from below.
  2. Reload and type a message.
  3. Press Ctrl+Enter (or Cmd+Enter) to send!
  4. Optional: set DEBUG = true in the snippet to log when messages are sent.

Compatibility

  • Studio: ✅ Paste in "Custom Scripts".
  • Script Embed: ✅ Paste after your Pickaxe script.
  • Iframe (same-origin): ✅ Works if you inject the snippet inside the iframe's document.
  • Iframe (cross-origin): ⚠️ Not accessible from the host page so use Script Embed or inject from the iframe origin.

Troubleshooting

  • Nothing happens: Turn on DEBUG and check the console. Make sure you're focused on the input field when pressing Ctrl+Enter.
  • Conflicts with other shortcuts: The script only runs when focused on textarea/input fields to avoid conflicts.

As always, please reply below with any questions and we are here to help!!

<!-- ctrl+enter to send messages (cmd+enter on mac) -->

<script>
  (() => {
    if (window.__PA_CTRL_ENTER__) return;
    window.__PA_CTRL_ENTER__ = true;

    const DEBUG = false; // set to true for console logs

    if (DEBUG) console.log("[pickaxe] ctrl+enter to send active");

    document.addEventListener(
      "keydown",
      (e) => {
        // only run on ctrl+enter or cmd+enter
        if ((e.ctrlKey || e.metaKey) && e.key === "Enter") {
          // only run if focused on textarea or input
          if (!e.target.matches("textarea, input")) return;

          const sendButton = document.querySelector('button[type="submit"]');
          if (sendButton && !sendButton.disabled) {
            e.preventDefault();
            sendButton.click();
            if (DEBUG) console.log("[pickaxe] message sent via ctrl+enter");
          }
        }
      },
      true
    );
  })();
</script>