Jump to content

CJK

Member
  • Content Count

    79
  • Joined

  • Last visited

  • Days Won

    7

Reputation Activity

  1. Like
    CJK reacted to deanishe in Multiple commands/titles (aliases)   
    That works. But you could do the same more simply by putting the command keywords in match and letting Alfred do the filtering:
    import json import sys commands = [ { 'title': 'On', 'arg': 'on', 'match': 'on up activate', 'autocomplete': 'Bluetooth On', }, { 'title': 'Off', 'arg': 'off', 'match': 'off down deactivate', 'autocomplete': 'Bluetooth Off', }, { 'title': 'Restart', 'arg': 'restart', 'match': 'toggle change switch', 'autocomplete': 'Bluetooth Toggle', }, { 'title': 'restart', 'arg': 'restart', 'match': 'reset restart', 'autocomplete': 'Bluetooth Restart', }, ] json.dump(dict(items=commands), sys.stdout) In fact, if that's the entirety of the code, you don't even need Python. Just save a JSON file and cat it to Alfred. Much faster.
  2. Like
    CJK reacted to deanishe in Find, filter, open Git repositories   
    Alfred Git Repos Workflow
     
    Browse, search and open Git repositories from within Alfred.
     

     
    Download
     
    Get the workflow from GitHub or Packal.
     
    Usage
     
    This workflow requires some configuration before use. See Configuration for details.
    repos [<query>] — Show a list of your Git repos filtered by <query> ↩ — Open selected repo in app_1 (see configuration) ⌘+↩ — Open selected repo in app_2 (see configuration) ⌥+↩ — Open selected repo in app_3 (requires configuration) ^+↩ — Open selected repo in app_4 (requires configuration) ⇧+↩ — Open selected repo in app_5 (requires configuration) fn+↩ — Open selected repo in app_6 (requires configuration) reposettings — Open settings.json in default JSON editor reposupdate — Force workflow to update its cached list of repositories. (By default, the list will only be updated every 3 hours.) reposhelp — Open this file in your browser Configuration
     
    Before you can use this workflow, you have to configure one or more folders in which the workflow should search for Git repos. The workflow uses find to search for .git directories, so you shouldn't add huge directory trees to it, and use the depth option to restrict the search depth. Typically, a depth of 2 will be what you want (i.e. search within subdirectories of specified directory, but no lower). Add directories to search to the search_dir array in settings.json (see below).
     
    The default settings.json file looks like this:

    {   "app_1": "Finder",             // ↩ to open in this/these app(s)   "app_2": "Terminal",           // ⌘+↩ to open in this/these app(s)   "app_3": null,                 // ⌥+↩ to open in this/these app(s)   "app_4": null,                 // ^+↩ to open in this/these app(s)   "app_5": null,                 // ⇧+↩ to open in this/these app(s)   "app_6": null,                 // fn+↩ to open in this/these app(s)   "global_exclude_patterns": [],      // Exclude from all searches   "search_dirs": [ {   "path": "~/delete/this/example",   // Path to search. ~/ is expanded   "depth": 2,                        // Search subdirs of `path` "name_for_parent": 1,              // Name Alfred entry after parent of `.git`. 2 = grandparent of `.git` etc.   "excludes": [                      // Excludes specific to this path     "tmp",                           // Directories named `tmp`     "bad/smell/*"                    // Subdirs of `bad/smell` directory   ] }   ] }  
    This is my settings.json:
     
    { "app_1": "Finder", "app_2": ["Finder", "Sublime Text", "SourceTree", "iTerm"], "app_3": "Sublime Text", "app_4": "SourceTree", "app_5": "iTerm", "app_6": "GitHub", "global_exclude_patterns": [], "search_dirs": [ { "path": "~/Code" }, { "path": "~/Sites" } ] }    
    Search Directories
     
    Each entry in the search_dirs list must be a mapping.
     
    Only path is required. depth will default to 2 if not specified. excludes are globbing patterns, like in .gitignore.
     
    name_for_parent defaults to 1, which means the entry in Alfred's results should be named after the directory containing the .git directory. If you want Alfred to show the name of the grandparent, set name_for_parent to 2 etc.

    This is useful if your projects are structured, for example, like this and src is the actual repo:
     
    Code Project_1 src other_stuff Project_2 src other_stuff … …  
    Open in Applications
     
    The applications specified by the app_N options are all called using open -a AppName path/to/directory. You can configure any application that can open a directory in this manner. Some recommendations are Sublime Text, SourceTree, GitHub or iTerm.
     

    Note: As you can see from my settings.json, you can also set an app_N value to a list of applications to open the selected repo in more than one app at once:
     
    … "app_2": ["Finder", "Sublime Text", "SourceTree", "iTerm"], …  
    You can also use → on a result to access Alfred's default File Actions menu.
     
    License, Thanks
     
    This workflow is released under the MIT Licence.
     
    It uses the Alfred-Workflow and docopt libraries (both MIT Licence).
     
    The icon is by Jason Long, from git-scm.com, released under the Creative Commons Attribution 3.0 Unported Licence.
  3. Haha
    CJK reacted to deanishe in [HOW TO] Get frontmost tab’s url and title of various browsers   
    This thread isn't about a workflow…
  4. Like
    CJK reacted to buffaloseven in Launchbar Inspired Themes   
    While Alfred takes the cake when it comes to functionality, Launchbar certainly has a polished aesthetic. Here's my best shot at adapting its themes to Alfred.
     
    Light Theme
    https://www.alfredapp.com/extras/theme/gd0PV7UnCW/
     

     
    Dark Theme
    https://www.alfredapp.com/extras/theme/7ouF832MyU/
     

×
×
  • Create New...