Skip to content

Commit

Permalink
clipy
Browse files Browse the repository at this point in the history
  • Loading branch information
szktkfm committed Dec 27, 2024
1 parent dfbbdf3 commit 15749e2
Show file tree
Hide file tree
Showing 15 changed files with 425 additions and 121 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,18 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version: '1.23'
cache: false

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libx11-dev xclip xsel
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-go@v3
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true

- uses: goreleaser/goreleaser-action@v4
- uses: goreleaser/goreleaser-action@v6
with:
args: release --rm-dist
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28 changes: 8 additions & 20 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,20 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: '1.22'
go-version: '1.23'

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libx11-dev xclip xsel
- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...

test_on_windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.22'

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@
*.bkup

test.db

clipy
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ test:
.PHONY: clean
clean:
rm -f clipy debug.log

# TODO vhsをMakefile化する
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# 📋clipy: Manage Your Clipboard History

clipy is a simple tool that saves your clipboard history to a local sqlite database and lets you browse and select entries using an fzf-like interface.

<img src="assets/clipy-demo.gif" width="700">

## How to install

To install clipy using Go, run:

```sh
$ go install github.com/szktkfm/clipy/cmd/clipy@latest
```

Or, download it:

[GitHub Releases](https://github.com/szktkfm/clipy/releases)

## How to use

Run `clipy shell` to generate a shell script, and then add it to your zshrc or bashrc file for seamless integration.

```sh
$ clipy shell zsh | tee -a ~/.zshrc

# https://github.com/szktkfm/clipy
# Run daemon
clipy

__clipy_history() {
BUFFER="${BUFFER}"$(clipy history --tmux)
CURSOR=${#BUFFER}
zle redisplay
}
zle -N __clipy_history

# Bind the function to Ctrl+j
bindkey "^j" __clipy_history
```

```sh
$ source ~/.zshrc
```

Use the `clipy` command to start a background daemon. This daemon monitors your clipboard for new entries and saves them to the local sqlite database.

```sh
$ clipy
```

Access your clipboard history with the `clipy history` command. If you've set up the shell integration, you can invoke this with Ctrl + J for quick access.

```sh
$ clipy history
```

If you're using tmux, you can display the history in a popup using `tmux display-popup`.

That's it! 🚀

## Future Work or Idea

Sync Across Machines: Integrate with Litestream to sync clipboard history between machines seamlessly.

Clipboard Server: Run clipy as a centralized clipboard server to share and manage history across multiple devices.
Binary file added assets/clipy-demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 0 additions & 10 deletions clipy.zsh

This file was deleted.

Loading

0 comments on commit 15749e2

Please sign in to comment.