feat(hammerspoon/app_toggle): enable multi-app toggles

A multi-app toggle is a keybinding which is configured to toggle 2 or
more applications.

This is intended as a context-ish-aware toggle, as it will only toggle
the most recently focused application. This essentially enables you to
bind a category/class of applications to a single hotkey, and whichever
of the apps that's running and was most recently focused is the one that
will be toggled.
This commit is contained in:
2023-04-23 16:28:21 +01:00
parent fd94bd2774
commit ab0de76e79
2 changed files with 156 additions and 40 deletions

View File

@@ -3,20 +3,32 @@ local obj = {}
function obj.init()
local apptoggle = require('app_toggle')
apptoggle:bind({'cmd', 'alt', 'ctrl'}, 'A', 'Activity Monitor')
apptoggle:bind({'cmd', 'ctrl'}, '2', 'ChatGPT')
apptoggle:bind({'cmd', 'ctrl'}, '4', 'Microsoft Edge')
apptoggle:bind({'cmd', 'ctrl'}, 'A', 'Messages')
apptoggle:bind({'cmd', 'ctrl'}, 'B', 'TablePlus')
apptoggle:bind({'cmd', 'ctrl'}, 'C', 'Calendar')
apptoggle:bind({'cmd', 'ctrl'}, 'D', 'Mailplane')
apptoggle:bind({'cmd', 'ctrl'}, 'E', 'Emacs', '/Applications/Emacs.app')
apptoggle:bind({'cmd', 'ctrl'}, 'F', 'Element Nightly')
apptoggle:bind({'cmd', 'ctrl'}, 'S', 'Music')
apptoggle:bind({'cmd', 'ctrl'}, 'T', 'Discord PTB')
apptoggle:bind({'cmd', 'ctrl'}, 'W', 'WhatsApp')
apptoggle:bind({'cmd', 'ctrl'}, 'X', 'Notion')
apptoggle:bind({'cmd', 'ctrl'}, 'Z', 'Slack')
apptoggle:bind({ 'cmd', 'alt', 'ctrl' }, 'A', { 'Activity Monitor' })
apptoggle:bind({ 'cmd', 'ctrl' }, '4', { 'Microsoft Edge' })
apptoggle:bind({ 'cmd', 'ctrl' }, 'A', { 'Messages' })
apptoggle:bind({ 'cmd', 'ctrl' }, 'C', { 'Calendar' })
apptoggle:bind({ 'cmd', 'ctrl' }, 'D', { 'Mailplane' })
apptoggle:bind({ 'cmd', 'ctrl' }, 'F', { 'Element Nightly' })
apptoggle:bind({ 'cmd', 'ctrl' }, 'S', { 'Music' })
apptoggle:bind({ 'cmd', 'ctrl' }, 'T', { 'Discord PTB' })
apptoggle:bind({ 'cmd', 'ctrl' }, 'X', { 'Notion' })
apptoggle:bind({ 'cmd', 'ctrl' }, 'Z', { 'Slack' })
apptoggle:bind({ 'cmd', 'ctrl' }, '2',
{ 'ChatGPT X' },
{ 'ChatGPT' }
)
apptoggle:bind({ 'cmd', 'ctrl' }, 'B',
{ 'TablePlus' },
{ 'Lens' }
)
apptoggle:bind({ 'cmd', 'ctrl' }, 'E',
{ 'Emacs', '/Applications/Emacs.app' }
)
apptoggle:bind({ 'cmd', 'ctrl' }, 'W',
{ 'Code', '/Applications/Visual Studio Code.app' }
)
end
return obj