effe Posted April 30, 2017 Share Posted April 30, 2017 Is it possible to remove several clipboard history items at once? I would for example like to be able to occasionally, on demand, be able to remove all clipboard history text items < 3 characters long. I know I can fn-delete individual items in the list, but I'd like to be able to perhaps activate a workflow to prune the clipboard history list en masse. Any ideas? Possible? Link to comment
Andrew Posted May 2, 2017 Share Posted May 2, 2017 @effe While this isn't possible natively in Alfred, the clipboard database is actually just an SQLite DB, so with a bit of scripting, you should be able to quite easily manipulate the database. You'll find the clipboard db in the following location: ~/Library/Application\ Support/Alfred\ 3/Databases/clipboard.alfdb The database has one table (clipboard) with the following columns: clipboard(item, ts decimal, app, apppath, dataType integer, dataHash); The text data is stored in the "item" column, and you'd probably want to only touch items with dataType = 0 as this is text items. Other items have external dependencies outside the database, such as images. Also worth adding that you fettle with this at your own (low) risk. The worst thing that could happen is you lose your history and have to start again. Cheers, Andrew Link to comment
effe Posted November 6, 2017 Author Share Posted November 6, 2017 Thank you. Apologies for not following up. I did end up just making a simple script that I run periodically to clear out short history items: #!/usr/bin/env bash threshold=3; sqlite3 "${HOME}/Library/Application Support/Alfred 3/Databases/clipboard.alfdb" <<STATEMENT DELETE FROM clipboard WHERE datatype = 0 AND LENGTH(TRIM(item)) <= $threshold; STATEMENT echo "text clipboard items with length <= $threshold removed from Alfred history" Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now