diff --git a/README.md b/README.md index 0507dcb..6f8c258 100644 --- a/README.md +++ b/README.md @@ -19,14 +19,14 @@ Find the latest release on the right-hand side of the main [README](https://gith In Alfred, select the Joplin Workflow and open the Configuration Build (top right, it looks like '(x)'). ![Configuration Build](https://github.com/skeletonkey/joplin_alfred_workflow/assets/1487600/650cb170-dd02-4f2b-ad9a-144d17e9e131) -On the Environment Variables tab, provide your token for JOPLIN_TOKEN and ensure that JOPLIN_URL has the correct port. +On the Environment Variables tab, provide your token for JOPLIN_TOKEN and ensure that JOPLIN_URL has the correct Port. ![Env Vars](https://github.com/skeletonkey/joplin_alfred_workflow/assets/1487600/924a089c-492c-4f09-b207-bdba0ae89984) ### Joplin Web Clipper To use Joplin's API, the Web Clipper needs to be enabled. -This is done by going to Joplin Preferences (Options) -> Web Clipper and enabling the web clipper. +Web Clipper can be enabled by going to Joplin Preferences (Options) -> Web Clipper and enabling the web clipper. ![Joplin Clipper](https://github.com/skeletonkey/joplin_alfred_workflow/assets/1487600/59880df4-e59d-43d9-a27f-ecd1039e72ef) Note the Port that it is running on and copy your Authorization Token. @@ -41,7 +41,7 @@ brew install curl ### Perl -Perl should be installed on your Mac device. +Perl should already be installed on your Mac device. ```bash brew install perl @@ -63,10 +63,18 @@ cpan install JSON Create a new note and open it in the specified folder. -Currently only an empty note (no title, no body) is created. [Issue #9](https://github.com/skeletonkey/joplin_alfred_workflow/issues/9) has been created to address this shortcoming. +Only an empty note (no title, no body) is created. [Issue #9](https://github.com/skeletonkey/joplin_alfred_workflow/issues/9) has been created to address this shortcoming. #### js _search words_ Search all of Joplin for the string entered. +*NOTE:* Joplin search operates on 'Words'; therefore, partial strings may not return what you expect. + *BUG* currently, words separated with a space are treated as two tokens with an AND operation instead of one string. + +#### jt _search words_ + +Search Joplin Note Titles for the string entered. + +*NOTE:* Joplin search operates on 'Words'; therefore, partial strings may not return what you expect. diff --git a/info.plist b/info.plist index f47a9a3..09a68d0 100644 --- a/info.plist +++ b/info.plist @@ -21,6 +21,19 @@ + 37A8BF91-10EC-4879-88A2-976F4EE28959 + + + destinationuid + 7ECD89F0-69D5-4743-AAF9-E0C2751C5A6E + modifiers + 0 + modifiersubtext + + vitoclose + + + 49E47331-FA4F-4C25-BB08-BB344B51A6D7 @@ -109,6 +122,31 @@ perl search_notes.pl $query 2>&1 version 3 + + config + + concurrently + + escaping + 102 + script + query=$1 + +perl create_note.pl $query + scriptargtype + 1 + scriptfile + + type + 11 + + type + alfred.workflow.action.script + uid + 305C4FC4-16E8-40CA-9742-E7CD7C269C37 + version + 2 + config @@ -133,45 +171,71 @@ perl search_notes.pl $query 2>&1 config - concurrently - + alfredfiltersresults + + alfredfiltersresultsmatchmode + 0 + argumenttreatemptyqueryasnil + + argumenttrimmode + 0 + argumenttype + 1 escaping 102 + keyword + jn + queuedelaycustom + 3 + queuedelayimmediatelyinitially + + queuedelaymode + 0 + queuemode + 1 + runningsubtext + script query=$1 -perl create_note.pl $query +perl find_folder.pl $query 2>&1 scriptargtype 1 scriptfile + subtext + <folder name> Titel of note + title + Create a new note type 11 + withspace + type - alfred.workflow.action.script + alfred.workflow.input.scriptfilter uid - 305C4FC4-16E8-40CA-9742-E7CD7C269C37 + D7C5E8DE-9100-473F-86E2-CF04F3D99F60 version - 2 + 3 config alfredfiltersresults - + alfredfiltersresultsmatchmode 0 argumenttreatemptyqueryasnil - + argumenttrimmode 0 argumenttype - 1 + 0 escaping 102 keyword - jn + jt queuedelaycustom 3 queuedelayimmediatelyinitially @@ -181,28 +245,28 @@ perl create_note.pl $query queuemode 1 runningsubtext - + Loading results... script - query=$1 + query=$* -perl find_folder.pl $query 2>&1 +perl search_notes.pl -t $query scriptargtype 1 scriptfile subtext - <folder name> Titel of note + title - Create a new note + Joplin: Search Note Titles type - 11 + 0 withspace type alfred.workflow.input.scriptfilter uid - D7C5E8DE-9100-473F-86E2-CF04F3D99F60 + 37A8BF91-10EC-4879-88A2-976F4EE28959 version 3 @@ -216,10 +280,20 @@ Report issues here: https://github.com/skeletonkey/joplin_alfred_workflow/issues 305C4FC4-16E8-40CA-9742-E7CD7C269C37 xpos - 285 + 200 ypos 255 + 37A8BF91-10EC-4879-88A2-976F4EE28959 + + note + Search Note Titles +This is an exact search on what Joplin considers words. + xpos + 30 + ypos + 435 + 49E47331-FA4F-4C25-BB08-BB344B51A6D7 note @@ -232,9 +306,9 @@ Report issues here: https://github.com/skeletonkey/joplin_alfred_workflow/issues 7ECD89F0-69D5-4743-AAF9-E0C2751C5A6E xpos - 535 + 625 ypos - 15 + 255 D7C5E8DE-9100-473F-86E2-CF04F3D99F60 diff --git a/search_notes.pl b/search_notes.pl index 1584162..6a7054f 100755 --- a/search_notes.pl +++ b/search_notes.pl @@ -1,16 +1,19 @@ -#!/usr/bin/perl -I . +#!/usr/bin/perl -I . -s use strict; use warnings; +use vars qw($t); use Joplin; use Jundy::AlfredWorkflow::Filter; +$t ||= 0; # search titles only + my $find = join(' ', @ARGV); my $data = Joplin::get_data( ["search"], - { fields => 'id,title', limit => 9, order_by => "updated_time", query => $find, } + { fields => 'id,title', order_by => "updated_time", query => $find, } ); my %display_data = ( @@ -19,6 +22,9 @@ ); if (exists $data->{items} && @{$data->{items}}) { my @items = @{$data->{items}}; + if ($t) { # search only titles + @items = grep { $_->{title} =~ /$find/i } @items; + } map { push(@{$display_data{data}}, { title => $_->{title}, subtitle => $_{title}, arg => $_->{id} }) } @items; } elsif (exists $data->{error}) {