ALYB
May 31, 2025, 3:35am
1
Since I updated macOS to version 15.5 I can no longer use the context menu to open a selected .tmx file with BBEdit. I now get this warning:
So I decided to create a macro that can open a context menu that offers to open the Finder's selection in BBEdit. AI helped a little.
Open Context Menu.kmmacros (5.7 KB)
I guess that it's not possible to call this macro with the right mouse button, instead of using a keyboard shortcut?
Context menu:
You can get the finder selection from the FinderSelection token.
You could just use two macros with the same hot key trigger and Keyboard Maestro would prompt you to select which one using the Conflict Palette .
You can use the Open a File action to open the FinderSelection with BBEdit.
Technically, you can trigger a macro with the USB Device Key trigger to detect a Right Mouse Button (assuming you have a USB mouse), but it is generally not a good idea.
1 Like
ALYB
May 31, 2025, 8:42am
3
Thank you for your help, Peter.
When I use the Open a File action, I still get this quarantine message. So I have to use an AppleScript a day to keep the doctor away.
I've also asked AI to create a nice context-style menu:
Open Context Menu.kmmacros (5.7 KB)
I cannot assign a key press to the right mouse button of my Logitech MX Master 3S, but I can for instance assign one to the Top button:
1. Open Logi Options+
Launch Logi Options+ on your Mac.
2. Select Your MX Master 3S
Click on the mouse in the device list.
3. Add Finder as an App-Specific Profile
In the top-left corner of the window, you’ll see a dropdown that probably says “All Applications” or “Global.”
Click that dropdown and then:
Click “Add Application”
In the app list that appears, find and select Finder
(If you don’t see Finder, use the path: /System/Library/CoreServices/Finder.app
)
4. Configure the Top Button for Finder
Now that you’re in the Finder-specific profile , click the Top mouse button .
Assign it to your desired keystroke , e.g., F13
.
This keystroke assignment will now only apply when Finder is the frontmost app .
I've added the same keyboard shortcut to Keyboard Maestro:
This new version of the HTML window, closes when the ESC button is pressed. You can navigate with the arrow up or down key and select with the first letter of the menu item:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
body {
background-color: transparent;
font-family: -apple-system, sans-serif;
margin: 0;
}
.menu {
background-color: white;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
border: 1px solid rgba(0, 0, 0, 0.1);
padding: 6px 0;
width: 200px;
}
button {
display: block;
width: calc(100% - 10px);
margin: 2px 5px;
padding: 8px 16px;
background: none;
border: none;
border-radius: 8px;
text-align: left;
font-size: 14px;
cursor: pointer;
color: black;
font-weight: normal;
transition: background-color 0.1s ease;
}
button:hover,
button:focus {
background-color: #007aff;
color: white;
font-weight: 600;
outline: none;
}
</style>
<script>
document.addEventListener('DOMContentLoaded', () => {
const buttons = Array.from(document.querySelectorAll('button'));
let index = 0;
buttons[index].focus();
document.addEventListener('keydown', (event) => {
const key = event.key;
if (key === 'ArrowDown') {
index = (index + 1) % buttons.length;
buttons[index].focus();
event.preventDefault();
} else if (key === 'ArrowUp') {
index = (index - 1 + buttons.length) % buttons.length;
buttons[index].focus();
event.preventDefault();
} else if (key === 'Enter') {
buttons[index].click();
} else if (key === 'Escape') {
window.KeyboardMaestro.Cancel();
} else if (key.length === 1) {
const match = buttons.find((btn) => btn.textContent.trim().toLowerCase().startsWith(key.toLowerCase()));
if (match) {
match.focus();
index = buttons.indexOf(match);
}
}
});
});
</script>
</head>
<body data-kmwindow="SCREEN(Main,Left,80%),SCREEN(Main,Top,20%),220,90">
<div class="menu">
<button onclick="window.KeyboardMaestro.Submit('Open with BBEdit')">Open with BBEdit</button>
<button onclick="window.KeyboardMaestro.Submit('Print')">Print</button>
</div>
</body>
</html>
2 Likes
Nice and simple and clean. Thanks for sharing!
ALYB
June 1, 2025, 6:20am
5
It's nice to have a generic way to display a context menu, but after some rethinking I realized that I don't need to use a context menu. I always had this keyboard shortcut Cmd+F2 to open BBEdit. Now I have changed it so that it checks whether a text file or tmx file is selected. If so, it will open this file. If not, it will just open BBEdit.
Open (With) BBEdit.kmmacros (3.9 KB)