Skip to content

Commit

Permalink
Rebuild cache with fn
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorgalvao committed Feb 25, 2023
1 parent faaabb1 commit ae4efbd
Show file tree
Hide file tree
Showing 3 changed files with 201 additions and 231 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ List File Stream contents from Google Drive

<a href='https://alfred.app/workflows/alfredapp/google-drive'>⤓ Install on the Alfred Gallery</a>

> On Alfred 4 use <a href='https://github.com/alfredapp/google-drive-workflow/releases/download/2022.12/Google.Drive.alfredworkflow'>alternative link</a>
## Setup

Set your Google Drive’s location in the [Workflow’s Configuration](https://www.alfredapp.com/help/workflows/user-configuration/).
Expand All @@ -18,11 +16,11 @@ Search the contents of your Google Drive via the Search Keyword (default: `gd`)

![Alfred search for gd fran](Workflow/images/about/gdfran.png)

* <kbd></kbd>: Open.
* <kbd>⌥</kbd><kbd></kbd>: Reveal in Finder.
* <kbd>⇧</kbd><kbd></kbd>: Search on Google Drive’s website.
* <kbd>&#xFE0E;</kbd>: Open.
* <kbd>⌥</kbd><kbd>&#xFE0E;</kbd>: Reveal in Finder.
* <kbd>⇧</kbd><kbd>&#xFE0E;</kbd>: Search on Google Drive’s website.

You’ll be asked to build the cache on your first run. A notification will show when it’s ready. The more files you have, the longer the wait. A macOS launchd agent will be loaded to do it daily and on boot. If necessary, an immediate cache rebuild can be forced with the `:gdrebuildcache` keyword.
You’ll be asked to build the cache on your first run. A notification will show when it’s ready. The more files you have, the longer the wait. A macOS launchd agent will be loaded to do it daily. An immediate cache rebuild can be forced with <kbd>fn</kbd><kbd>↩&#xFE0E;</kbd>.

The [Universal Actions](https://www.alfredapp.com/help/features/universal-actions/) make it straightforward to copy and move files to a Google Drive folder.

Expand Down
9 changes: 5 additions & 4 deletions Workflow/gd
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ unless File.exist?(Cache_file)
end

puts({ items: [{
variables: { build_cache: true },
variables: { action: 'build_cache' },
title: 'Build cache',
subtitle: 'It will take a few minutes to finish, depending on how many files you have.',
'arg': 'build_cache'
Expand All @@ -53,8 +53,9 @@ Init_script_filter_items = Results.each_with_object([]) { |path, array|
icon: { path: path, type: 'fileicon' },
arg: path,
mods: {
opt: { variables: { reveal_in_finder: true }, subtitle: 'Reveal in Finder' },
shift: { variables: { search_website: true }, subtitle: 'Search on Google Drive’s website', arg: basename }
opt: { variables: { action: 'reveal_in_finder' }, subtitle: 'Reveal in Finder' },
shift: { variables: { action: 'search_website' }, subtitle: 'Search on Google Drive’s website', arg: basename },
fn: { variables: { action: 'build_cache' }, subtitle: 'Force Cache Update' }
}
)
}
Expand All @@ -64,7 +65,7 @@ Script_filter_items = lambda {

# Append item for website search
return Init_script_filter_items.push({
variables: { search_website: true },
variables: { action: 'search_website' },
title: "Search “#{Typed_query}” on Google Drive’s website",
icon: { path: 'icon.png' },
arg: Typed_query
Expand Down
Loading

0 comments on commit ae4efbd

Please sign in to comment.