stop providing a default tool

This commit is contained in:
yory8 2020-02-19 14:27:47 +01:00
parent b0ee84e87e
commit f2cd6b8ef3
4 changed files with 29 additions and 23 deletions

View file

@ -1,8 +1,8 @@
# Next # 1.3.0
**Breaking changes** **Breaking changes**
- the selector's tool now defaults to wofi, rather than the obsolete dmenu - we don't set a default tool anymore for picking/clearing the history
**New features** **New features**
@ -11,7 +11,7 @@
**Notable Bug fixes** **Notable Bug fixes**
- some input were skipped because not recognized as text - some input was not served because it wasn't recognized as text
# 1.2.0 # 1.2.0

View file

@ -8,7 +8,7 @@ Requirements:
- a windows manager that uses `wlr-data-control`, like Sway and other wlroots-based WMs. - a windows manager that uses `wlr-data-control`, like Sway and other wlroots-based WMs.
- wl-clipboard >= 2.0 - wl-clipboard >= 2.0
- dmenu, bemenu, rofi or wofi - either: wofi, bemenu, dmenu or rofi
[Install go](https://golang.org/doc/install), add `$GOPATH/bin` to your path, then run `go get github.com/yory8/clipman` OR run `go install` inside this folder. [Install go](https://golang.org/doc/install), add `$GOPATH/bin` to your path, then run `go get github.com/yory8/clipman` OR run `go install` inside this folder.
@ -19,10 +19,10 @@ Archlinux users can find a PKGBUILD [here](https://aur.archlinux.org/packages/cl
Run the binary in your Sway session by adding `exec wl-paste -t text --watch clipman store` (or `exec wl-paste -t text --watch clipman store 1>> PATH/TO/LOGFILE 2>&1 &` to log errors) at the beginning of your config. Run the binary in your Sway session by adding `exec wl-paste -t text --watch clipman store` (or `exec wl-paste -t text --watch clipman store 1>> PATH/TO/LOGFILE 2>&1 &` to log errors) at the beginning of your config.
For primary clipboard support, also add `exec wl-paste -p -t text --watch clipman store --histpath="~/.local/share/clipman-primary.json`. For primary clipboard support, also add `exec wl-paste -p -t text --watch clipman store --histpath="~/.local/share/clipman-primary.json`.
To query the history and select items, run the binary as `clipman pick`. You can assign it to a keybinding: `bindsym $mod+h exec clipman pick`. To query the history and select items, run the binary as `clipman pick -t wofi`. You can assign it to a keybinding: `bindsym $mod+h exec clipman pick -t wofi`.
For primary clipboard support, `clipman pick --histpath="~/.local/share/clipman-primary.json`. For primary clipboard support, `clipman pick -t wofi --histpath="~/.local/share/clipman-primary.json`.
To remove items from history, `clipman clear` and `clipman clear --all`. To remove items from history, `clipman clear -t wofi` and `clipman clear --all`.
To serve the last history item at startup, add `exec clipman restore` to your Sway config. To serve the last history item at startup, add `exec clipman restore` to your Sway config.
@ -33,8 +33,7 @@ For more options: `clipman -h`.
### Loss of rich text ### Loss of rich text
- All items stored in history are treated as plain text. - All items stored in history are treated as plain text.
- By default, we continue serving the last copied item even after its owner has exited. This means that, unless you run with the `--no-persist` option, you'll always immediately lose rich content: for example, if you copy formatted text inside Libre Office you'll lose all formatting on paste; or, if you copy a bookmark in Firefox, you won't be able to paste it in another bookmark folder.
- By default, we continue serving the last copied item even after its owner has exited. The trade-off is that we *always immediately* lose rich content: for example, if you copy some bold text in LibreOffice, when you paste it right after it will be unformatted text; or, if you copy a bookmark in Firefox, you won't be able to paste it in another bookmark folder. To disable this behaviour, you must give up persistency-after-exit by passing the `-P` option to `clipman store`. (Items manually picked from history will still be just plain text.)
## Versions ## Versions

View file

@ -1,4 +1,4 @@
.TH clipman 1 1.2.0 "" .TH clipman 1 1.3.0 ""
.SH "NAME" .SH "NAME"
clipman clipman
.SH "SYNOPSIS" .SH "SYNOPSIS"
@ -33,15 +33,15 @@ history size
\fB-P, --no-persist\fR \fB-P, --no-persist\fR
Don't persist a copy buffer after a program exits Don't persist a copy buffer after a program exits
.SS .SS
\fBpick [<flags>]\fR \fBpick --tool=TOOL [<flags>]\fR
.PP .PP
Pick an item from clipboard history Pick an item from clipboard history
.TP .TP
\fB--max-items=15\fR \fB--max-items=15\fR
scrollview length scrollview length
.TP .TP
\fB-t, --tool="wofi"\fR \fB-t, --tool=TOOL\fR
Which selector to use: dmenu/bemenu/rofi/wofi/STDOUT Which selector to use: wofi/bemenu/dmenu/rofi/STDOUT
.TP .TP
\fB-T, --tool-args=""\fR \fB-T, --tool-args=""\fR
Extra arguments to pass to the --tool Extra arguments to pass to the --tool
@ -53,8 +53,8 @@ Remove item/s from history
\fB--max-items=15\fR \fB--max-items=15\fR
scrollview length scrollview length
.TP .TP
\fB-t, --tool="wofi"\fR \fB-t, --tool=TOOL\fR
Which selector to use: dmenu/bemenu/rofi/wofi/STDOUT Which selector to use: wofi/bemenu/dmenu/rofi/STDOUT
.TP .TP
\fB-T, --tool-args=""\fR \fB-T, --tool-args=""\fR
Extra arguments to pass to the --tool Extra arguments to pass to the --tool
@ -69,11 +69,13 @@ Serve the last recorded item from history
Run the binary in your Sway session by adding `exec wl-paste -t text --watch clipman store` (or `exec wl-paste -t text --watch clipman store 1>> PATH/TO/LOGFILE 2>&1 &` to log errors) at the beginning of your config. Run the binary in your Sway session by adding `exec wl-paste -t text --watch clipman store` (or `exec wl-paste -t text --watch clipman store 1>> PATH/TO/LOGFILE 2>&1 &` to log errors) at the beginning of your config.
For primary clipboard support, also add `exec wl-paste -p -t text --watch clipman store --histpath="~/.local/share/clipman-primary.json`. For primary clipboard support, also add `exec wl-paste -p -t text --watch clipman store --histpath="~/.local/share/clipman-primary.json`.
.PP .PP
To query the history and select items, run the binary as `clipman pick`. You can assign it to a keybinding: `bindsym $mod+h exec clipman pick`. To query the history and select items, run the binary as `clipman pick -t wofi`. You can assign it to a keybinding: `bindsym $mod+h exec clipman pick -t wofi`.
For primary clipboard support, `clipman pick --histpath="~/.local/share/clipman-primary.json`. For primary clipboard support, `clipman pick -t wofi --histpath="~/.local/share/clipman-primary.json`.
.PP .PP
To remove items from history, `clipman clear` and `clipman clear --all`. To remove items from history, `clipman clear -t wofi` and `clipman clear --all`.
.PP .PP
To serve the last history item at startup, add `exec clipman restore` to your Sway config. To serve the last history item at startup, add `exec clipman restore` to your Sway config.
.SH "KNOWN ISSUES" .SH "KNOWN ISSUES"
All items stored in history are treated as plain text. This means that, unless you run with the `--no-persist` option, you'll always immediately lose rich content: for example, if you copy formatted text inside Libre Office you'll lose all formatting on paste. All items stored in history are treated as plain text.
.PP
By default, we continue serving the last copied item even after its owner has exited. This means that, unless you run with the `--no-persist` option, you'll always immediately lose rich content: for example, if you copy formatted text inside Libre Office you'll lose all formatting on paste; or, if you copy a bookmark in Firefox, you won't be able to paste it in another bookmark folder.

13
main.go
View file

@ -15,7 +15,7 @@ import (
"gopkg.in/alecthomas/kingpin.v2" "gopkg.in/alecthomas/kingpin.v2"
) )
const version = "1.2.0" const version = "1.3.0"
var ( var (
app = kingpin.New("clipman", "A clipboard manager for Wayland") app = kingpin.New("clipman", "A clipboard manager for Wayland")
@ -27,12 +27,12 @@ var (
picker = app.Command("pick", "Pick an item from clipboard history") picker = app.Command("pick", "Pick an item from clipboard history")
maxPicker = picker.Flag("max-items", "scrollview length").Default("15").Int() maxPicker = picker.Flag("max-items", "scrollview length").Default("15").Int()
pickTool = picker.Flag("tool", "Which selector to use: wofi/bemenu/dmenu/rofi/STDOUT").Short('t').Default("wofi").String() pickTool = picker.Flag("tool", "Which selector to use: wofi/bemenu/dmenu/rofi/STDOUT").Short('t').Required().String()
pickToolArgs = picker.Flag("tool-args", "Extra arguments to pass to the --tool").Short('T').Default("").String() pickToolArgs = picker.Flag("tool-args", "Extra arguments to pass to the --tool").Short('T').Default("").String()
clearer = app.Command("clear", "Remove item(s) from history") clearer = app.Command("clear", "Remove item/s from history")
maxClearer = clearer.Flag("max-items", "scrollview length").Default("15").Int() maxClearer = clearer.Flag("max-items", "scrollview length").Default("15").Int()
clearTool = clearer.Flag("tool", "Which selector to use: wofi/bemenu/dmenu/rofi/STDOUT").Short('t').Default("wofi").String() clearTool = clearer.Flag("tool", "Which selector to use: wofi/bemenu/dmenu/rofi/STDOUT").Short('t').String()
clearToolArgs = clearer.Flag("tool-args", "Extra arguments to pass to the --tool").Short('T').Default("").String() clearToolArgs = clearer.Flag("tool-args", "Extra arguments to pass to the --tool").Short('T').Default("").String()
clearAll = clearer.Flag("all", "Remove all items").Short('a').Default("false").Bool() clearAll = clearer.Flag("all", "Remove all items").Short('a').Default("false").Bool()
@ -93,6 +93,11 @@ func main() {
return return
} }
if *clearTool == "" {
fmt.Println("clipman: error: required flag --tool or --all not provided, try --help")
os.Exit(1)
}
selection, err := selector(history, *maxClearer, *clearTool, "clear", *clearToolArgs) selection, err := selector(history, *maxClearer, *clearTool, "clear", *clearToolArgs)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)