Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package clipman for openSUSE:Factory checked in at 2022-03-22 19:40:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/clipman (Old) and /work/SRC/openSUSE:Factory/.clipman.new.25692 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "clipman" Tue Mar 22 19:40:55 2022 rev:2 rq:963961 version:1.6.1 Changes: -------- --- /work/SRC/openSUSE:Factory/clipman/clipman.changes 2021-01-31 16:52:29.768744631 +0100 +++ /work/SRC/openSUSE:Factory/.clipman.new.25692/clipman.changes 2022-03-22 19:41:00.155140412 +0100 @@ -1,0 +2,14 @@ +Tue Mar 22 11:43:28 UTC 2022 - Matej Cepl <mc...@suse.com> + +- Update to 1.6.1: + - properly deal with Windows-style newlines + - improve man pages + - --unix option to normalize all line endings to LF + - --primary option to serve the selection to primary instead + than clipboard + - show-history command to obtain a json representation of the + clipboard's history + - when using the bemenu tool we don't forcefully set it to + bottom position anymore + +------------------------------------------------------------------- Old: ---- v1.5.2.tar.gz New: ---- v1.6.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ clipman.spec ++++++ --- /var/tmp/diff_new_pack.HYmQtA/_old 2022-03-22 19:41:01.003141302 +0100 +++ /var/tmp/diff_new_pack.HYmQtA/_new 2022-03-22 19:41:01.011141310 +0100 @@ -1,7 +1,7 @@ # # spec file for package clipman # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -15,11 +15,12 @@ # Please submit bugfixes or comments via https://bugs.opensuse.org/ # + Name: clipman -Version: 1.5.2 +Version: 1.6.1 Release: 0 Summary: A clipboard manager for Wayland -License: GPL-3.0 +License: GPL-3.0-only URL: https://github.com/yory8/clipman # Source0: https://github.com/yory8/%%{name}/archive/%%{version}.tar.gz#/%%{name}-%%{version}.tar.gz Source0: https://github.com/yory8/%{name}/archive/v%{version}.tar.gz ++++++ v1.5.2.tar.gz -> v1.6.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clipman-1.5.2/CHANGELOG.md new/clipman-1.6.1/CHANGELOG.md --- old/clipman-1.5.2/CHANGELOG.md 2020-05-12 16:01:01.000000000 +0200 +++ new/clipman-1.6.1/CHANGELOG.md 2021-12-01 10:28:35.000000000 +0100 @@ -1,3 +1,25 @@ +# 1.6.1 + +**Notable bug fixes** + +- properly deal with Windows-style newlines + +**Other changes** + +- improve man pages + +# 1.6.0 + +**New features** + +- `--unix` option to normalize all line endings to LF +- `--primary` option to serve the selection to `primary` instead than `clipboard` +- `show-history` command to obtain a json representation of the clipboard's history + +**Other changes** + +- when using the `bemenu` tool we don't forcefully set it to bottom position anymore + # 1.5.2 **Notable bug fixes** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clipman-1.5.2/README.md new/clipman-1.6.1/README.md --- old/clipman-1.5.2/README.md 2020-05-12 16:01:01.000000000 +0200 +++ new/clipman-1.6.1/README.md 2021-12-01 10:28:35.000000000 +0100 @@ -17,17 +17,15 @@ ### Distros -These distros ship with clipman binaries in their repos: - -[](https://repology.org/project/clipman/versions) +A few distros ship with clipman binaries in their official or unofficial repos. ## Usage 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 -P --histpath="~/.local/share/clipman-primary.json"` (note that both the `-p` in wl-paste and the `-P` in clipman are mandatory in this case). 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 -t wofi --histpath="~/.local/share/clipman-primary.json`. You can pass additional arguments to the selector like this: `clipman pick --tool wofi -T'--prompt=my-prompt -i'` (both `--prompt` and `-i` are flags of wofi). You can use a custom selector like this: `clipman pick --print0 --tool=CUSTOM --tool-args="fzf --prompt 'pick > ' --bind 'tab:up' --cycle --read0"`. @@ -39,14 +37,20 @@ ## Known Issues -### Loss of rich text +We only support 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: + +- vim's visual block mode breaks +- copying images in Firefox breaks +- if you copy a bookmark in Firefox, you won't be able to paste it in another bookmark folder +- 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. -- 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. +Run `clipman store` with the `--no-persist` option if you are affected. Unfortunately, it seems that there is no way to make them play well together. -## Versions +## Status -This projects follows SemVer conventions. +Supporting images or fixing the known issues would require a complete rewrite using wlroots directly. +Clipman is considered feature complete and is now in maintanance mode. ## License diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clipman-1.5.2/docs/clipman.1 new/clipman-1.6.1/docs/clipman.1 --- old/clipman-1.5.2/docs/clipman.1 2020-05-12 16:01:01.000000000 +0200 +++ new/clipman-1.6.1/docs/clipman.1 2021-12-01 10:28:35.000000000 +0100 @@ -1,4 +1,4 @@ -.TH clipman 1 1.5.2 "" +.TH clipman 1 1.6.1 "" .SH "NAME" clipman .SH "SYNOPSIS" @@ -15,6 +15,9 @@ \fB--histpath="~/.local/share/clipman.json"\fR Path of history file .TP +\fB--primary\fR +Serve item to the primary clipboard. Default: --no-primary +.TP \fB--notify\fR Send desktop notifications on errors .TP @@ -35,6 +38,9 @@ .TP \fB-P, --no-persist\fR Don't persist a copy buffer after a program exits +.TP +\fB--unix\fR +Normalize line endings to LF .SS \fBpick --tool=TOOL [<flags>]\fR .PP @@ -74,12 +80,15 @@ \fBrestore\fR .PP Serve the last recorded item from history +\fBshow-history\fR +.PP +Show all items from history .SH "USAGE" 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`. +.PP +For primary clipboard support, also add `exec wl-paste -p -t text --watch clipman store -P --histpath="~/.local/share/clipman-primary.json` (note that both the `-p` in wl-paste and the `-P` in clipman are mandatory in this case). .PP 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 -t wofi --histpath="~/.local/share/clipman-primary.json`. You can pass additional arguments to the selector like this: `clipman pick --tool wofi -T'--prompt=my-prompt -i'` (both `--prompt` and `-i` are flags of wofi). You can use a custom selector like this: `clipman pick --print0 --tool=CUSTOM --tool-args="fzf --prompt 'pick > ' --bind 'tab:up' --cycle --read0"`. .PP @@ -87,6 +96,11 @@ .PP To serve the last history item at startup, add `exec clipman restore` to your Sway config. .SH "KNOWN ISSUES" -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. +We only support 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: vim's visual block mode breaks; copying images in Firefox breaks; if you copy a bookmark in Firefox, you won't be able to paste it in another bookmark folder; if you copy formatted text inside Libre Office you'll lose all formatting on paste. +.PP +Run `clipman store` with the `--no-persist` option if you are affected. Unfortunately, it seems that there is no way to make them play well together. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clipman-1.5.2/main.go new/clipman-1.6.1/main.go --- old/clipman-1.5.2/main.go 2020-05-12 16:01:01.000000000 +0200 +++ new/clipman-1.6.1/main.go 2021-12-01 10:28:35.000000000 +0100 @@ -16,16 +16,18 @@ "gopkg.in/alecthomas/kingpin.v2" ) -const version = "1.5.2" +const version = "1.6.1" var ( app = kingpin.New("clipman", "A clipboard manager for Wayland") histpath = app.Flag("histpath", "Path of history file").Default("~/.local/share/clipman.json").String() alert = app.Flag("notify", "Send desktop notifications on errors").Bool() + primary = app.Flag("primary", "Serve item to the primary clipboard").Default("false").Bool() storer = app.Command("store", "Record clipboard events (run as argument to `wl-paste --watch`)") maxDemon = storer.Flag("max-items", "history size").Default("15").Int() noPersist = storer.Flag("no-persist", "Don't persist a copy buffer after a program exits").Short('P').Default("false").Bool() + unix = storer.Flag("unix", "Normalize line endings to LF").Bool() picker = app.Command("pick", "Pick an item from clipboard history") maxPicker = picker.Flag("max-items", "scrollview length").Default("15").Int() @@ -40,6 +42,8 @@ clearAll = clearer.Flag("all", "Remove all items").Short('a').Default("false").Bool() clearEsc = clearer.Flag("print0", "Separate items using NULL; recommended if your tool supports --read0 or similar").Default("false").Bool() + showHistory = app.Command("show-history", "Show all items from history") + _ = app.Command("restore", "Serve the last recorded item from history") ) @@ -89,6 +93,14 @@ } serveTxt(history[len(history)-1]) + case "show-history": + if len(history) != 0 { + urlsJson, _ := json.Marshal(history) + fmt.Println(string(urlsJson)) + return + } + fmt.Println("Nothing to show") + return case "clear": // remove all history if *clearAll { @@ -186,9 +198,16 @@ } // we mandate the mime type because we know we can only serve text; not doing this leads to weird bugs like #35 - cmd := exec.Cmd{Path: bin, Args: []string{bin, "-t", "TEXT"}, Stdin: strings.NewReader(s), SysProcAttr: attr} - if err := cmd.Run(); err != nil { - smartLog(fmt.Sprintf("error running wl-copy: %s\n", err), "low", *alert) + if *primary { + cmd := exec.Cmd{Path: bin, Args: []string{bin, "-p", "-t", "TEXT"}, Stdin: strings.NewReader(s), SysProcAttr: attr} + if err := cmd.Run(); err != nil { + smartLog(fmt.Sprintf("error running wl-copy -p: %s\n", err), "low", *alert) + } + } else { + cmd := exec.Cmd{Path: bin, Args: []string{bin, "-t", "TEXT"}, Stdin: strings.NewReader(s), SysProcAttr: attr} + if err := cmd.Run(); err != nil { + smartLog(fmt.Sprintf("error running wl-copy: %s\n", err), "low", *alert) + } } } @@ -200,14 +219,43 @@ if i := bytes.IndexByte(data, '\n'); i >= 0 { // We have a full newline-terminated line. - return i + 1, data[0 : i+1], nil + b := data[0 : i+1] + if *unix { + b = dropCR(b) + } + return i + 1, b, nil } // If we're at EOF, we have a final, non-terminated line. Return it. if atEOF { - return len(data), data, nil + b := data + if *unix { + b = dropCR(b) + } + return len(data), b, nil } // Request more data. return 0, nil, nil } + +// dropCR drops a terminal \r from the data. Modified from Go's Stdlib +func dropCR(data []byte) []byte { + orig := data + + var lf bool + if len(data) > 0 && data[len(data)-1] == '\n' { + lf = true + data = data[0 : len(data)-1] + } + + if len(data) > 0 && data[len(data)-1] == '\r' { + b := data[0 : len(data)-1] + if lf { + b = append(b, '\n') + } + return b + } + + return orig +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clipman-1.5.2/selector.go new/clipman-1.6.1/selector.go --- old/clipman-1.5.2/selector.go 2020-05-12 16:01:01.000000000 +0200 +++ new/clipman-1.6.1/selector.go 2021-12-01 10:28:35.000000000 +0100 @@ -40,7 +40,7 @@ "-l", strconv.Itoa(max)} case "bemenu": - args = []string{"bemenu", "--bottom", "--prompt", prompt, "--list", strconv.Itoa(max)} + args = []string{"bemenu", "--prompt", prompt, "--list", strconv.Itoa(max)} case "rofi": args = []string{"rofi", "-p", prompt, "-dmenu", "-lines", @@ -111,7 +111,7 @@ // preprocessData: // - reverses the data -// - optionally escapes \n and \t (it would break some external selectors) +// - optionally escapes \n, \r and \t (it would break some external selectors) // - optionally it cuts items longer than maxChars bytes (dmenu doesn't allow more than ~1200) // A guide is created to allow restoring the selected item. func preprocessData(data []string, maxChars int, escape bool) ([]string, map[string]string) { @@ -128,6 +128,8 @@ repr = strings.ReplaceAll(repr, "\n", "\\n") repr = strings.ReplaceAll(repr, "\\t", "\\\\t") repr = strings.ReplaceAll(repr, "\t", "\\t") + repr = strings.ReplaceAll(repr, "\\r", "\\\\r") + repr = strings.ReplaceAll(repr, "\r", "\\r") } // optionally cut to maxChars if maxChars > 0 && len(repr) > maxChars { ++++++ vendor.tar.xz ++++++