Skip to content

Instantly share code, notes, and snippets.

@devnoname120
Last active January 9, 2024 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devnoname120/760425defb9ba6c373b7ed43128f378f to your computer and use it in GitHub Desktop.
Save devnoname120/760425defb9ba6c373b7ed43128f378f to your computer and use it in GitHub Desktop.
Karabiner-Elements — Microsoft Teams — Don't quit when pressing cmd-w on main window

Note: you need to add /Library/Application Support/org.pqrs/Karabiner-Elements/bin/karabiner_console_user_server in System SettingsPrivacy & SecurityAccessibility+

{
"author": "devnoname120 (https://github.com/devnoname120)",
"description": "Microsoft Teams — Don't quit when pressing cmd-w on main window",
"manipulators": [
{
"conditions": [
{
"bundle_identifiers": [
"^com.microsoft.teams2"
],
"type": "frontmost_application_if"
}
],
"from": {
"key_code": "w",
"modifiers": {
"mandatory": [
"command"
]
}
},
"to": [
{
"shell_command": "if /opt/homebrew/bin/yabai -m query --windows --window | /opt/homebrew/bin/jq --exit-status -r '.title | test(\"^(Chat|Calendar|Activity|Teams and Channels|Tasks by Planner and To Do|SRG SpecialNumbers|OneDrive|Apps) \\\\|\")'; then /usr/bin/osascript -e 'tell application \"System Events\" to keystroke \"h\" using command down'; else /usr/bin/osascript -e 'tell application \"System Events\" to keystroke \"w\" using command down'; fi"
}
],
"type": "basic"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment