Skip to content

Commit e8bb9d6

Browse files
committed
honour CLIPBOARD_STATE if we ever receive it
1 parent e20aa7a commit e8bb9d6

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

cliphist.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ func main_() int {
5252
var err error
5353
switch flags.Arg(0) {
5454
case "store":
55+
// from man wl-clipboard
56+
switch os.Getenv("CLIPBOARD_STATE") {
57+
case "sensitive":
58+
return 0
59+
}
60+
5561
err = store(os.Stdin, *maxDedupeSearch, *maxItems)
5662
case "list":
5763
err = list(os.Stdout)

testdata/clipboard-state-env.txtar

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
env CLIPBOARD_STATE=data
2+
exec rand 8
3+
stdin stdout
4+
exec cliphist store
5+
6+
# check 1 item with CLIPBOARD_STATE=data
7+
exec cliphist list
8+
stdout -count=1 '^.'
9+
10+
cliphist wipe
11+
12+
env CLIPBOARD_STATE=sensitive
13+
exec rand 8
14+
stdin stdout
15+
exec cliphist store
16+
17+
# check 0 items with CLIPBOARD_STATE=sensitive
18+
exec cliphist list
19+
! stdout .

0 commit comments

Comments
 (0)