alfred-set-resolution-workflow
alfred-set-resolution-workflow copied to clipboard
Does not work in Alfred 3
In the recently released Alfred 3 I'm able to get as far as selecting the display, but no list of resolutions is displayed. When I select the display, Alfred is dismissed.
I'm using Alfred 3 and it's working fine for me, haven't changed a thing. I'm on Yosemite though, I haven't upgraded to El Capitan
Do you know how to run workflows on debugging mode? if so, please check if you see any errors while trying to list/change resolutions and let me know
Thanks!
Sure. I am running El Capitan, and have two 1080p Asus monitors. When I try to set the resolution for one of them, the Alfred window disappears without displaying any resolutions after I select the monitor. Here’s what I get in the debug window:
[2016-06-02 11:25:02][input.scriptfilter] <items><item valid='yes'><title>Display: ASUS VS239</title><arg>0</arg><subtitle>Change resolution for display ASUS VS239</subtitle><icon>icon.png</icon></item><item valid='yes'><title>Display: ASUS VS239</title><arg>1</arg><subtitle>Change resolution for display ASUS VS239</subtitle><icon>icon.png</icon></item></items>
[2016-06-02 11:25:03][input.scriptfilter] Processing output of 'action.script' with arg '0'
[2016-06-02 11:25:04][action.script] Processing output of ‘output.notification' with arg ''
And here's a short video of what's happening if that helps
I tried resetting the list of resolutions but that didn't change anything.
Thanks for looking into it, let me know if there's anything else I can do to help. I go to use this workflow at least a couple of times per day, and forget it's not working each time. It had really become a part of my workflow! Thanks for making it in the first place.
hmm, I sadly don't have a 2nd monitor to test. There're no errors in your output also. I'll try to check it later :/
I have the same error, but my debugging output actually prints an ActionScript error. I'm on OSX 10.10.5, MacBook 13" Early 2015 and my external monitor is 3840 x 2160 @ 60 fps .
[2016-06-07 09:34:53][ERROR: action.script] 23:31: syntax error: A “"” can’t go after this identifier. (-2740)
So, found what's causing it on my end:
You're calling Alfred 2 directly in set_resolution.rb :
if query =~ /^\d+$/
`osascript -e 'tell app "Alfred 2" to search "setresolution #{query} "'`
else
Changing "Alfred 2" to "Alfred 3" solves it, but would break Alfred 2 support. So I will file no PR atm.
I found references to Alfred 2 in the alfred-workflow gem, but that seems not to be an issue.
OMG haha, why is it working then! :D Thanks!, I'll figure out how to fix that for sure
Works fine for me in Alfred v3 on El Capitan without any changes. I only tried it on the Built-in Retina Display, though.
@dubstrike When I remember correctly, this only is an issue with multiple displays.
That's correct, it's only an issue on my desktop Mac with two 1080p monitors attached. Works fine on my 15" Retina MacBook Pro.
I don't have an easy way to debug and fix this since I don't have 2 displays Any help (PR) appreciated :)
diff --git a/workflow/set-resolution.rb b/workflow/set-resolution.rb
index ead286a..f203514 100644
--- a/workflow/set-resolution.rb
+++ b/workflow/set-resolution.rb
@@ -4,7 +4,7 @@
query = ARGV[0]
if query =~ /^\d+$/
- `osascript -e 'tell app "Alfred 2" to search "setresolution #{query} "'`
+ `osascript -e 'tell app "Alfred 3" to search "setresolution #{query} "'`
else
# extract values
display, width, height, bits, hidpi = ARGV[0].match(/(\d+)@(\d+)x(\d+)@(\d+)(h?)/).captures
This solves it for me, but I will not make a PR for changing a number. 😄 Also, this will break it for Alfred 2, I guess. Best thing would be to avoid this "hack" completely, but this is a little bit more work and I'm really not an expert on Alfred workflows or ruby, in particular.