Custom Key Mapping for Tab and Q on Specific Websites in Edge (e.g., YouTube)

Hi Friends,

I’d like to create a preset where:
• Pressing the Tab key functions as the left arrow key.
• Pressing the Q key functions as the right arrow key.

I’d like this preset to only apply when I’m on a specific website in Edge, for example, on youtube.com or any URL with youtube.com as the main domain.

Could you please help me add this functionality? Thank you so much!

Hi @Vu_Le_Thanh,

The good news is that this is achievable. The bad news is that there's currently a bug in BetterTouchTool that means we need to install a Plugin for Microsoft Edge to make this work well.

Here are the steps:

  1. Install the Plugin called "URL in title":
    URL in title - Microsoft Edge Addons

  2. Click on the "Extension options" button:

  3. Change the "Tab title format:" to {title} - {protocol}://{hostname}{port}/{path} (i.e. add /{path} at the end).

  4. Install this BetterTouchTool preset:
    Edge and YouTube_export.bttpreset (240.7 KB)

The "Edge and YouTube" preset attached above contains a Conditional Activation Group (CAG) called "Edge and YouTube". The Triggers and Actions defined in the CAG will only be active (triggerable) if ALL of the following conditions are TRUE:

  1. The "App Name" of the active app is Microsoft Edge

  2. The "Window Name" of the active window contains https://www.youtube.com/watch

    Note
    This is why we downloaded the "URL in title" Edge Plugin so that we can ensure that the Triggers in our "Edge and YouTube" CAG are only active if we're watching a YouTube video. Normally, we can use the "Active Website URL" condition but for some reason it's not currently working for Microsoft Edge.

  3. The "Focused Element Role" is not AXTextField

  4. The "Focused Element Role" is not AXTextArea

    Note
    The last two conditions are added to make sure we can still use the Tab and Q keys when we click into the Search input field and the Comment input fields on the YouTube website. Without these conditions, we wouldn't be able to search for videos or make comments containing the letter Q.

    Here's what it looks like:

  5. Add two Keyboard Shortcut trigger:

    1. Tab key functions as the left arrow key.
    2. Q key functions as the right arrow key.

Optional
Use ChatGPT to create an icon for your "Edge and YouTube" CAG using the prompt:
Create an icon combining the Microsoft Edge and YouTube logos

@Andreas_Hegenberg

Microsoft Edge is built on Chromium but the Active Website URL still doesn't work. Is this a bug?

See how the Active Website URL doesn't have any value?

When I run this AppleScript (async in background) in BTT:

tell application "Microsoft Edge"
	set theURL to URL of active tab of window 1
end tell

I get this output: https://www.youtube.com/watch?v=xSeR0ii7suo

Microsoft Edge is also listed under Privacy & Security -> Automation -> BetterTouchTool:

Is it the standard edge or a beta version? BTT uses this script for edge:

tell application "com.microsoft.edgemac" to set currentTabUrl to URL of active tab of front window

Ah damn, there is an error in that script. The id is missing. I'll fix it.

It should be

tell application id "com.microsoft.edgemac" to set currentTabUrl to URL of active tab of front window
1 Like

Yep, will be included in the next alpha.

1 Like

Something else: As far as I know, BTT recognizes text fields faster if this option is activated. BTT then actively asks the app ... or something like that. :slightly_smiling_face:

image

1 Like

@Frank1 where are those settings in BTT, I can't find them :sweat_smile:

ahh, never mind. I need to take a nap haha.

@Vu_Le_Thanh Good news! Andreas fixed the bug in the latest alpha (thank you @Andreas_Hegenberg !).

This means that installing the "URL in title" Edge Plugin is no longer necessary.

I've updated the preset to use the "Active Website URL" condition instead of the "Window Name" condition.

If you already installed the preset I originally provided you, you should remove it before installing the updated preset below:

Edge and YouTube v2 - active website url_export.bttpreset (240.9 KB)

Let me know if you have trouble setting this up.

Thank you, @fortred2 and @Andreas_Hegenberg, for the quick update and support! :raised_hands:

I’ve installed your updated preset, and it works perfectly.

FYI, since switching to MacBook, BTT has been my go-to tool for boosting productivity.

Thanks again for the amazing support and continuous improvements! :rocket:

1 Like

thanks, I thought I doing something wrong, just updated to alpha; btw I would like to assign keys like h to move to history tab in youtube, tried with url but it just open in new tab; btw the key assigned in your setup, work on spotlight if you are in edge(for the app you setup)? because it doesn't for me