Skip to content

Commit

Permalink
Support no Chrome installed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Mandrigin committed Aug 22, 2017
1 parent e8590f7 commit 8f19ed4
Showing 1 changed file with 207 additions and 25 deletions.
232 changes: 207 additions & 25 deletions AlfredWorkflow/info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,42 @@
<string>ru.mandrigin.alfred.sww</string>
<key>connections</key>
<dict>
<key>0EC23CAD-38F5-4A2D-B28A-A23685F1E575</key>
<array>
<dict>
<key>destinationuid</key>
<string>7686C74A-A33F-49C2-8231-40F1569A481A</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
<key>14FDFA95-B03E-42F9-8F94-0DD482CBCE47</key>
<array>
<dict>
<key>destinationuid</key>
<string>0EC23CAD-38F5-4A2D-B28A-A23685F1E575</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
<dict>
<key>destinationuid</key>
<string>4B55AF9F-D256-4871-B524-9938AD009D7E</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
<key>2A4DC329-9524-4CB9-BB77-7410877C746A</key>
<array>
<dict>
Expand All @@ -19,13 +55,26 @@
<false/>
</dict>
</array>
<key>4B55AF9F-D256-4871-B524-9938AD009D7E</key>
<array>
<dict>
<key>destinationuid</key>
<string>35084B51-B932-4220-A1EE-08DC1D667707</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
<key>7686C74A-A33F-49C2-8231-40F1569A481A</key>
<array/>
<key>BBE27144-1C88-4DB4-BCF3-B4E7CCE3A14B</key>
<array>
<dict>
<key>destinationuid</key>
<string>7686C74A-A33F-49C2-8231-40F1569A481A</string>
<string>14FDFA95-B03E-42F9-8F94-0DD482CBCE47</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
Expand All @@ -38,7 +87,7 @@
<array>
<dict>
<key>destinationuid</key>
<string>7686C74A-A33F-49C2-8231-40F1569A481A</string>
<string>14FDFA95-B03E-42F9-8F94-0DD482CBCE47</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
Expand All @@ -58,11 +107,82 @@
<string>Swift Window Switcher</string>
<key>objects</key>
<array>
<dict>
<key>config</key>
<dict>
<key>applescript</key>
<string>on alfred_script(q)
set argv to extract_argv(q, "|||||")
set proc to item 1 of argv
set tabIndex to item 2 of argv as integer
set windowName to item 3 of argv
try
tell application "System Events"
with timeout of 0.1 seconds
tell process proc to perform action "AXRaise" of window windowName
end timeout
end tell
end try
tell application proc
activate
end tell
if proc = "Safari" then
tell front window of application "Safari"
set current tab to tab tabIndex
end tell
end if
if proc = "Google Chrome" then
tell application "Google Chrome"
set active tab index of front window to tabIndex
end tell
end if
end alfred_script
on extract_argv(source_string, new_delimiter) set backup to AppleScript's text item delimiters set AppleScript's text item delimiters to new_delimiter set argv to every text item of source_string set AppleScript's text item delimiters to backup return argvend extract_argv</string>
<key>cachescript</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.action.applescript</string>
<key>uid</key>
<string>7686C74A-A33F-49C2-8231-40F1569A481A</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>inputstring</key>
<string>{query}</string>
<key>matchcasesensitive</key>
<true/>
<key>matchmode</key>
<integer>0</integer>
<key>matchstring</key>
<string>Google Chrome.*</string>
</dict>
<key>type</key>
<string>alfred.workflow.utility.filter</string>
<key>uid</key>
<string>0EC23CAD-38F5-4A2D-B28A-A23685F1E575</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>alfredfiltersresults</key>
<false/>
<key>argumenttrimmode</key>
<integer>0</integer>
<key>argumenttype</key>
<integer>1</integer>
<key>escaping</key>
Expand Down Expand Up @@ -101,59 +221,74 @@
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>type</key>
<string>alfred.workflow.utility.junction</string>
<key>uid</key>
<string>14FDFA95-B03E-42F9-8F94-0DD482CBCE47</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>applescript</key>
<string>on alfred_script(q)
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>68</integer>
<key>script</key>
<string>on run argv
set q to item 1 of argv
set argv to extract_argv(q, "|||||")
set proc to item 1 of argv
set tabIndex to item 2 of argv as integer
set windowName to item 3 of argv
tell application "System Events"
tell process proc to perform action "AXRaise" of window windowName
end tell
try
tell application "System Events"
with timeout of 0.1 seconds
tell process proc to perform action "AXRaise" of window windowName
end timeout
end tell
end try
tell application proc
activate
end tell
log "before Safari"
if proc = "Safari" then
tell front window of application "Safari"
set current tab to tab tabIndex
end tell
end if
if proc = "Google Chrome" then
tell application "Google Chrome"
set active tab index of front window to tabIndex
end tell
end if
end alfred_script
return q
end run
on extract_argv(source_string, new_delimiter) set backup to AppleScript's text item delimiters set AppleScript's text item delimiters to new_delimiter set argv to every text item of source_string set AppleScript's text item delimiters to backup return argvend extract_argv</string>
<key>cachescript</key>
<true/>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
<string></string>
<key>type</key>
<integer>6</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.applescript</string>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>7686C74A-A33F-49C2-8231-40F1569A481A</string>
<string>35084B51-B932-4220-A1EE-08DC1D667707</string>
<key>version</key>
<integer>1</integer>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>alfredfiltersresults</key>
<false/>
<key>argumenttrimmode</key>
<integer>0</integer>
<key>argumenttype</key>
<integer>1</integer>
<key>escaping</key>
Expand Down Expand Up @@ -225,6 +360,25 @@ on extract_argv(source_string, new_delimiter) set backup to AppleScript's text
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>inputstring</key>
<string>{query}</string>
<key>matchcasesensitive</key>
<true/>
<key>matchmode</key>
<integer>1</integer>
<key>matchstring</key>
<string>Google Chrome.*</string>
</dict>
<key>type</key>
<string>alfred.workflow.utility.filter</string>
<key>uid</key>
<string>4B55AF9F-D256-4871-B524-9938AD009D7E</string>
<key>version</key>
<integer>1</integer>
</dict>
</array>
<key>readme</key>
<string>Workflow fow switching between active windows in the system and Safari/Chrome tabs
Expand All @@ -236,21 +390,49 @@ To make this workflow work, don't forget to allow Alfred to control your apps (S
[1]: https://www.alfredforum.com/topic/9326-a-simple-windows-switcher/</string>
<key>uidata</key>
<dict>
<key>0EC23CAD-38F5-4A2D-B28A-A23685F1E575</key>
<dict>
<key>xpos</key>
<integer>550</integer>
<key>ypos</key>
<integer>80</integer>
</dict>
<key>14FDFA95-B03E-42F9-8F94-0DD482CBCE47</key>
<dict>
<key>xpos</key>
<integer>430</integer>
<key>ypos</key>
<integer>200</integer>
</dict>
<key>2A4DC329-9524-4CB9-BB77-7410877C746A</key>
<dict>
<key>xpos</key>
<integer>20</integer>
<key>ypos</key>
<integer>250</integer>
</dict>
<key>35084B51-B932-4220-A1EE-08DC1D667707</key>
<dict>
<key>xpos</key>
<integer>650</integer>
<key>ypos</key>
<integer>220</integer>
</dict>
<key>4B55AF9F-D256-4871-B524-9938AD009D7E</key>
<dict>
<key>xpos</key>
<integer>560</integer>
<key>ypos</key>
<integer>290</integer>
</dict>
<key>7686C74A-A33F-49C2-8231-40F1569A481A</key>
<dict>
<key>note</key>
<string>Hides the other processes.</string>
<key>xpos</key>
<integer>500</integer>
<integer>630</integer>
<key>ypos</key>
<integer>180</integer>
<integer>50</integer>
</dict>
<key>BBE27144-1C88-4DB4-BCF3-B4E7CCE3A14B</key>
<dict>
Expand All @@ -268,7 +450,7 @@ To make this workflow work, don't forget to allow Alfred to control your apps (S
</dict>
</dict>
<key>version</key>
<string>0.2.6</string>
<string>0.2.7</string>
<key>webaddress</key>
<string>mandrigin.ru</string>
</dict>
Expand Down

0 comments on commit 8f19ed4

Please sign in to comment.