Skip to content

Commit

Permalink
📝 [examples] Add examples for launching apps
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-liu committed Dec 31, 2023
1 parent f761afd commit 4496150
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 2 deletions.
4 changes: 2 additions & 2 deletions editor/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ifApp, ifDevice, ifVar, ifDeviceExists, ifInputSource, ifKeyboardType, ifEventCh
withCondition, withMapper, withModifier
} from 'karabiner.ts'

// ↓ ↓ ↓ Add support code if needed. ↑ ↑ ↑ Do not modify `import ...` ↑
// ↓ ↓ ↓ Add support code if needed. ↑ ↑ ↑ Do not delete `import ...` ↑

// ↑ ↑ ↑ Add support code if needed. ↓ ↓ ↓ Do not modify `export const rules` ↓
export const rules = () => [
Expand All @@ -23,5 +23,5 @@ export const rules = () => [
{ escape: toKey('caps_lock') },
]),

// ↑ ↑ ↑ Add rules and/or layers. ↓ ↓ ↓ Do not modify `]` below ↓
// ↑ ↑ ↑ Add rules and/or layers. ↓ ↓ ↓ Do not delete `]` below ↓
]
4 changes: 4 additions & 0 deletions examples/os-functionality/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"label": "OS Functionality",
"collapsed": true
}
8 changes: 8 additions & 0 deletions examples/os-functionality/launch-apps-layer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { layer, toApp } from '../../src'

export const rules = () => [
layer('l', 'launch-app').manipulators({
c: toApp('Calendar'),
f: toApp('Finder'),
}),
]
15 changes: 15 additions & 0 deletions examples/os-functionality/launch-apps-layer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: Launch Apps | Layer
---

Launch apps by layer + keys. When press and hold key `l` to activate
the 'launch-app' layer:

- `c`: Calendar
- `f`: Finder

Use any key for the layer, also consider using:

- `layer('l', 'launch-app')`
- `hyperLayer('l', 'launch-app')`
- `duoLayer('l', ';', 'launch-app')`
10 changes: 10 additions & 0 deletions examples/os-functionality/launch-apps-modifier.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { rule, toApp, withModifier } from '../../src'

export const rules = () => [
rule('Launch Apps').manipulators([
withModifier('right_control')({
c: toApp('Calendar'),
f: toApp('Finder'),
}),
]),
]
16 changes: 16 additions & 0 deletions examples/os-functionality/launch-apps-modifier.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: Launch Apps | Modifier
---

Launch apps by modifier + keys.

- right control + `c`: Calendar
- right control + `f`: Finder

To use multiple modifiers, use an array, like

```typescript
withModifier(['left_control', 'left_option'])
// or use alias:
withModifier('‹⌃⌥')
```

0 comments on commit 4496150

Please sign in to comment.