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
- 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)
- dmenu
- dmenu or rofi
## Usage

View file

@ -30,18 +30,18 @@ func dmenu(list []string, max int, tool string) (string, error) {
return "", nil
}
var args []string;
if tool == "dmenu" {
args = []string{"dmenu", "-b",
"-fn",
"-misc-dejavu sans mono-medium-r-normal--17-120-100-100-m-0-iso8859-16",
"-l",
strconv.Itoa(max)}
} else {
args = []string{"rofi", "-dmenu",
"-lines",
strconv.Itoa(max)}
}
var args []string
if tool == "dmenu" {
args = []string{"dmenu", "-b",
"-fn",
"-misc-dejavu sans mono-medium-r-normal--17-120-100-100-m-0-iso8859-16",
"-l",
strconv.Itoa(max)}
} else {
args = []string{"rofi", "-dmenu",
"-lines",
strconv.Itoa(max)}
}
// 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
@ -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}
selected, err := cmd.Output()
if err != nil {
fmt.Printf("%s", err)
return "", err
}
trimmed := selected[:len(selected)-1] // drop newline