docs + style

This commit is contained in:
yory8 2019-05-09 08:42:43 +02:00
parent 841b03b4aa
commit 0a00dede30
2 changed files with 14 additions and 15 deletions

View file

@ -4,9 +4,9 @@ A basic clipboard manager for Wayland, with support for persisting copy buffers
## Requirements ## Requirements
- a windows manager that uses `wlr-data-control`, like Sway and other wlroots-bases WMs. - a windows manager that uses `wlr-data-control`, like Sway and other wlroots-based WMs.
- wl-clipboard from latest master (NOT v1.0) - wl-clipboard from latest master (NOT v1.0)
- dmenu - dmenu or rofi
## Usage ## Usage

View file

@ -30,18 +30,18 @@ func dmenu(list []string, max int, tool string) (string, error) {
return "", nil return "", nil
} }
var args []string; var args []string
if tool == "dmenu" { if tool == "dmenu" {
args = []string{"dmenu", "-b", args = []string{"dmenu", "-b",
"-fn", "-fn",
"-misc-dejavu sans mono-medium-r-normal--17-120-100-100-m-0-iso8859-16", "-misc-dejavu sans mono-medium-r-normal--17-120-100-100-m-0-iso8859-16",
"-l", "-l",
strconv.Itoa(max)} strconv.Itoa(max)}
} else { } else {
args = []string{"rofi", "-dmenu", args = []string{"rofi", "-dmenu",
"-lines", "-lines",
strconv.Itoa(max)} strconv.Itoa(max)}
} }
// dmenu will break if items contain newlines, so we must pass them as literals. // dmenu will break if items contain newlines, so we must pass them as literals.
// however, when it sends them back, we need a way to restore them to non literals // however, when it sends them back, we need a way to restore them to non literals
@ -65,7 +65,6 @@ func dmenu(list []string, max int, tool string) (string, error) {
cmd := exec.Cmd{Path: "/usr/bin/" + tool, Args: args, Stdin: input} cmd := exec.Cmd{Path: "/usr/bin/" + tool, Args: args, Stdin: input}
selected, err := cmd.Output() selected, err := cmd.Output()
if err != nil { if err != nil {
fmt.Printf("%s", err)
return "", err return "", err
} }
trimmed := selected[:len(selected)-1] // drop newline trimmed := selected[:len(selected)-1] // drop newline