Coder Social home page Coder Social logo

alfred-clip.py's Introduction

Icon

๐Ÿ clip.py

A REPL with Alfred's clipboard history being easily accessible in scripts.

Technically this is a REP, since the L in REPL is for loop. The output is put into your clipboard, so it's value is preserved, but only as another clipboard item. Any state you create in a previous evaluation is not remembered.

๐Ÿ“ถ Setup

By default the User Configuration should be setup correctly if you are using Alfred 5.

* `๐Ÿ’ฝ Database Path` - The PATH to the `clipboard.alfdb` file.
* `๐Ÿ—ƒ๏ธ Log Level`  - The level of debugging you want. Defaults to `info`.

โŒจ๏ธ Usage

Try: clippy>1+1

Open the prompt by typing cliprepl> and you'll be presented with a list of previous clipboard items. Try using this as a standard Python REPL such as cliprepl>1+1 will give you 2

๐Ÿ“‹ Clipboard

Try: clippy>t1+t1

Most of the results you are seeing are the clipboard contents.

To read the results you'll notice that * title is a unique identifier, which equates to a hex'd of rowid * By hex, I mean that a rowid of 231 would turn into e7 * subtitle is the value of the item (try hitting cmd for the float)

To access the variables in your command, you'll need to give it a type prefix.

Prefixes

* `t` prefix: (eg `te7`) would be the the value casted as a string.
	* For example `cliprepl> te7+te7` would append the text to itself.
* `f` prefix: (eg `fe7`) is the variable casted as a float.
	* For example `cliprepl> fe7+fe7` would add the two floats together.

Advanced

* Hitting `<enter>` or `<tab>` would autocomplete into ๐ŸŽฉ Alfred.
* Hitting `<cmd>` will show you the value casted as a float.
* Ending your query with a semicolon (`;`) will hide the clipboard results.
* Add custom functions and imports to the ๐Ÿงก Orange "Run Script"

๐Ÿ”Œ Developers, Developers, Developers

๐Ÿชต Logs

Logs are routed to stderr, this makes them visible in the debugger.

๐Ÿ“ Tests

There are a handful of unit tests that are runnable as well:

* `clippy>.test`

๐Ÿ’ฝ Schema

For reference, here is the schema of the clipboard.alfdb file as it's currently known.

  • rowid : A unique identifier generated by sqlite.
  • item : Likely the value.
  • ts : The timestamp, in seconds, when it was captured. Non unique.
  • app : A short name for the application it was copied from.
  • apppath : The absolute path of the application it was copied from.
  • dataType : Enum of 0 meaning text, or 1 meaning an image.
  • dataHash : If dataType is 1 this is a reference to the file on disk.

We do not simply sort by rowid but often by ts as well (ts DESC, rowid DESC) because it's possible for Alfred to update the ts in cases where you copy it back to your clipboard.

alfred-clip.py's People

Contributors

mxbaylee avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.