[alfred] Update workflows

- Add icons to my app launcher and edit in macvim workflows
- Update Dash workflow
pull/28/head
Alpha Chen 9 years ago
parent 9f00c320ad
commit 7e2b7b5c7a

@ -3,7 +3,9 @@
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>bundleid</key> <key>bundleid</key>
<string></string> <string>com.arbitrarydefinitions.quickcursor</string>
<key>category</key>
<string>Tools</string>
<key>connections</key> <key>connections</key>
<dict> <dict>
<key>64D4866F-5048-4D9D-B4E4-E718528E7C30</key> <key>64D4866F-5048-4D9D-B4E4-E718528E7C30</key>
@ -21,42 +23,15 @@
<array/> <array/>
</dict> </dict>
<key>createdby</key> <key>createdby</key>
<string></string> <string>Alpha Chen</string>
<key>description</key> <key>description</key>
<string></string> <string></string>
<key>disabled</key> <key>disabled</key>
<false/> <false/>
<key>name</key> <key>name</key>
<string>QuickCursor</string> <string>Edit in MacVim</string>
<key>objects</key> <key>objects</key>
<array> <array>
<dict>
<key>config</key>
<dict>
<key>action</key>
<integer>0</integer>
<key>argument</key>
<integer>1</integer>
<key>hotkey</key>
<integer>9</integer>
<key>hotmod</key>
<integer>1835008</integer>
<key>hotstring</key>
<string>V</string>
<key>leftcursor</key>
<false/>
<key>modsmode</key>
<integer>0</integer>
<key>relatedAppsMode</key>
<integer>0</integer>
</dict>
<key>type</key>
<string>alfred.workflow.trigger.hotkey</string>
<key>uid</key>
<string>64D4866F-5048-4D9D-B4E4-E718528E7C30</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict> <dict>
<key>config</key> <key>config</key>
<dict> <dict>
@ -108,6 +83,33 @@ end</string>
<key>version</key> <key>version</key>
<integer>0</integer> <integer>0</integer>
</dict> </dict>
<dict>
<key>config</key>
<dict>
<key>action</key>
<integer>0</integer>
<key>argument</key>
<integer>1</integer>
<key>hotkey</key>
<integer>9</integer>
<key>hotmod</key>
<integer>1835008</integer>
<key>hotstring</key>
<string>V</string>
<key>leftcursor</key>
<false/>
<key>modsmode</key>
<integer>0</integer>
<key>relatedAppsMode</key>
<integer>0</integer>
</dict>
<key>type</key>
<string>alfred.workflow.trigger.hotkey</string>
<key>uid</key>
<string>64D4866F-5048-4D9D-B4E4-E718528E7C30</string>
<key>version</key>
<integer>1</integer>
</dict>
</array> </array>
<key>readme</key> <key>readme</key>
<string></string> <string></string>
@ -125,6 +127,6 @@ end</string>
</dict> </dict>
</dict> </dict>
<key>webaddress</key> <key>webaddress</key>
<string></string> <string>https://github.com/kejadlen</string>
</dict> </dict>
</plist> </plist>

@ -244,6 +244,33 @@
<string></string> <string></string>
</dict> </dict>
</array> </array>
<key>dash_keyword_rails</key>
<array>
<dict>
<key>destinationuid</key>
<string>dash_action_normal</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
<dict>
<key>destinationuid</key>
<string>dash_action_cmd</string>
<key>modifiers</key>
<integer>1048576</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
<dict>
<key>destinationuid</key>
<string>dash_action_alt</string>
<key>modifiers</key>
<integer>524288</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
</array>
<key>dash_keyword_rb</key> <key>dash_keyword_rb</key>
<array> <array>
<dict> <dict>
@ -271,6 +298,33 @@
<string></string> <string></string>
</dict> </dict>
</array> </array>
<key>dash_keyword_rubygems</key>
<array>
<dict>
<key>destinationuid</key>
<string>dash_action_normal</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
<dict>
<key>destinationuid</key>
<string>dash_action_cmd</string>
<key>modifiers</key>
<integer>1048576</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
<dict>
<key>destinationuid</key>
<string>dash_action_alt</string>
<key>modifiers</key>
<integer>524288</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
</array>
<key>dash_keyword_sqlalchemy</key> <key>dash_keyword_sqlalchemy</key>
<array> <array>
<dict> <dict>
@ -476,6 +530,254 @@
Do not try to change the keywords from within Alfred, as Dash will overwrite your changes. If you want to change a keyword, change it from within Dash (in Preferences &gt; Docsets). Do not try to change the keywords from within Alfred, as Dash will overwrite your changes. If you want to change a keyword, change it from within Dash (in Preferences &gt; Docsets).
That said, you can edit anything else within this workflow (including adding new triggers/actions/hotkeys).</string>
<key>subtext</key>
<string>Please read what's in the "Script:" section below</string>
<key>title</key>
<string>PLEASE README</string>
<key>type</key>
<integer>0</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>dash_note_readme</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>0</integer>
<key>escaping</key>
<integer>0</integer>
<key>runningsubtext</key>
<string>Please read what's in the "Script:" section below</string>
<key>script</key>
<string>Dash dynamically updates this workflow with docset and search profile keywords.
Do not try to change the keywords from within Alfred, as Dash will overwrite your changes. If you want to change a keyword, change it from within Dash (in Preferences &gt; Docsets).
That said, you can edit anything else within this workflow (including adding new triggers/actions/hotkeys).</string>
<key>subtext</key>
<string>Please read what's in the "Script:" section below</string>
<key>title</key>
<string>PLEASE README</string>
<key>type</key>
<integer>0</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>dash_note_readme</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>0</integer>
<key>escaping</key>
<integer>0</integer>
<key>runningsubtext</key>
<string>Please read what's in the "Script:" section below</string>
<key>script</key>
<string>Dash dynamically updates this workflow with docset and search profile keywords.
Do not try to change the keywords from within Alfred, as Dash will overwrite your changes. If you want to change a keyword, change it from within Dash (in Preferences &gt; Docsets).
That said, you can edit anything else within this workflow (including adding new triggers/actions/hotkeys).</string>
<key>subtext</key>
<string>Please read what's in the "Script:" section below</string>
<key>title</key>
<string>PLEASE README</string>
<key>type</key>
<integer>0</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>dash_note_readme</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>0</integer>
<key>escaping</key>
<integer>0</integer>
<key>runningsubtext</key>
<string>Please read what's in the "Script:" section below</string>
<key>script</key>
<string>Dash dynamically updates this workflow with docset and search profile keywords.
Do not try to change the keywords from within Alfred, as Dash will overwrite your changes. If you want to change a keyword, change it from within Dash (in Preferences &gt; Docsets).
That said, you can edit anything else within this workflow (including adding new triggers/actions/hotkeys).</string>
<key>subtext</key>
<string>Please read what's in the "Script:" section below</string>
<key>title</key>
<string>PLEASE README</string>
<key>type</key>
<integer>0</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>dash_note_readme</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>0</integer>
<key>escaping</key>
<integer>0</integer>
<key>runningsubtext</key>
<string>Please read what's in the "Script:" section below</string>
<key>script</key>
<string>Dash dynamically updates this workflow with docset and search profile keywords.
Do not try to change the keywords from within Alfred, as Dash will overwrite your changes. If you want to change a keyword, change it from within Dash (in Preferences &gt; Docsets).
That said, you can edit anything else within this workflow (including adding new triggers/actions/hotkeys).</string>
<key>subtext</key>
<string>Please read what's in the "Script:" section below</string>
<key>title</key>
<string>PLEASE README</string>
<key>type</key>
<integer>0</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>dash_note_readme</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>0</integer>
<key>escaping</key>
<integer>0</integer>
<key>runningsubtext</key>
<string>Please read what's in the "Script:" section below</string>
<key>script</key>
<string>Dash dynamically updates this workflow with docset and search profile keywords.
Do not try to change the keywords from within Alfred, as Dash will overwrite your changes. If you want to change a keyword, change it from within Dash (in Preferences &gt; Docsets).
That said, you can edit anything else within this workflow (including adding new triggers/actions/hotkeys).</string>
<key>subtext</key>
<string>Please read what's in the "Script:" section below</string>
<key>title</key>
<string>PLEASE README</string>
<key>type</key>
<integer>0</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>dash_note_readme</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>0</integer>
<key>escaping</key>
<integer>0</integer>
<key>runningsubtext</key>
<string>Please read what's in the "Script:" section below</string>
<key>script</key>
<string>Dash dynamically updates this workflow with docset and search profile keywords.
Do not try to change the keywords from within Alfred, as Dash will overwrite your changes. If you want to change a keyword, change it from within Dash (in Preferences &gt; Docsets).
That said, you can edit anything else within this workflow (including adding new triggers/actions/hotkeys).</string>
<key>subtext</key>
<string>Please read what's in the "Script:" section below</string>
<key>title</key>
<string>PLEASE README</string>
<key>type</key>
<integer>0</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>dash_note_readme</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>0</integer>
<key>escaping</key>
<integer>0</integer>
<key>runningsubtext</key>
<string>Please read what's in the "Script:" section below</string>
<key>script</key>
<string>Dash dynamically updates this workflow with docset and search profile keywords.
Do not try to change the keywords from within Alfred, as Dash will overwrite your changes. If you want to change a keyword, change it from within Dash (in Preferences &gt; Docsets).
That said, you can edit anything else within this workflow (including adding new triggers/actions/hotkeys).</string>
<key>subtext</key>
<string>Please read what's in the "Script:" section below</string>
<key>title</key>
<string>PLEASE README</string>
<key>type</key>
<integer>0</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>dash_note_readme</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>0</integer>
<key>escaping</key>
<integer>0</integer>
<key>runningsubtext</key>
<string>Please read what's in the "Script:" section below</string>
<key>script</key>
<string>Dash dynamically updates this workflow with docset and search profile keywords.
Do not try to change the keywords from within Alfred, as Dash will overwrite your changes. If you want to change a keyword, change it from within Dash (in Preferences &gt; Docsets).
That said, you can edit anything else within this workflow (including adding new triggers/actions/hotkeys).</string> That said, you can edit anything else within this workflow (including adding new triggers/actions/hotkeys).</string>
<key>subtext</key> <key>subtext</key>
<string>Please read what's in the "Script:" section below</string> <string>Please read what's in the "Script:" section below</string>
@ -696,6 +998,35 @@ That said, you can edit anything else within this workflow (including adding new
<key>version</key> <key>version</key>
<integer>0</integer> <integer>0</integer>
</dict> </dict>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>0</integer>
<key>escaping</key>
<integer>110</integer>
<key>keyword</key>
<string>rails</string>
<key>runningsubtext</key>
<string>Searching for "{query}"</string>
<key>script</key>
<string>./dashAlfredWorkflow "rails:{query}"</string>
<key>subtext</key>
<string>Search Ruby on Rails 4 for "{query}"</string>
<key>title</key>
<string>Search Ruby on Rails 4</string>
<key>type</key>
<integer>0</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>dash_keyword_rails</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict> <dict>
<key>config</key> <key>config</key>
<dict> <dict>
@ -725,6 +1056,35 @@ That said, you can edit anything else within this workflow (including adding new
<key>version</key> <key>version</key>
<integer>0</integer> <integer>0</integer>
</dict> </dict>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>0</integer>
<key>escaping</key>
<integer>110</integer>
<key>keyword</key>
<string>rubygems</string>
<key>runningsubtext</key>
<string>Searching for "{query}"</string>
<key>script</key>
<string>./dashAlfredWorkflow "rubygems:{query}"</string>
<key>subtext</key>
<string>Search sequel and 2 others for "{query}"</string>
<key>title</key>
<string>Search sequel</string>
<key>type</key>
<integer>0</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>dash_keyword_rubygems</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict> <dict>
<key>config</key> <key>config</key>
<dict> <dict>
@ -857,21 +1217,31 @@ The keyword is either a docset keyword (defined in Preferences &gt; Docsets) or
<key>ypos</key> <key>ypos</key>
<integer>1650</integer> <integer>1650</integer>
</dict> </dict>
<key>dash_keyword_rb</key> <key>dash_keyword_rails</key>
<dict> <dict>
<key>ypos</key> <key>ypos</key>
<integer>1770</integer> <integer>1770</integer>
</dict> </dict>
<key>dash_keyword_sqlalchemy</key> <key>dash_keyword_rb</key>
<dict> <dict>
<key>ypos</key> <key>ypos</key>
<integer>1890</integer> <integer>1890</integer>
</dict> </dict>
<key>dash_keyword_sqlite</key> <key>dash_keyword_rubygems</key>
<dict> <dict>
<key>ypos</key> <key>ypos</key>
<integer>2010</integer> <integer>2010</integer>
</dict> </dict>
<key>dash_keyword_sqlalchemy</key>
<dict>
<key>ypos</key>
<integer>2130</integer>
</dict>
<key>dash_keyword_sqlite</key>
<dict>
<key>ypos</key>
<integer>2250</integer>
</dict>
<key>dash_note_readme</key> <key>dash_note_readme</key>
<dict> <dict>
<key>ypos</key> <key>ypos</key>

@ -1,111 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>bundleid</key>
<string>com.alfredapp.david.googlesuggest</string>
<key>connections</key>
<dict>
<key>63F60794-BB56-4415-9372-BAF974C3A7E1</key>
<array>
<dict>
<key>destinationuid</key>
<string>B8FFA3AB-AD7D-4316-A84F-5958A671D4FF</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
</array>
</dict>
<key>createdby</key>
<string>David Ferguson</string>
<key>description</key>
<string>Get Google Search Suggestions</string>
<key>disabled</key>
<false/>
<key>name</key>
<string>Google Suggest</string>
<key>objects</key>
<array>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>0</integer>
<key>escaping</key>
<integer>36</integer>
<key>keyword</key>
<string>g</string>
<key>runningsubtext</key>
<string>Retrieving search suggestions ...</string>
<key>script</key>
<string>require_once('workflows.php');
$wf = new Workflows();
$orig = "{query}";
$xml = $wf-&gt;request( "http://google.com/complete/search?output=toolbar&amp;q=".urlencode( $orig ) );
$xml = simplexml_load_string( utf8_encode($xml) );
$int = 1;
foreach( $xml as $sugg ):
$data = $sugg-&gt;suggestion-&gt;attributes()-&gt;data;
$wf-&gt;result( $int.'.'.time(), "$data", "$data", 'Search Google for '.$data, 'icon.png' );
$int++;
endforeach;
$results = $wf-&gt;results();
if ( count( $results ) == 0 ):
$wf-&gt;result( 'googlesuggest', $orig, 'No Suggestions', 'No search suggestions found. Search Google for '.$orig, 'icon.png' );
endif;
echo $wf-&gt;toxml();</string>
<key>subtext</key>
<string>Search Google with Suggestions</string>
<key>title</key>
<string>Search Google</string>
<key>type</key>
<integer>1</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>63F60794-BB56-4415-9372-BAF974C3A7E1</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>searcher</key>
<integer>1635215215</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.systemwebsearch</string>
<key>uid</key>
<string>B8FFA3AB-AD7D-4316-A84F-5958A671D4FF</string>
<key>version</key>
<integer>0</integer>
</dict>
</array>
<key>readme</key>
<string></string>
<key>uidata</key>
<dict>
<key>63F60794-BB56-4415-9372-BAF974C3A7E1</key>
<dict>
<key>ypos</key>
<real>60</real>
</dict>
<key>B8FFA3AB-AD7D-4316-A84F-5958A671D4FF</key>
<dict>
<key>ypos</key>
<real>60</real>
</dict>
</dict>
<key>webaddress</key>
<string>dferg.us</string>
</dict>
</plist>

@ -1,462 +0,0 @@
<?php
/**
* Name: Workflows
* Description: This PHP class object provides several useful functions for retrieving, parsing,
* and formatting data to be used with Alfred 2 Workflows.
* Author: David Ferguson (@jdfwarrior)
* Revised: 2/9/2013
* Version: 0.2
*/
class Workflows {
private $cache;
private $data;
private $bundle;
private $path;
private $home;
private $results;
/**
* Description:
* Class constructor function. Intializes all class variables. Accepts one optional parameter
* of the workflow bundle id in the case that you want to specify a different bundle id. This
* would adjust the output directories for storing data.
*
* @param $bundleid - optional bundle id if not found automatically
* @return none
*/
function __construct( $bundleid=null )
{
$this->path = exec('pwd');
$this->home = exec('printf $HOME');
if ( file_exists( 'info.plist' ) ):
$this->bundle = $this->get( 'bundleid', 'info.plist' );
endif;
if ( !is_null( $bundleid ) ):
$this->bundle = $bundleid;
endif;
$this->cache = $this->home. "/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/".$this->bundle;
$this->data = $this->home. "/Library/Application Support/Alfred 2/Workflow Data/".$this->bundle;
if ( !file_exists( $this->cache ) ):
exec("mkdir '".$this->cache."'");
endif;
if ( !file_exists( $this->data ) ):
exec("mkdir '".$this->data."'");
endif;
$this->results = array();
}
/**
* Description:
* Accepts no parameter and returns the value of the bundle id for the current workflow.
* If no value is available, then false is returned.
*
* @param none
* @return false if not available, bundle id value if available.
*/
public function bundle()
{
if ( is_null( $this->bundle ) ):
return false;
else:
return $this->bundle;
endif;
}
/**
* Description:
* Accepts no parameter and returns the value of the path to the cache directory for your
* workflow if it is available. Returns false if the value isn't available.
*
* @param none
* @return false if not available, path to the cache directory for your workflow if available.
*/
public function cache()
{
if ( is_null( $this->bundle ) ):
return false;
else:
if ( is_null( $this->cache ) ):
return false;
else:
return $this->cache;
endif;
endif;
}
/**
* Description:
* Accepts no parameter and returns the value of the path to the storage directory for your
* workflow if it is available. Returns false if the value isn't available.
*
* @param none
* @return false if not available, path to the storage directory for your workflow if available.
*/
public function data()
{
if ( is_null( $this->bundle ) ):
return false;
else:
if ( is_null( $this->data ) ):
return false;
else:
return $this->data;
endif;
endif;
}
/**
* Description:
* Accepts no parameter and returns the value of the path to the current directory for your
* workflow if it is available. Returns false if the value isn't available.
*
* @param none
* @return false if not available, path to the current directory for your workflow if available.
*/
public function path()
{
if ( is_null( $this->path ) ):
return false;
else:
return $this->path;
endif;
}
/**
* Description:
* Accepts no parameter and returns the value of the home path for the current user
* Returns false if the value isn't available.
*
* @param none
* @return false if not available, home path for the current user if available.
*/
public function home()
{
if ( is_null( $this->home ) ):
return false;
else:
return $this->home;
endif;
}
/**
* Description:
* Returns an array of available result items
*
* @param none
* @return array - list of result items
*/
public function results()
{
return $this->results;
}
/**
* Description:
* Convert an associative array into XML format
*
* @param $a - An associative array to convert
* @param $format - format of data being passed (json or array), defaults to array
* @return - XML string representation of the array
*/
public function toxml( $a=null, $format='array' ) {
if ( $format == 'json' ):
$a = json_decode( $a, TRUE );
endif;
if ( is_null( $a ) && !empty( $this->results ) ):
$a = $this->results;
elseif ( is_null( $a ) && empty( $this->results ) ):
return false;
endif;
$items = new SimpleXMLElement("<items></items>"); // Create new XML element
foreach( $a as $b ): // Lop through each object in the array
$c = $items->addChild( 'item' ); // Add a new 'item' element for each object
$c_keys = array_keys( $b ); // Grab all the keys for that item
foreach( $c_keys as $key ): // For each of those keys
if ( $key == 'uid' ):
$c->addAttribute( 'uid', $b[$key] );
elseif ( $key == 'arg' ):
$c->addAttribute( 'arg', $b[$key] );
elseif ( $key == 'type' ):
$c->addAttribute( 'type', $b[$key] );
elseif ( $key == 'valid' ):
if ( $b[$key] == 'yes' || $b[$key] == 'no' ):
$c->addAttribute( 'valid', $b[$key] );
endif;
elseif ( $key == 'autocomplete' ):
$c->addAttribute( 'autocomplete', $b[$key] );
elseif ( $key == 'icon' ):
if ( substr( $b[$key], 0, 9 ) == 'fileicon:' ):
$val = substr( $b[$key], 9 );
$c->$key = $val;
$c->$key->addAttribute( 'type', 'fileicon' );
elseif ( substr( $b[$key], 0, 9 ) == 'filetype:' ):
$val = substr( $b[$key], 9 );
$c->$key = $val;
$c->$key->addAttribute( 'type', 'filetype' );
else:
$c->$key = $b[$key];
endif;
else:
$c->$key = $b[$key];
endif;
endforeach;
endforeach;
return $items->asXML(); // Return XML string representation of the array
}
/**
* Description:
* Remove all items from an associative array that do not have a value
*
* @param $a - Associative array
* @return bool
*/
private function empty_filter( $a ) {
if ( $a == '' || $a == null ): // if $a is empty or null
return false; // return false, else, return true
else:
return true;
endif;
}
/**
* Description:
* Save values to a specified plist. If the first parameter is an associative
* array, then the second parameter becomes the plist file to save to. If the
* first parameter is string, then it is assumed that the first parameter is
* the label, the second parameter is the value, and the third parameter is
* the plist file to save the data to.
*
* @param $a - associative array of values to save
* @param $b - the value of the setting
* @param $c - the plist to save the values into
* @return string - execution output
*/
public function set( $a=null, $b=null, $c=null )
{
if ( is_array( $a ) ):
if ( file_exists( $b ) ):
$b = $this->path."/".$b;
elseif ( file_exists( $this->data."/".$b ) ):
$b = $this->data."/".$b;
elseif ( file_exists( $this->cache."/".$b ) ):
$b = $this->cache."/".$b;
else:
$b = $this->data."/".$b;
endif;
else:
if ( file_exists( $c ) ):
$c = $this->path."/".$c;
elseif ( file_exists( $this->data."/".$c ) ):
$c = $this->data."/".$c;
elseif ( file_exists( $this->cache."/".$c ) ):
$c = $this->cache."/".$c;
else:
$c = $this->data."/".$c;
endif;
endif;
if ( is_array( $a ) ):
foreach( $a as $k => $v ):
exec( 'defaults write "'. $b .'" '. $k .' "'. $v .'"');
endforeach;
else:
exec( 'defaults write "'. $c .'" '. $a .' "'. $b .'"');
endif;
}
/**
* Description:
* Read a value from the specified plist
*
* @param $a - the value to read
* @param $b - plist to read the values from
* @return bool false if not found, string if found
*/
public function get( $a, $b ) {
if ( file_exists( $b ) ):
$b = $this->path."/".$b;
elseif ( file_exists( $this->data."/".$b ) ):
$b = $this->data."/".$b;
elseif ( file_exists( $this->cache."/".$b ) ):
$b = $this->cache."/".$b;
else:
return false;
endif;
exec( 'defaults read "'. $b .'" '.$a, $out ); // Execute system call to read plist value
if ( $out == "" ):
return false;
endif;
$out = $out[0];
return $out; // Return item value
}
/**
* Description:
* Read data from a remote file/url, essentially a shortcut for curl
*
* @param $url - URL to request
* @param $options - Array of curl options
* @return result from curl_exec
*/
public function request( $url=null, $options=null )
{
if ( is_null( $url ) ):
return false;
endif;
$defaults = array( // Create a list of default curl options
CURLOPT_RETURNTRANSFER => true, // Returns the result as a string
CURLOPT_URL => $url, // Sets the url to request
CURLOPT_FRESH_CONNECT => true
);
if ( $options ):
foreach( $options as $k => $v ):
$defaults[$k] = $v;
endforeach;
endif;
array_filter( $defaults, // Filter out empty options from the array
array( $this, 'empty_filter' ) );
$ch = curl_init(); // Init new curl object
curl_setopt_array( $ch, $defaults ); // Set curl options
$out = curl_exec( $ch ); // Request remote data
$err = curl_error( $ch );
curl_close( $ch ); // End curl request
if ( $err ):
return $err;
else:
return $out;
endif;
}
/**
* Description:
* Allows searching the local hard drive using mdfind
*
* @param $query - search string
* @return array - array of search results
*/
public function mdfind( $query )
{
exec('mdfind "'.$query.'"', $results);
return $results;
}
/**
* Description:
* Accepts data and a string file name to store data to local file as cache
*
* @param array - data to save to file
* @param file - filename to write the cache data to
* @return none
*/
public function write( $a, $b )
{
if ( file_exists( $b ) ):
$b = $this->path."/".$b;
elseif ( file_exists( $this->data."/".$b ) ):
$b = $this->data."/".$b;
elseif ( file_exists( $this->cache."/".$b ) ):
$b = $this->cache."/".$b;
else:
$b = $this->data."/".$b;
endif;
if ( is_array( $a ) ):
$a = json_encode( $a );
file_put_contents( $b, $a );
return true;
elseif ( is_string( $a ) ):
file_put_contents( $b, $a );
return true;
else:
return false;
endif;
}
/**
* Description:
* Returns data from a local cache file
*
* @param file - filename to read the cache data from
* @return false if the file cannot be found, the file data if found. If the file
* format is json encoded, then a json object is returned.
*/
public function read( $a )
{
if ( file_exists( $a ) ):
$a = $this->path."/".$a;
elseif ( file_exists( $this->data."/".$a ) ):
$a = $this->data."/".$a;
elseif ( file_exists( $this->cache."/".$a ) ):
$a = $this->cache."/".$a;
else:
return false;
endif;
$out = file_get_contents( $a );
if ( !is_null( json_decode( $out ) ) ):
$out = json_decode( $out );
endif;
return $out;
}
/**
* Description:
* Helper function that just makes it easier to pass values into a function
* and create an array result to be passed back to Alfred
*
* @param $uid - the uid of the result, should be unique
* @param $arg - the argument that will be passed on
* @param $title - The title of the result item
* @param $sub - The subtitle text for the result item
* @param $icon - the icon to use for the result item
* @param $valid - sets whether the result item can be actioned
* @param $auto - the autocomplete value for the result item
* @return array - array item to be passed back to Alfred
*/
public function result( $uid, $arg, $title, $sub, $icon, $valid='yes', $auto=null, $type=null )
{
$temp = array(
'uid' => $uid,
'arg' => $arg,
'title' => $title,
'subtitle' => $sub,
'icon' => $icon,
'valid' => $valid,
'autocomplete' => $auto,
'type' => $type
);
if ( is_null( $type ) ):
unset( $temp['type'] );
endif;
array_push( $this->results, $temp );
return $temp;
}
}

@ -1,87 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>bundleid</key>
<string>com.kejadlen.youtube-dl</string>
<key>connections</key>
<dict>
<key>2839B6E1-2D75-4243-9942-AD80110973FD</key>
<array>
<dict>
<key>destinationuid</key>
<string>909E38E9-F686-4F17-9842-1EB87235C84C</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
</array>
</dict>
<key>createdby</key>
<string>Alpha Chen</string>
<key>description</key>
<string>Download videos from a URL</string>
<key>disabled</key>
<false/>
<key>name</key>
<string>youtube-dl</string>
<key>objects</key>
<array>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>0</integer>
<key>keyword</key>
<string>youtube-dl</string>
<key>text</key>
<string>Download video from {query}</string>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.keyword</string>
<key>uid</key>
<string>2839B6E1-2D75-4243-9942-AD80110973FD</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>escaping</key>
<integer>0</integer>
<key>script</key>
<string>cd ~/BTSync
/usr/local/bin/youtube-dl "{query}"</string>
<key>type</key>
<integer>0</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>909E38E9-F686-4F17-9842-1EB87235C84C</string>
<key>version</key>
<integer>0</integer>
</dict>
</array>
<key>readme</key>
<string></string>
<key>uidata</key>
<dict>
<key>2839B6E1-2D75-4243-9942-AD80110973FD</key>
<dict>
<key>ypos</key>
<real>10</real>
</dict>
<key>909E38E9-F686-4F17-9842-1EB87235C84C</key>
<dict>
<key>ypos</key>
<real>10</real>
</dict>
</dict>
<key>webaddress</key>
<string></string>
</dict>
</plist>

@ -3,7 +3,7 @@
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>bundleid</key> <key>bundleid</key>
<string></string> <string>com.arbitrarydefintions.quickapp</string>
<key>category</key> <key>category</key>
<string>Tools</string> <string>Tools</string>
<key>connections</key> <key>connections</key>
@ -20,7 +20,16 @@
</dict> </dict>
</array> </array>
<key>2E57B3A5-B65F-4AB6-93B2-183BB082414B</key> <key>2E57B3A5-B65F-4AB6-93B2-183BB082414B</key>
<array/> <array>
<dict>
<key>destinationuid</key>
<string>CDB226D8-A880-4D6D-81DB-E44DEF05A972</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
</array>
<key>960E961A-2EF3-44C4-BFF2-B8BA1466C8EA</key> <key>960E961A-2EF3-44C4-BFF2-B8BA1466C8EA</key>
<array> <array>
<dict> <dict>
@ -306,7 +315,7 @@
<dict> <dict>
<key>paths</key> <key>paths</key>
<array> <array>
<string>~/Applications/YoruFukurou.app</string> <string>/opt/homebrew-cask/Caskroom/night-owl/latest/Night Owl.app</string>
</array> </array>
<key>toggle</key> <key>toggle</key>
<false/> <false/>
@ -414,11 +423,11 @@
<key>argument</key> <key>argument</key>
<integer>0</integer> <integer>0</integer>
<key>hotkey</key> <key>hotkey</key>
<integer>101</integer> <integer>100</integer>
<key>hotmod</key> <key>hotmod</key>
<integer>8388608</integer> <integer>8388608</integer>
<key>hotstring</key> <key>hotstring</key>
<string>F9</string> <string>F8</string>
<key>leftcursor</key> <key>leftcursor</key>
<false/> <false/>
<key>modsmode</key> <key>modsmode</key>
@ -433,9 +442,26 @@
<key>version</key> <key>version</key>
<integer>1</integer> <integer>1</integer>
</dict> </dict>
<dict>
<key>config</key>
<dict>
<key>paths</key>
<array>
<string>/opt/homebrew-cask/Caskroom/omnifocus/2.2.5/OmniFocus.app</string>
</array>
<key>toggle</key>
<false/>
</dict>
<key>type</key>
<string>alfred.workflow.action.launchfiles</string>
<key>uid</key>
<string>CDB226D8-A880-4D6D-81DB-E44DEF05A972</string>
<key>version</key>
<integer>0</integer>
</dict>
</array> </array>
<key>readme</key> <key>readme</key>
<string></string> <string>Icon by Designify.me</string>
<key>uidata</key> <key>uidata</key>
<dict> <dict>
<key>1EA28BFD-4D7A-444E-8904-EF68D0CBDC8C</key> <key>1EA28BFD-4D7A-444E-8904-EF68D0CBDC8C</key>
@ -493,6 +519,11 @@
<key>ypos</key> <key>ypos</key>
<real>250</real> <real>250</real>
</dict> </dict>
<key>CDB226D8-A880-4D6D-81DB-E44DEF05A972</key>
<dict>
<key>ypos</key>
<real>850</real>
</dict>
<key>D0DA2B6C-006F-47D0-8776-9FD4521B12FC</key> <key>D0DA2B6C-006F-47D0-8776-9FD4521B12FC</key>
<dict> <dict>
<key>ypos</key> <key>ypos</key>

Loading…
Cancel
Save