ascandroli
-
Posts
7 -
Joined
-
Last visited
Reputation Activity
-
ascandroli got a reaction from vitor in Media Controls
Just for the record and for future traveleres landing here from google like I did.
@vitor posted a new version of the script that works out of the box on Monterrey and it is written in swift.
-
ascandroli reacted to vitor in No module named Quartz
First open you Run Script. Edit it:
Change Language to /bin/zsh. Replace all code with /usr/bin/swift ./mediakeys "${1}"
Now open the Workflow’s contents in the Finder and create a new mediakeys file. Inside, put this code:
// Based on the code on https://stackoverflow.com/questions/11045814/emulate-media-key-press-on-mac import Quartz let NX_KEYTYPE_SOUND_UP: UInt32 = 0 let NX_KEYTYPE_SOUND_DOWN: UInt32 = 1 let NX_KEYTYPE_PLAY: UInt32 = 16 let NX_KEYTYPE_NEXT: UInt32 = 17 let NX_KEYTYPE_PREVIOUS: UInt32 = 18 let NX_KEYTYPE_FAST: UInt32 = 19 let NX_KEYTYPE_REWIND: UInt32 = 20 let supportedKeys: [String: UInt32] = ["playpause": NX_KEYTYPE_PLAY, "next": NX_KEYTYPE_NEXT, "prev": NX_KEYTYPE_PREVIOUS, "volup": NX_KEYTYPE_SOUND_UP, "voldown": NX_KEYTYPE_SOUND_DOWN] func HIDPostAuxKey(key: UInt32) { func keyDown(_ down: Bool) { let flags = NSEvent.ModifierFlags(rawValue: (down ? 0xa00 : 0xb00)) let data1 = Int((key << 16) | (down ? 0xa00 : 0xb00)) let ev = NSEvent.otherEvent(with: NSEvent.EventType.systemDefined, location: NSPoint(x:0,y:0), modifierFlags: flags, timestamp: 0, windowNumber: 0, context: nil, subtype: 8, data1: data1, data2: -1) let cev = ev?.cgEvent cev?.post(tap: CGEventTapLocation.cghidEventTap) } keyDown(true) keyDown(false) } HIDPostAuxKey(key: supportedKeys[CommandLine.arguments[1]]!)
The code could get some cleanup, but it will work like your previous one.
-
ascandroli got a reaction from iandol in Menu Search
Hi guys.
I've created a new version of this workflow with some improvements.
* Instead of a keyword I'm using a hotkey to trigger the workflow. I prefer CMD+SHIFT+SPACE but this is configurable.
* Instead of filtering in ruby I'm using Alfred's Script Filter.
* I've upgraded menudump to support Alfred's Script Filter JSON Format (https://github.com/ascandroli/menudump)
* I'm using the new "match" field to match against parent menus too. (requires Alfred 3.5)
Using Alfred's Script Filter JSON Format makes this workflow very fast.
Please take a look and let me know what you think: https://github.com/ascandroli/menudump/releases/download/1.8.0/Menu.Bar.Search-v1_8.alfredworkflow
Cheers.
Alejandro.
-
ascandroli reacted to nikivi in Menu Search
This is really awesome. I've been using KeyClue before but this is a bit faster. Thank you for sharing it.
-
ascandroli got a reaction from nikivi in Menu Search
Hi guys.
I've created a new version of this workflow with some improvements.
* Instead of a keyword I'm using a hotkey to trigger the workflow. I prefer CMD+SHIFT+SPACE but this is configurable.
* Instead of filtering in ruby I'm using Alfred's Script Filter.
* I've upgraded menudump to support Alfred's Script Filter JSON Format (https://github.com/ascandroli/menudump)
* I'm using the new "match" field to match against parent menus too. (requires Alfred 3.5)
Using Alfred's Script Filter JSON Format makes this workflow very fast.
Please take a look and let me know what you think: https://github.com/ascandroli/menudump/releases/download/1.8.0/Menu.Bar.Search-v1_8.alfredworkflow
Cheers.
Alejandro.
-
ascandroli got a reaction from Andrew in Script Filter outputs only one (probably the first) option [Fixed 3.5 b870 pre-release]
On b871 is working as expected. Many thanks @Andrew
BTW, I'm also playing with the new "match" field, nice addition!!