diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e21ac42 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.DS_Store +/releases +*.alfredworkflow \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..3faa234 --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +Video Controls for Alfred +=== + +I'll update this later, but for now, available keywords: + +- `airplay` +- `pip` +- `fullscreen` + +Works with any video elements in Safari. \ No newline at end of file diff --git a/alfred/018BBE1D-F229-4E9A-B10A-8C15F2091A17.png b/alfred/018BBE1D-F229-4E9A-B10A-8C15F2091A17.png new file mode 100644 index 0000000..b82b7ff Binary files /dev/null and b/alfred/018BBE1D-F229-4E9A-B10A-8C15F2091A17.png differ diff --git a/alfred/6E4EEBD5-0AB8-4986-8EC0-1CD707F41689.png b/alfred/6E4EEBD5-0AB8-4986-8EC0-1CD707F41689.png new file mode 100644 index 0000000..6a54d44 Binary files /dev/null and b/alfred/6E4EEBD5-0AB8-4986-8EC0-1CD707F41689.png differ diff --git a/alfred/9BD52D80-13AD-492C-9A4E-1FF2F4F501B3.png b/alfred/9BD52D80-13AD-492C-9A4E-1FF2F4F501B3.png new file mode 100644 index 0000000..26d9238 Binary files /dev/null and b/alfred/9BD52D80-13AD-492C-9A4E-1FF2F4F501B3.png differ diff --git a/alfred/icon.png b/alfred/icon.png new file mode 100644 index 0000000..f8fa954 Binary files /dev/null and b/alfred/icon.png differ diff --git a/alfred/info.plist b/alfred/info.plist new file mode 100644 index 0000000..acffb7e --- /dev/null +++ b/alfred/info.plist @@ -0,0 +1,380 @@ + + + + + bundleid + co.joshuaturner.alfred.videocontrols + category + Productivity + connections + + 018BBE1D-F229-4E9A-B10A-8C15F2091A17 + + + destinationuid + 51A666A2-F74D-44F8-AD73-DFD9F3BAC718 + modifiers + 0 + modifiersubtext + + vitoclose + + + + 06850930-4C07-447E-AE10-08051871E1B6 + + + destinationuid + BD21A9FA-8D8E-414A-84E2-99BE6F3F1FE5 + modifiers + 0 + modifiersubtext + + vitoclose + + + + 51A666A2-F74D-44F8-AD73-DFD9F3BAC718 + + + destinationuid + BD21A9FA-8D8E-414A-84E2-99BE6F3F1FE5 + modifiers + 0 + modifiersubtext + + vitoclose + + + + 6E4EEBD5-0AB8-4986-8EC0-1CD707F41689 + + + destinationuid + E01A971C-4713-4542-A5E5-3B9279FC1B33 + modifiers + 0 + modifiersubtext + + vitoclose + + + + 9BD52D80-13AD-492C-9A4E-1FF2F4F501B3 + + + destinationuid + 06850930-4C07-447E-AE10-08051871E1B6 + modifiers + 0 + modifiersubtext + + vitoclose + + + + BD21A9FA-8D8E-414A-84E2-99BE6F3F1FE5 + + + destinationuid + F96CB837-4F11-4F31-98CF-211BF786FF05 + modifiers + 0 + modifiersubtext + + vitoclose + + + + E01A971C-4713-4542-A5E5-3B9279FC1B33 + + + destinationuid + BD21A9FA-8D8E-414A-84E2-99BE6F3F1FE5 + modifiers + 0 + modifiersubtext + + vitoclose + + + + + createdby + Joshua Turner + description + Enable Picture in Picture, Fullscreen, and Airplay on any HTML5 video in Safari + disabled + + name + Video Controls + objects + + + config + + argumenttype + 2 + keyword + pip + subtext + Enter Picture in Picture in Safari if a video is playing in the foreground. + text + Enter Picture in Picture + withspace + + + type + alfred.workflow.input.keyword + uid + 6E4EEBD5-0AB8-4986-8EC0-1CD707F41689 + version + 1 + + + config + + argument + + variables + + code + javascript:document.querySelector('video').webkitSetPresentationMode('picture-in-picture'); + name + Picture in Picture + type + pip + + + type + alfred.workflow.utility.argument + uid + E01A971C-4713-4542-A5E5-3B9279FC1B33 + version + 1 + + + config + + concurrently + + escaping + 0 + script + ObjC.import('stdlib') + +var code = $.getenv('code') +var name = $.getenv('name') + +var frontmostAppName = Application('System Events').applicationProcesses.where({ frontmost: true }).name()[0] +var frontmostApp = Application(frontmostAppName) + +if (['Safari', 'Safari Technology Preview'].indexOf(frontmostAppName) > -1) { + frontmostApp.includeStandardAdditions = true + + try { + availableVideo = frontmostApp.doJavaScript("document.querySelectorAll('video').length;", { in: frontmostApp.documents[0] }) + + if (availableVideo) { + frontmostApp.doJavaScript(code, { in: frontmostApp.documents[0] }) + stdout = undefined + } else { + stdout = "No HTML5 videos were found in the focused tab of Safari." + } + + } catch(err) { + stdout = "You need to enable 'Allow JavaScript from Apple Events' in the Safari Develop menu. The Develop menu can be enabled in Safari's Preferences > Advanced tab." + } + +} else { + stdout = "Safari needs to be the focused app to trigger " + name + "." +} + scriptargtype + 1 + scriptfile + + type + 7 + + type + alfred.workflow.action.script + uid + BD21A9FA-8D8E-414A-84E2-99BE6F3F1FE5 + version + 2 + + + config + + argumenttype + 2 + keyword + fullscreen + subtext + Enter Fullscreen in Safari if a video is playing in the foreground. + text + Enter Fullscreen + withspace + + + type + alfred.workflow.input.keyword + uid + 9BD52D80-13AD-492C-9A4E-1FF2F4F501B3 + version + 1 + + + config + + lastpathcomponent + + onlyshowifquerypopulated + + removeextension + + text + {query} + title + {var:name} + + type + alfred.workflow.output.notification + uid + F96CB837-4F11-4F31-98CF-211BF786FF05 + version + 1 + + + config + + argument + + variables + + code + javascript:document.querySelector('video').webkitRequestFullscreen(); + name + Fullscreen + type + fullscreen + + + type + alfred.workflow.utility.argument + uid + 06850930-4C07-447E-AE10-08051871E1B6 + version + 1 + + + config + + argumenttype + 1 + keyword + airplay + subtext + Show Airplay Menu in Safari if a video is playing in the foreground. + text + Show Airplay Menu + withspace + + + type + alfred.workflow.input.keyword + uid + 018BBE1D-F229-4E9A-B10A-8C15F2091A17 + version + 1 + + + config + + argument + + variables + + code + javascript:document.querySelector('video').webkitShowPlaybackTargetPicker(); + name + Airplay + type + airplay + + + type + alfred.workflow.utility.argument + uid + 51A666A2-F74D-44F8-AD73-DFD9F3BAC718 + version + 1 + + + readme + + uidata + + 018BBE1D-F229-4E9A-B10A-8C15F2091A17 + + xpos + 100 + ypos + 310 + + 06850930-4C07-447E-AE10-08051871E1B6 + + xpos + 290 + ypos + 230 + + 51A666A2-F74D-44F8-AD73-DFD9F3BAC718 + + xpos + 290 + ypos + 340 + + 6E4EEBD5-0AB8-4986-8EC0-1CD707F41689 + + xpos + 100 + ypos + 90 + + 9BD52D80-13AD-492C-9A4E-1FF2F4F501B3 + + xpos + 100 + ypos + 200 + + BD21A9FA-8D8E-414A-84E2-99BE6F3F1FE5 + + xpos + 420 + ypos + 200 + + E01A971C-4713-4542-A5E5-3B9279FC1B33 + + xpos + 290 + ypos + 120 + + F96CB837-4F11-4F31-98CF-211BF786FF05 + + xpos + 610 + ypos + 200 + + + version + + webaddress + + + diff --git a/icons/icns/airplay.icns b/icons/icns/airplay.icns new file mode 100644 index 0000000..db4c50d Binary files /dev/null and b/icons/icns/airplay.icns differ diff --git a/icons/icns/fullscreen.icns b/icons/icns/fullscreen.icns new file mode 100644 index 0000000..dd72610 Binary files /dev/null and b/icons/icns/fullscreen.icns differ diff --git a/icons/icns/pip.icns b/icons/icns/pip.icns new file mode 100644 index 0000000..d599b44 Binary files /dev/null and b/icons/icns/pip.icns differ diff --git a/icons/icns/video.icns b/icons/icns/video.icns new file mode 100644 index 0000000..fc039f4 Binary files /dev/null and b/icons/icns/video.icns differ diff --git a/icons/png/airplay-1024.png b/icons/png/airplay-1024.png new file mode 100644 index 0000000..019eea3 Binary files /dev/null and b/icons/png/airplay-1024.png differ diff --git a/icons/png/airplay-128.png b/icons/png/airplay-128.png new file mode 100644 index 0000000..1a28fde Binary files /dev/null and b/icons/png/airplay-128.png differ diff --git a/icons/png/airplay-256.png b/icons/png/airplay-256.png new file mode 100644 index 0000000..5d4253a Binary files /dev/null and b/icons/png/airplay-256.png differ diff --git a/icons/png/airplay-32.png b/icons/png/airplay-32.png new file mode 100644 index 0000000..7bc511b Binary files /dev/null and b/icons/png/airplay-32.png differ diff --git a/icons/png/airplay-512.png b/icons/png/airplay-512.png new file mode 100644 index 0000000..d6c16fc Binary files /dev/null and b/icons/png/airplay-512.png differ diff --git a/icons/png/airplay-64.png b/icons/png/airplay-64.png new file mode 100644 index 0000000..78f1680 Binary files /dev/null and b/icons/png/airplay-64.png differ diff --git a/icons/png/fullscreen-1024.png b/icons/png/fullscreen-1024.png new file mode 100644 index 0000000..b1697ef Binary files /dev/null and b/icons/png/fullscreen-1024.png differ diff --git a/icons/png/fullscreen-128.png b/icons/png/fullscreen-128.png new file mode 100644 index 0000000..6264788 Binary files /dev/null and b/icons/png/fullscreen-128.png differ diff --git a/icons/png/fullscreen-256.png b/icons/png/fullscreen-256.png new file mode 100644 index 0000000..a6b6e2e Binary files /dev/null and b/icons/png/fullscreen-256.png differ diff --git a/icons/png/fullscreen-32.png b/icons/png/fullscreen-32.png new file mode 100644 index 0000000..2df70db Binary files /dev/null and b/icons/png/fullscreen-32.png differ diff --git a/icons/png/fullscreen-512.png b/icons/png/fullscreen-512.png new file mode 100644 index 0000000..8888062 Binary files /dev/null and b/icons/png/fullscreen-512.png differ diff --git a/icons/png/fullscreen-64.png b/icons/png/fullscreen-64.png new file mode 100644 index 0000000..15264d2 Binary files /dev/null and b/icons/png/fullscreen-64.png differ diff --git a/icons/png/pip-1024.png b/icons/png/pip-1024.png new file mode 100644 index 0000000..f99a7a4 Binary files /dev/null and b/icons/png/pip-1024.png differ diff --git a/icons/png/pip-128.png b/icons/png/pip-128.png new file mode 100644 index 0000000..c3d5b16 Binary files /dev/null and b/icons/png/pip-128.png differ diff --git a/icons/png/pip-256.png b/icons/png/pip-256.png new file mode 100644 index 0000000..d555699 Binary files /dev/null and b/icons/png/pip-256.png differ diff --git a/icons/png/pip-32.png b/icons/png/pip-32.png new file mode 100644 index 0000000..34bfbff Binary files /dev/null and b/icons/png/pip-32.png differ diff --git a/icons/png/pip-512.png b/icons/png/pip-512.png new file mode 100644 index 0000000..8160889 Binary files /dev/null and b/icons/png/pip-512.png differ diff --git a/icons/png/pip-64.png b/icons/png/pip-64.png new file mode 100644 index 0000000..f163394 Binary files /dev/null and b/icons/png/pip-64.png differ diff --git a/icons/png/video-1024.png b/icons/png/video-1024.png new file mode 100644 index 0000000..1def0ce Binary files /dev/null and b/icons/png/video-1024.png differ diff --git a/icons/png/video-128.png b/icons/png/video-128.png new file mode 100644 index 0000000..89c3cc2 Binary files /dev/null and b/icons/png/video-128.png differ diff --git a/icons/png/video-256.png b/icons/png/video-256.png new file mode 100644 index 0000000..959127e Binary files /dev/null and b/icons/png/video-256.png differ diff --git a/icons/png/video-32.png b/icons/png/video-32.png new file mode 100644 index 0000000..9489b46 Binary files /dev/null and b/icons/png/video-32.png differ diff --git a/icons/png/video-512.png b/icons/png/video-512.png new file mode 100644 index 0000000..489b3d0 Binary files /dev/null and b/icons/png/video-512.png differ diff --git a/icons/png/video-64.png b/icons/png/video-64.png new file mode 100644 index 0000000..c948c3d Binary files /dev/null and b/icons/png/video-64.png differ diff --git a/icons/sketch/html5.sketch b/icons/sketch/html5.sketch new file mode 100644 index 0000000..12803e4 Binary files /dev/null and b/icons/sketch/html5.sketch differ