Coder Social home page Coder Social logo

cutbox / cutbox Goto Github PK

View Code? Open in Web Editor NEW
162.0 5.0 11.0 138.2 MB

CutBox makes your macOS pasteboard awesome.

Home Page: https://cutbox.github.io

License: Other

Swift 92.61% Ruby 0.45% Shell 3.84% Objective-C 0.24% Makefile 0.28% Python 2.58%
developer-tools macos pasteboard flycut history

cutbox's Introduction

   Codacy coverage  Dynamic JSON Badge

Make you macOS pasteboard awesome...

GitHub release (latest SemVer)

Sponsor  

1.6.0 Final Release

About CutBox

CutBox is a clipboard manager for MacOS, designed for developers. Search using fuzzy matching or regular expressions. Multiple clipboard items can be pasted at once. You can also filter to a time limit, e.g. "10 min" will show items copied in the last 10 min, you can text search on just those items.


CutBox also has advanced JavaScript and Shell command features. Using require(javascript_file) and/or shell(commandWithArgs) you can process text through any JS library or shell command before pasting it into your workflow.


Cutbox also has a command-line interface called cutbox. It allows you to fetch items from history, filter by search, and get n entries from the most recent or searched items. See below


Originally Inspired by JumpCut & Flycut

Using CutBox

CutBox Search is activated using a global hotkey, by default:

Cmd + Shift + V

Also Compact UI mode, which expands as above when searching.

Any text you copy on MacOS is saved to CutBox's history.

(This can be customized in preferences.)

Optionally paste through a function or shell process:

Search and Paste

With the CutBox window open, search for anything you copied.

Press Enter and the selected item will paste into your current app.

To exit press Esc.

Keyboard Shortcuts

Shortcut Keys Action
Esc Exit search
Ctrlg Exit search
Enter Paste selected
CmdEnter Paste through JavaScript Functions selected (you'll need ~/.cutbox.js set up)
CmdComma Open preferences
CmdDelete Delete selected item(s)
CmdComma Open preferences
Cmdt Toggle color themes
Cmdp Toggle preview
CmdShift= Zoom/scale up text
CmdShift- Zoom/scale down text
CmdShift0 Reset text scale/zoom
Cmd- Toggle join mode (paste multiple items, joined by newline or string: Set in preferences)
Cmd[ Toggle wrap mode (paste multiple items, wrapped by a pair of strings: Set in preferences)
Cmds Toggle search modes, fuzzy match, regexp/i or regexp
Cmdf Toggle search by favorites / everything (use the right click menu, to favorite)
Time limit filter
Cmdh Toggle search within time limit
Enter (in time limit input) Switch to text search input
In items list
Altup Move to top of items
Altdown Move to top of items
Hold Shift Expand single selection to new item, standard shift select
Hold Cmd Expand selection to new items, multiple selection groups, standard command select

Status bar menu

Use the status item to open Cutbox with the mouse, and access options:

Installation

Install via Homebrew Cask - Recommended

Install the compiled package.

brew tap cutbox/cutbox
brew install --cask cutbox

Read the notes shown by homebrew and follow the

Install by downloading the release DMG

Open the CutBox latest release page cutbox/CutBox/releases/latest

Download the DMG and open it on macOS. You'll find CutBox.app & cutbox (cli tool) inside.

Drag the .app to /Applications and copy cutbox to your somewhere in exec $PATH, for example, /usr/local/bin.

Follow the macOS Security Settings First Run section.

Install via Homebrew formula

Builds the package from source, a full Xcode installation needed.

brew tap cutbox/cutbox
brew install cutbox

macOS Security Settings First Run

When you first run CutBox Macos will prompt you that the developer cannot be identified.

Please read this post from Apple.

If you prefer to install open source software that isn't notarized (such as CutBox, Chromium or other large free opensource projects.) on your Mac, you can do this in the terminal.

sudo spctl --master-disable

I only recommend this if you feel comfortable using free software that you can code audit.

CutBox doesn't participate in Apple notarisation. CutBox will be free and open forever, and is licensed under GNU/GPL3, so the source is always available. Donations are important to help keep it developed and improved.

CutBox is quality checked by Codacy.

CutBox.app and cutbox releases are build using Github actions, so you can also inspect the entire test/deploy/delivery chain online at cutbox/CutBox.

If you have any concerns about the integrity of your CutBox.app, make sure to build it directly from source on your local machine, this is easily achieved using Homebrew and installing XCode. See Install via Homebrew formula

Permissions to enable CutBox paste

After installation or upgrade, the CutBox.app requires security permission for Accessibiliy. This is so that it can paste by faking Cmd+V.

Open System Preferences -> Security & Privacy -> Privacy -> Accessibility

Unlock the panel and add CutBox to the list of apps (also switch on the check box next to its icon).

If CutBox is already in the list of apps, you have to remove and replace it with the new version installed.

Apple System Preferences  -> Security & Privacy -> Privacy -> Accessibility

Please Note

CutBox.app must be restarted, for Accessibility permissions to activate. (macOS will suggest restarting CutBox anyway.)

Command line access

CutBox also has a CLI tool to access history via the terminal. Download the CLI command cutbox from releases. (From v1.5.8 onwards.)

Note the CLI only performs read-only actions on CutBox history.

CutBox history CLI

Display items from CutBox history. Most recent items first.

cutbox [options]

Options:

Search

-f or --fuzzy <query>   Fuzzy match items (case insensitive)
-r or --regex <query>   Regexp match items
-i or --regexi <query>  Regexp match items (case insensitive)
-e or --exact <string>  Exact substring match items (case sensitive)

Filtering

-l or --limit <num>     Limit to num items
-F or --favorites       Only list favorites
-M or --missing-date    Only list items missing a date (copied pre CutBox v1.5.5)

Filter by time units e.g. 7d, 1min, 5hr, 30s, 25sec, 3days, 2wks, 1.5hours, etc. Supports seconds, minutes, hours, days, weeks.

--since <time>
--before <time>

Filter by ISO 8601 date e.g. 2023-06-05T09:21:59Z

--since-date <date>
--before-date <date>

Info

--version               Show the current version
-h or --help            Show this help page

Would you like to know more?

More information is in the wiki

Found something wrong?

If you find a bug, click here to tell me what happened.

Contributing

  • Pull requests must have test cover, existing tests should not break.
  • Open an issue if tests are already failing, so I know I need to fix them.
  • Code must pass the quality checks as used by Codacy.

Clone and setup dependencies

git clone [email protected]:CutBox/CutBox

Compilation setup / tooling

bin/setup

To build CutBox.app:

bin/build

Run the local CutBox.app with terminal logging...

CutBox/build/CutBox.app/Contents/MacOS/CutBox

To use the newly built CutBox.app and move it to /Applications/CutBox.app:

bin/use_build_as_local_app

When build is complete it'll automatically open System Preferences > Security & Privacy > Privacy. Select the Accessibility list and add /Applications/CutBox.app

(Note if there is already a CutBox entry, remove it first, and add the new one. For any app, each build must be assigned permissions specifically.)

Apple System Preferences  -> Security & Privacy -> Privacy -> Accessibility

This is so CutBox.app can paste.

Assuming you are able to build, run, and use the new CutBox.app, you can use make install to generate a complete new build and install it, as you would with the multi step process above. Note that make install will also run lints, checks and tests.

Troubleshooting

Visit Gitter chat here, if you have problems getting up and running

Or open an issue https://github.com/cutbox/CutBox/issues

FAQs

  • When I do Cmd Shift v in other apps, CutBox opens. I need that command in another app!
    • Change the CutBox hotkey to be something you're happy with, in CutBox preferences (in the macOS status-bar menu)
  • My JS functions aren't loading from my ~/.cutbox.js?
    • Make sure you are using this.cutboxFunctions or globalThis.cutboxFunctions using var cutboxFunctions or let cutboxFunctions will not work as expected.
  • When I select item to paste, and press enter, nothing happens.
  • I can't start CutBox, macOS says it's "potentially malware"
    • Apple seems to confuse independent open source software, with "potential malware", this seems dishonest.
    • To enable CutBox follow the guide on macos security settings

Thank You...

CutBox has contributions from Carlos Enumo, Dávid Geréb, Denis Stanishevskiy, with support from Adam Johnson.

Thanks for you contriubutions and continued support.

Licence

CutBox is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

CutBox is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

cutbox's People

Contributors

davidgereb avatar dependabot[bot] avatar dstd avatar jasonm23 avatar pakerwreah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cutbox's Issues

Remove one item

I'd like to remove an item if I accidentally copy something sensitive.

Mouse action to paste.

I'm not much of a mouse user, so I'm interested how users would like the mouse to work with CutBox.

Automate CutBox release cycle

Automate these release steps

  • Use latest tag as VERSION
  • Fetch latest XCode Archive, extract CutBox.app and package in a custom DMG
  • Use hub release to create a new release on Github, include the latest DMG
  • Clean-up any left over files (e.g. .app or .dmg)
  • use message or file for release note
  • Build CutBox xcarchive with xcodebuild
  • Keep VERSION file, bump as part of the release pipeline

Multiple select

  • Selecting multiple items
  • Preview concatenated items
  • Paste concatenated items

Favorites

Favorites are items you have copied that you want to use more often, they survive clear and remove operations.

  • Modify structure of cutbox history items so that they are objects (value: String. isFavorite: Bool)
  • Migrate defaults array of strings to new format on start up
  • Users can set an item as favorite
  • Users can un-set a favorite item
  • option to only show favorites Cmd+F
  • display a visual indicator on favorites (background)

Add new issues to encourage small commits. :D

Compact UI

CutBox should start off looking like Alfred / Spotlight

When you interact with the keyboard it can expand into it's search / preview view.

  • When I open CutBox search it just shows a text field
  • When I start typing in the search field the items and preview show
  • When I press the down or up arrow the items and preview show, until I close CutBox
  • Preferences can enable / disable compact UI. (Default : compact on)
  • Pressing left or right on the empty search text field will open the hidden UI

Toggle wrapping strings on / off with key combo

When I want to paste without wrapping strings around start and end, and have it set in preferences, it's inconvenient to have to open preferences to change the setting.

Being able to toggle this with a keyboard shortcut will make things easier.

Change item removal methods

Removing individual items is fiddly with Cmd + Opt + double click

Change to:

  • Remove one or more selected items with context menu (right click on items)
  • Remove one or more selected items with Cmd + Backspace
    • Show a suppressible confirmation dialog ("Delete all selected items?", "Ok", "Cancel")

User Preference for multiple select join by string

When selecting multiple items I will want to join them in a usual way, depending on my preferences.

Allow me to select a join string in the preferences window.

Allow me to include escaped chars, e.g. newline

Scriptable Features: User can define functions to map/process clipboard item(s) before pasting.

  • Alpha version of this feature was delivered in 1.1.0 / 9000
  • Link preferences text directly to this issue. 1.1.1 / 9008

GIVEN I want special parsing on items
WHEN I paste a clipboard item
THEN A user-defined function can [map] the contents of the item(s)
AND The pasted text will be the result of the mapping function.

I'm not sure what I should use as a scripting language, but given that
JavaScript is extremely widely known/used, has first class functions,
and has excellent support on MacOS via JavaScriptCore...

I guess I will use JavaScript.

If you would like this feature add your vote by clicking on 👍 or 👎

[bug] paste on select / enter - not working.

90% of the time when I search my cutbox history and select something, my very next action will be to return to my previous window and paste it immediately (this is something from FlyCut). Would it be possible to automate this action (and save two keystrokes 😄) and always paste the selected clipboard item after selecting it from the cutbox window with enter?

Repro

  1. Select a text input field
  2. Open CutBox with ⌘⇧K
  3. Select a clipboard item with enter

Expected

  • selected CutBox history item pasted into text input field

Actual

  • CutBox item added to clipboard & sometimes (in chrome, but not Sublime) chime sound

Additional Details

  • video
  • I use dvorak and CloudApp (which automatically writes new text to clipboard)
  • This behavior works in the same environment if I use flycut (flycut is not running in the repro video).

About box

Show basic product info in an about box

Templates

Proposed feature

Favourite items will be editable, as an extension of this, it would be cool if we could use them as completable templates.

Assuming the following template syntax:

My ${subject} has ${adjectives}

When I tell cutbox this favorite item is a template, it should expand it when pasting.

  1. Show the text in an editing window.
  2. Each ${variable} will display as a completion point
  3. Pressing tab / shift tab will move the point between completion points
  4. Editing at a completion point will replace it with the new text
  5. Completion points for the same ${variable} will be filled with the same text

Preferences - user can limit number of clips

  • Add option to preferences window to either have unlimited clips in history or a given amount
  • only allow numbers in the history limit
  • apply limit to pasteboard service
  • Provide a confirmation alert to allow the user to avoid destroying their history by accident

Re-write.

Versions 0.0.0 through 1.0.16 are a prototype that I built while learning what was needed to build an app like this. As a result the code design took a back seat and I didn't the architecture drive with tests.

While I could've done the initial versions with better architecture and TDD, the overhead of becoming familiar with:

  • Status menu
  • Providing global OS shortcuts
  • Making a popup window
  • Generally launching windows in OSX
  • Interacting with the macos pasteboard
  • Discovering the level of support that RxCocoa has for Macos / NS view compontents
  • etc. etc. was taxing.

At this point I now feel that I could introduce several changes which would make the app more easy to extend and test.

I'll be investigating UI testing in osx. (Earl Grey?) so I can setup automated UAT and avoid breaking anything and then add in unit tests as appropriate.

Choose color theme

Change color theme by selecting different options

  • standard (Dark ocean)
  • light (Sky light)

Maybe add more later... for now a light and dark option.

Tagging items

@adellhk writes:

The tagging provides a lot of utility to me, personally. Sometimes I want the userId or OAuth token for my employee account, my personal account, or my test account. I would enjoy being able to label the things in my favorites to easily discern between similar (but different) super long strings (like oauth tokens).

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.