Skip to content

Commit 35c191f

Browse files
authored
Merge pull request pqrs-org#1000 from gradha/music_keyboard_controls
Adds keyboard shortcuts to explicitly play/pause/prev/next Music app.
2 parents 2b699c1 + caa2455 commit 35c191f

File tree

3 files changed

+77
-0
lines changed

3 files changed

+77
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<link rel="stylesheet" href="../../vendor/css/bootstrap.min.css" />
2+
3+
<br>
4+
<p>Tired of Safari or other apps stealing the focus of your shiny multimedia keys. Are you playing or pausing the youtube video when you actually want to pause the Music app in the background? Use these shortcuts instead to control the Music app explicitly to avoid mistakes!</p>
5+
<p>The keyboard shortcuts are based on old defaults from <a href="http://yellowmug.com/sk4it/">SizzlingKeys</a> which is not maintained any more and was only for iTunes rather than the new Apple Music app abomination. These shortcuts are most likely going to clash with something else you have, unless you have kept upgrading your mac from those times and never updated the shortcuts. So just copy the JSON and change the bindings to your liking.</p>
6+
<p>The three default keyboard bindings:</p>
7+
<ul>
8+
<li>Ctrl+Space: pauses or plays back the current Music tune. If the Music app is closed the app will be launched, but for whatever reason it won't start playing until you focus it and play something manually or repeat the keyboard shortcut. &#127822; peak software quality.</li>
9+
<li>Command+option+cursor right: Skips to the next song.</li>
10+
<li>Command+option+cursor left: Skips to the previous song.</li>
11+
</ul>
12+
13+
<p>All the <i>magic</i> is done through shell calls to <tt>osascript</tt>. You can find more information about available iTunes/Music commands to use in <tt>osascript</tt> at websites like <a href="https://dougscripts.com/itunes/itinfo/info03.php">Doug's AppleScripts</a>.</p>

public/groups.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,10 @@
521521
},
522522
{
523523
"path": "json/finder_improved_navigation.json"
524+
},
525+
{
526+
"path": "json/music_keyboard_controls.json",
527+
"extra_description_path": "extra_descriptions/music_keyboard_controls.html"
524528
}
525529
]
526530
},
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"title": "Basic Music app keyboard control",
3+
"rules": [
4+
{
5+
"description": "Uses Ctrl shortcuts to explicitly play/pause/prev/next Music app.",
6+
"manipulators": [
7+
{
8+
"type": "basic",
9+
"from": {
10+
"key_code": "spacebar",
11+
"modifiers": {
12+
"mandatory": [
13+
"left_control"
14+
]
15+
}
16+
},
17+
"to": [
18+
{
19+
"shell_command": "osascript -e 'tell application \"Music\" to playpause'"
20+
}
21+
]
22+
},
23+
{
24+
"type": "basic",
25+
"from": {
26+
"key_code": "left_arrow",
27+
"modifiers": {
28+
"mandatory": [
29+
"left_option",
30+
"left_command"
31+
]
32+
}
33+
},
34+
"to": [
35+
{
36+
"shell_command": "osascript -e 'tell application \"Music\" to previous track'"
37+
}
38+
]
39+
},
40+
{
41+
"type": "basic",
42+
"from": {
43+
"key_code": "right_arrow",
44+
"modifiers": {
45+
"mandatory": [
46+
"left_option",
47+
"left_command"
48+
]
49+
}
50+
},
51+
"to": [
52+
{
53+
"shell_command": "osascript -e 'tell application \"Music\" to next track'"
54+
}
55+
]
56+
}
57+
]
58+
}
59+
]
60+
}

0 commit comments

Comments
 (0)