mxstbr / karabiner

My Karabiner Elements configuration

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ˜‡ Triggering application specific commands

jd-solanki opened this issue Β· comments

Hi πŸ‘‹πŸ»

I really liked you idea and want to add the same setup as yours with few changes.

I checked your script and found that We don't have per-app shortcuts/hotkeys that performs certain action for that application.

For example, If my foreground application is chrome and I want to duplicate the tab then I have menu command "Tab -> Duplicate tab" that duplicates the current tab. With the current implementation in this repo how can I trigger that menu command via sub layer key strokes. E.g. Pressing CAPS + C (_chrome_) + D should duplicate the current tab.

I would love to hear from you more automation related stuff from you.

Thanks for sharing ❀️

Hi @jd-solanki , if you'd like to give karabiner.ts a try, it is like

hyperLayer('c', 'hyper-chrome')
  .condition(ifApp('^com.google.Chrome$'))
  .manipulators({
    d: toKey('d', 'βŒ₯⇧'),
  })

if you'd like the whole hyper c layer only for Chrome. Otherwise it can be like

hyperLayer('c', 'hyper-c').manipulators([
  withCondition(ifApp('^com.google.Chrome$'))({
    d: toKey('d', 'βŒ₯⇧'),
  }),

  // When it is not on Chrome
  { d: toKey('d', '⌘') },
]),

Try it here