Skip to content

Commit

Permalink
Added screencapture and toggle UI sound
Browse files Browse the repository at this point in the history
  • Loading branch information
tIsGoud committed Oct 23, 2020
1 parent 8fe3b51 commit fd97e89
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ The specific Apple keyboard setting involve the use of the 'fn' or function key.
| fn + l | ⌘ + ⌃ + q | Lock screen |
| fn + s | ⌘ + ⌥ + Eject | Sleep |

### Keychron K1 keyboard specific settings

The Keychron K1 keyboard setting has a special keys to take a screenshot right next to it is a key with a microphone that sends out fn + spacebar. I use this key to silently take a screenshot.

| Shortcut | Keystroke | Function |
| :--------- | :------------ | :----------------- |
| microphone | fn + spacebar | Call screencapture |

### Generic shortcuts

You might wonder why there are 5 hyper-keys, yes it is to much but I'm still figuring out which hyperkey location is most convenient. The position of your hands above the keyboard is an important factor in this. Using the capslock as hyper key is also a good option due to the size of the key.
Expand All @@ -58,6 +66,7 @@ You might wonder why there are 5 hyper-keys, yes it is to much but I'm still fig
| e + m | ⌘ + ⌃ + Space | Open Emoji picker |
| Capslock + l | ⌘ + ⌃ + q | Lock screen |
| Capslock + m | ⌘ + ⌃ + Space | Open Emoji picker |
| Capslock + u | | Toggle System UI Sound Effects |
| Capslock + \ | | Open Finder |
| Capslock + s | | Open Safari |
| Capslock + f | | Open Firefox |
Expand Down
24 changes: 24 additions & 0 deletions karabiner.edn
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,17 @@
:templates {
:open "open -a '%s'" ;; :open "Safari"
:openApp "open \"%s\"" ;; :open "/Applications/Safari.app"
:screen_capture_clipboard "screencapture -ixc" ;; Capture screen interactive and silent to clipboard
:screen_capture_preview "screencapture -ixP" ;; Capture screen interactive and silent to Preview
:applescript "osascript '/Users/albert/Library/Mobile Documents/com~apple~ScriptEditor2/Documents/%s'"
;; Full path to user's 'iCloud Drive/Script Editor'
;; You can't use '~' for the users home directory
:ui_audio_enabled "defaults write 'Apple Global Domain' com.apple.sound.uiaudio.enabled -bool %s"
;; Enable or disable "Play user interface sound effects"
;; ui_audio_enabled [true/false]
:notification "osascript -e 'display notification \"%s\" with title \"%s\"'"
;; Display notification
;; notifcation "text" "title"
:type "osascript -e 'tell application \"System Events\" to keystroke \"%s\" as text'"
:beep "osascript -e 'beep'" ;; Play default beep
:purr "afplay /System/Library/Sounds/Purr.aiff" ;; Play the Purr sound
Expand Down Expand Up @@ -106,6 +114,11 @@
{:vendor_id 1241, :product_id 36 }
{:vendor_id 1241, :product_id 41208 }
]

:kb-keychron-k1 [
{:vendor_id 1452, product_id 591 } ;; Keychron K1 keyboard
]

} ;; devices

;; main contains multiple manipulators
Expand Down Expand Up @@ -181,6 +194,15 @@
]
}

;; The microphone button by default does function + spacebar on the Keychron K1 keyboard,
;; with this it becomes the "Copy picture of selected area to clipboard".
{:des "Keychron K1 - microphone button becomes 'Copy picture of selected area to clipboard'"
:rules [ :kb-keychron-k1
[[:fn :spacebar] [:screen_capture_clipboard]] ;; Silently capture selected area to clipboard
[[:#Wfn :spacebar] [:screen_capture_preview]] ;; Silently capture selected area to clipboard
]
}

;; Shortcut `command` for command+tab to switch between the current and previous application
;; Shortcut `option` for command+tilde to cycle through the open windows of an application
;; Shortcut `control` for control+tab to go to the next tab in most applications
Expand Down Expand Up @@ -243,6 +265,8 @@
:rules [ :hyper-mode
[:l [:!CTq]] ; 'l' - Lock Screen
[:m [:!TCspacebar]] ; 'm' - Emoji picker
[:u [[:notification "🔕" "UI Sound effects off"] [:ui_audio_enabled "false"]["audio_off" 1]] :!audio_off]
[:u [[:notification "🔔" "UI Sound effects on"] [:ui_audio_enabled "true"]["audio_off" 0]] :audio_off]
[:slash [:open "Finder"]] ; '/' - Open Finder
[:p [:open "Preview"]] ; 'p' - Open Preview
[:s [:open "Safari"]] ; 's' - Open Safari
Expand Down

0 comments on commit fd97e89

Please sign in to comment.