From 5996e6116e87ff4b5ae3de954feb98e90d8a674c Mon Sep 17 00:00:00 2001 From: Christian Baer Date: Thu, 5 Dec 2024 09:19:58 +0100 Subject: [PATCH] Karabiner: Added config --- .config/karabiner/karabiner.json | 62 +++++++++++++++++++ .../karabiner/scripts/spotify_playpause.scpt | 6 ++ 2 files changed, 68 insertions(+) create mode 100644 .config/karabiner/karabiner.json create mode 100644 .config/karabiner/scripts/spotify_playpause.scpt diff --git a/.config/karabiner/karabiner.json b/.config/karabiner/karabiner.json new file mode 100644 index 0000000..c942a3a --- /dev/null +++ b/.config/karabiner/karabiner.json @@ -0,0 +1,62 @@ +{ + "profiles": [ + { + "complex_modifications": { + "rules": [ + { + "description": "Play/Pause controls spotify only when it's running", + "manipulators": [ + { + "from": { "key_code": "f8" }, + "to": [ + { + "halt": true, + "repeat": false, + "shell_command": "osascript ~/.config/karabiner/scripts/spotify_playpause.scpt" + } + ], + "type": "basic" + } + ] + }, + { + "description": "Caps Lock → Hyper Key without Shift (⌃⌥⌘)", + "manipulators": [ + { + "from": { "key_code": "caps_lock" }, + "to": [ + { + "key_code": "left_command", + "modifiers": ["left_control", "left_option"] + } + ], + "to_if_alone": [{ "key_code": "caps_lock" }], + "type": "basic" + } + ] + } + ] + }, + "devices": [ + { + "identifiers": { + "is_keyboard": true, + "is_pointing_device": true, + "product_id": 45091, + "vendor_id": 1133 + }, + "ignore": false + } + ], + "name": "Default profile", + "selected": true, + "simple_modifications": [ + { + "from": { "consumer_key_code": "play_or_pause" }, + "to": [{ "key_code": "vk_none" }] + } + ], + "virtual_hid_keyboard": { "keyboard_type_v2": "iso" } + } + ] +} \ No newline at end of file diff --git a/.config/karabiner/scripts/spotify_playpause.scpt b/.config/karabiner/scripts/spotify_playpause.scpt new file mode 100644 index 0000000..ace3832 --- /dev/null +++ b/.config/karabiner/scripts/spotify_playpause.scpt @@ -0,0 +1,6 @@ +-- If Spotify is running, toggle play/pause. Otherwise do nothing +if application "Spotify" is running then + using terms from application "Spotify" + tell application "Spotify" to playpause + end using terms from +end if \ No newline at end of file