diff --git a/README.md b/README.md index 595e6dd..6639f66 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ This is an comprehensive workflow for The Archive that helps you work with your - [Templates](#templates) - [Importing URLs](#importing-urls) - [Importing Images](#importing-images) +- [Change Heading Levels](#change-heading-levels) - [Configuration](#configuration) - [Documentation](#documentation) - [Changelog](#changelog) @@ -177,6 +178,23 @@ To use the File Action: 3. Type `add` and select the "Add image to The Archive" file action. 4. Paste the generated markdown link of the image into your note. +## Change Heading Levels + +The workflow provides hotkeys that allow you easily change the heading level of a line in your note. A hotkey is simply a combination of keys that you press together in order to perform an action. These hotkeys are specific to The Archive and will only work if The Archive is the front most application and in focus. + +To use these hotkeys, click on the line in your note that you wish to change and then press the hotkey. + +> **Note:** These hotkeys use the **⇧⌘L** keyboard shortcut that is provided by The Archive to select the current line of text. If you have mapped this keyboard shortcut to something else, then these hotkeys will not work. + +### Hotkeys + +- **⌘ + 1**: Pressing this hotkey will change the line to a Heading 1 +- **⌘ + 2**: Pressing this hotkey will change the line to a Heading 2 +- **⌘ + 3**: Pressing this hotkey will change the line to a Heading 3 +- **⌘ + 4**: Pressing this hotkey will change the line to a Heading 4 +- **⌘ + 5**: Pressing this hotkey will change the line to a Heading 5 +- **⌘ + 6**: Pressing this hotkey will change the line to a Heading 6 + ## Configuration To change the configuration of the workflow, type `arconfig` in Alfred. You can also view the help file for each highlighted option with Quicklook by pressing the **⇧ Shift** key. diff --git a/info.plist b/info.plist index f917122..17f1f64 100644 --- a/info.plist +++ b/info.plist @@ -146,6 +146,19 @@ + 28072C72-6F5F-49D3-9C79-F39D03C75A11 + + + destinationuid + C36841B1-1B96-411D-BF40-7B4A70E3AE09 + modifiers + 0 + modifiersubtext + + vitoclose + + + 3078B7FC-DAD0-48C1-938B-E2C5102800D8 @@ -159,6 +172,19 @@ + 341A03B4-7E79-4AD7-A347-AF17C634D4FF + + + destinationuid + C36841B1-1B96-411D-BF40-7B4A70E3AE09 + modifiers + 0 + modifiersubtext + + vitoclose + + + 3666E55C-5EA1-4C6A-9565-22A55CE17403 @@ -292,30 +318,33 @@ destinationuid - 35224C2A-BA32-4CA1-8769-35B3B7F1D1C2 + 3666E55C-5EA1-4C6A-9565-22A55CE17403 modifiers - 0 + 1048576 modifiersubtext vitoclose + + 657FD06E-6635-4C54-88C2-8FF658370FD7 + destinationuid - 3666E55C-5EA1-4C6A-9565-22A55CE17403 + DBE958B2-368A-48F9-A8AB-1DC9FC300B27 modifiers - 1048576 + 0 modifiersubtext vitoclose - 657FD06E-6635-4C54-88C2-8FF658370FD7 + 65FB1EF4-D09E-4070-BB2E-E3FF6FB331EA destinationuid - DBE958B2-368A-48F9-A8AB-1DC9FC300B27 + C36841B1-1B96-411D-BF40-7B4A70E3AE09 modifiers 0 modifiersubtext @@ -363,6 +392,19 @@ + 82C3724E-6E6D-4282-A8D5-F528A6D5A0AE + + + destinationuid + C36841B1-1B96-411D-BF40-7B4A70E3AE09 + modifiers + 0 + modifiersubtext + + vitoclose + + + 8C6B9363-12F2-4E71-8CE7-D1D9777F05C3 @@ -556,6 +598,19 @@ + C36841B1-1B96-411D-BF40-7B4A70E3AE09 + + + destinationuid + 51A1F4B9-D0F3-40BD-AB30-22AF874BA1A9 + modifiers + 0 + modifiersubtext + + vitoclose + + + C767AF6B-DF2C-40A1-8F23-916EDE028F7F @@ -800,6 +855,32 @@ + F2D4CBD3-8C5E-42EE-903C-DDD8ADA6F33B + + + destinationuid + C36841B1-1B96-411D-BF40-7B4A70E3AE09 + modifiers + 0 + modifiersubtext + + vitoclose + + + + F6F03505-7E5B-44D3-9A34-845ABDC79BA1 + + + destinationuid + C36841B1-1B96-411D-BF40-7B4A70E3AE09 + modifiers + 0 + modifiersubtext + + vitoclose + + + FA40A7DB-25B4-464C-B269-EC046612AD60 @@ -2036,97 +2117,6 @@ version 1 - - config - - concurrently - - escaping - 102 - script - # THESE VARIABLES MUST BE SET. SEE THE ONEUPDATER README FOR AN EXPLANATION OF EACH. -readonly remote_info_plist="https://raw.githubusercontent.com/pryley/alfred-the-archive/master/src/info.plist" -readonly workflow_url="pryley/alfred-the-archive" -readonly download_type='github_release' -readonly frequency_check='4' - -# FROM HERE ON, CODE SHOULD BE LEFT UNTOUCHED! -function abort { - echo "${1}" >&2 - exit 1 -} - -function url_exists { - curl --silent --location --output /dev/null --fail --range 0-0 "${1}" -} - -function notification { - readonly local notificator="$(find . -type d -name 'Notificator.app')" - if [[ -n "${notificator}" ]]; then - "${notificator}/Contents/Resources/Scripts/notificator" --message "${1}" --title "${alfred_workflow_name}" --subtitle 'A new version is available' - return - fi - - readonly local terminal_notifier="$(find . -type f -name 'terminal-notifier')" - if [[ -n "${terminal_notifier}" ]]; then - "${terminal_notifier}" -title "${alfred_workflow_name}" -subtitle 'A new version is available' -message "${1}" - return - fi - - osascript -e "display notification \"${1}\" with title \"${alfred_workflow_name}\" subtitle \"A new version is available\"" -} - -# Local sanity checks -readonly local_info_plist='info.plist' -readonly local_version="$(/usr/libexec/PlistBuddy -c 'print version' "${local_info_plist}")" - -[[ -n "${local_version}" ]] || abort 'You need to set a workflow version in the configuration sheet.' -[[ "${download_type}" =~ ^(direct|page|github_release)$ ]] || abort "'download_type' (${download_type}) needs to be one of 'direct', 'page', or 'github_release'." -[[ "${frequency_check}" =~ ^[0-9]+$ ]] || abort "'frequency_check' (${frequency_check}) needs to be a number." - -# Check for updates -if [[ $(find "${local_info_plist}" -mtime +"${frequency_check}"d) ]]; then - if ! url_exists "${remote_info_plist}"; then abort "'remote_info_plist' (${remote_info_plist}) appears to not be reachable."; fi # Remote sanity check - - readonly tmp_file="$(mktemp)" - curl --silent --location --output "${tmp_file}" "${remote_info_plist}" - readonly remote_version="$(/usr/libexec/PlistBuddy -c 'print version' "${tmp_file}")" - - if [[ "${local_version}" == "${remote_version}" ]]; then - touch "${local_info_plist}" # Reset timer by touching local file - exit 0 - fi - - if [[ "${download_type}" == 'page' ]]; then - notification 'Opening download page…' - open "${workflow_url}" - exit 0 - fi - - download_url="$([[ "${download_type}" == 'github_release' ]] && curl --silent "https://api.github.com/repos/${workflow_url}/releases/latest" | grep 'browser_download_url' | head -1 | sed -E 's/.*browser_download_url": "(.*)"/\1/' || echo "${workflow_url}")" - - if url_exists "${download_url}"; then - notification 'Downloading and installing…' - curl --silent --location --output "${HOME}/Downloads/${alfred_workflow_name}.alfredworkflow" "${download_url}" - open "${HOME}/Downloads/${alfred_workflow_name}.alfredworkflow" - else - abort "'workflow_url' (${download_url}) appears to not be reachable." - fi -fi - scriptargtype - 1 - scriptfile - - type - 0 - - type - alfred.workflow.action.script - uid - 35224C2A-BA32-4CA1-8769-35B3B7F1D1C2 - version - 2 - config @@ -2260,6 +2250,43 @@ fi version 3 + + config + + action + 0 + argument + 3 + argumenttext + # + focusedappvariable + + focusedappvariablename + + hotkey + 18 + hotmod + 1048576 + hotstring + 1 + leftcursor + + modsmode + 0 + relatedApps + + de.zettelkasten.TheArchive + + relatedAppsMode + 1 + + type + alfred.workflow.trigger.hotkey + uid + 28072C72-6F5F-49D3-9C79-F39D03C75A11 + version + 2 + config @@ -2337,32 +2364,32 @@ end alfred_script config - delimiter - > - trimarguments - - variableprefix - path_query + argument + + variables + type - alfred.workflow.utility.split + alfred.workflow.utility.argument uid - 3666E55C-5EA1-4C6A-9565-22A55CE17403 + C767AF6B-DF2C-40A1-8F23-916EDE028F7F version 1 config - argument - - variables - + delimiter + > + trimarguments + + variableprefix + path_query type - alfred.workflow.utility.argument + alfred.workflow.utility.split uid - C767AF6B-DF2C-40A1-8F23-916EDE028F7F + 3666E55C-5EA1-4C6A-9565-22A55CE17403 version 1 @@ -2415,6 +2442,100 @@ end alfred_script version 1 + + config + + action + 0 + argument + 3 + argumenttext + ## + focusedappvariable + + focusedappvariablename + + hotkey + 19 + hotmod + 1048576 + hotstring + 2 + leftcursor + + modsmode + 0 + relatedApps + + de.zettelkasten.TheArchive + + relatedAppsMode + 1 + + type + alfred.workflow.trigger.hotkey + uid + 65FB1EF4-D09E-4070-BB2E-E3FF6FB331EA + version + 2 + + + config + + applescript + use AppleScript version "2.4" use framework "AppKit" use framework "Foundation" use scripting additions on alfred_script(level) set oldClip to my fetchStorableClipboard() set thePasteboard to current application's NSPasteboard's generalPasteboard() set theCount to thePasteboard's changeCount() tell application "System Events" to keystroke "c" using {command down} repeat 20 times if thePasteboard's changeCount() is not theCount then exit repeat delay 0.1 end repeat set regex to "^([#]+)?(\\s+)?(.*)" set input to (the clipboard) set heading to regex_match from the input against regex given replacement:"$3" set the clipboard to level & " " & heading tell application "System Events" to keystroke "v" using {command down} delay 0.2 my putOnClipboard:oldClip end alfred_script on fetchStorableClipboard() + set aMutableArray to current application's NSMutableArray's array() + set thePasteboard to current application's NSPasteboard's generalPasteboard() + repeat with anItem in thePasteboard's pasteboardItems() + set newPBItem to current application's NSPasteboardItem's alloc()'s init() + set theTypes to anItem's |types|() + repeat with aType in theTypes + set theData to (anItem's dataForType:aType)'s mutableCopy() + if theData is not missing value then + (newPBItem's setData:theData forType:aType) + end if + end repeat + (aMutableArray's addObject:newPBItem) + end repeat + return aMutableArray +end fetchStorableClipboard + +on putOnClipboard:theArray + set thePasteboard to current application's NSPasteboard's generalPasteboard() + thePasteboard's clearContents() + thePasteboard's writeObjects:theArray +end putOnClipboard: on regex_match against pattern from str given replacement:fmt set regex to current application's NSRegularExpression's regularExpressionWithPattern:pattern options:(current application's NSRegularExpressionCaseInsensitive) |error|:(missing value) (regex's stringByReplacingMatchesInString:str options:0 range:{0, length of str} withTemplate:fmt) as text end regex_match + cachescript + + + type + alfred.workflow.action.applescript + uid + 51A1F4B9-D0F3-40BD-AB30-22AF874BA1A9 + version + 1 + + + config + + count + 1 + keychar + l + keycode + -1 + keymod + 1179648 + overridewithargument + + + type + alfred.workflow.output.dispatchkeycombo + uid + C36841B1-1B96-411D-BF40-7B4A70E3AE09 + version + 1 + config @@ -2430,6 +2551,154 @@ end alfred_script version 1 + + config + + action + 0 + argument + 3 + argumenttext + ### + focusedappvariable + + focusedappvariablename + + hotkey + 20 + hotmod + 1048576 + hotstring + 3 + leftcursor + + modsmode + 0 + relatedApps + + de.zettelkasten.TheArchive + + relatedAppsMode + 1 + + type + alfred.workflow.trigger.hotkey + uid + F6F03505-7E5B-44D3-9A34-845ABDC79BA1 + version + 2 + + + config + + action + 0 + argument + 3 + argumenttext + #### + focusedappvariable + + focusedappvariablename + + hotkey + 21 + hotmod + 1048576 + hotstring + 4 + leftcursor + + modsmode + 0 + relatedApps + + de.zettelkasten.TheArchive + + relatedAppsMode + 1 + + type + alfred.workflow.trigger.hotkey + uid + 341A03B4-7E79-4AD7-A347-AF17C634D4FF + version + 2 + + + config + + action + 0 + argument + 3 + argumenttext + ##### + focusedappvariable + + focusedappvariablename + + hotkey + 23 + hotmod + 1048576 + hotstring + 5 + leftcursor + + modsmode + 0 + relatedApps + + de.zettelkasten.TheArchive + + relatedAppsMode + 1 + + type + alfred.workflow.trigger.hotkey + uid + F2D4CBD3-8C5E-42EE-903C-DDD8ADA6F33B + version + 2 + + + config + + action + 0 + argument + 3 + argumenttext + ###### + focusedappvariable + + focusedappvariablename + + hotkey + 22 + hotmod + 1048576 + hotstring + 6 + leftcursor + + modsmode + 0 + relatedApps + + de.zettelkasten.TheArchive + + relatedAppsMode + 1 + + type + alfred.workflow.trigger.hotkey + uid + 82C3724E-6E6D-4282-A8D5-F528A6D5A0AE + version + 2 + readme https://pryley.github.io/alfred-the-archive/ @@ -2485,6 +2754,15 @@ end alfred_script ypos 760 + 28072C72-6F5F-49D3-9C79-F39D03C75A11 + + colorindex + 3 + xpos + 10 + ypos + 1660 + 3078B7FC-DAD0-48C1-938B-E2C5102800D8 colorindex @@ -2494,16 +2772,14 @@ end alfred_script ypos 760 - 35224C2A-BA32-4CA1-8769-35B3B7F1D1C2 + 341A03B4-7E79-4AD7-A347-AF17C634D4FF colorindex - 4 - note - Workflow Updater + 3 xpos - 1010 + 10 ypos - 1660 + 2110 3666E55C-5EA1-4C6A-9565-22A55CE17403 @@ -2539,6 +2815,15 @@ end alfred_script ypos 1360 + 51A1F4B9-D0F3-40BD-AB30-22AF874BA1A9 + + note + Change heading level + xpos + 1010 + ypos + 1810 + 524CFE69-2161-4618-BC65-7D380B0B3EAD note @@ -2578,6 +2863,15 @@ end alfred_script ypos 1660 + 65FB1EF4-D09E-4070-BB2E-E3FF6FB331EA + + colorindex + 3 + xpos + 10 + ypos + 1810 + 699C78CF-86C9-47FA-A077-DB7462FDE43F xpos @@ -2603,6 +2897,15 @@ end alfred_script ypos 310 + 82C3724E-6E6D-4282-A8D5-F528A6D5A0AE + + colorindex + 3 + xpos + 10 + ypos + 2410 + 8A5F7A4E-FC3A-466E-A53A-38313E9F8022 note @@ -2755,6 +3058,13 @@ end alfred_script ypos 1060 + C36841B1-1B96-411D-BF40-7B4A70E3AE09 + + xpos + 410 + ypos + 1810 + C60A62FF-9B59-4C3C-99F3-807373F2125E note @@ -2940,6 +3250,24 @@ end alfred_script ypos 760 + F2D4CBD3-8C5E-42EE-903C-DDD8ADA6F33B + + colorindex + 3 + xpos + 10 + ypos + 2260 + + F6F03505-7E5B-44D3-9A34-845ABDC79BA1 + + colorindex + 3 + xpos + 10 + ypos + 1960 + FA40A7DB-25B4-464C-B269-EC046612AD60 note @@ -2985,7 +3313,7 @@ end alfred_script variablesdontexport version - 1.4.0 + 1.5.0 webaddress https://github.com/pryley/alfred-the-archive