Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ To use with [sway](https://github.com/swaywm/sway) add the following to your con

There's also a [fzf](https://github.com/junegunn/fzf) wrapper for selecting the contents with a [TUI](https://github.com/janza/wl-clipboard-history/blob/master/contrib/fzf-wrapper).

It's also possible to ignore tracking the clipboard for a specific window class.

For example, to ignore tracking the clipboard for KeePassXC
add the following line to `~/.config/wl-clipboard-history/ignore`:

org.keepassxc.KeePassXC

### TODO

- [ ] Add support to delete entries from the history (eg. secrets)
9 changes: 8 additions & 1 deletion wl-clipboard-history
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env sh
#!/usr/bin/env bash
set -euo pipefail

clipboard_file="$HOME/.clipboard.sqlite"
clipboard_ignore_file="$HOME/.config/wl-clipboard-history/ignore"

query () {
echo "$1" | sqlite3 -separator "," "$clipboard_file"
Expand Down Expand Up @@ -31,6 +32,12 @@ helpusage () {
}

if [ $# = 0 ]; then
case $XDG_CURRENT_DESKTOP in
Hyprland)
[ ! $(hyprctl -j activewindow | jq -r '.class' | xargs -I _ grep --count '_' $clipboard_ignore_file) = 0 ] && exit 0
;;
# TODO: Add cases for other wayland compositors
esac
contents="$(< /dev/stdin sed "s/'/''/g")"
if [ "$contents" = "" ]; then
helpusage
Expand Down