forked from gopasspw/gopass
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds DBus interaction, i.e. unclip notifications and klipper history clearing. Fix broken clearClipboard method. Fixes gopasspw#432 Fixes gopasspw#433
- Loading branch information
1 parent
1143168
commit 5b86f24
Showing
41 changed files
with
5,716 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// +build linux | ||
|
||
package action | ||
|
||
import ( | ||
"context" | ||
"strings" | ||
|
||
"github.com/godbus/dbus" | ||
) | ||
|
||
func (s *Action) clearClipboardHistory(ctx context.Context) error { | ||
conn, err := dbus.SessionBus() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
obj := conn.Object("org.kde.klipper", "/klipper") | ||
call := obj.Call("org.kde.klipper.klipper.clearClipboardHistory", 0) | ||
if call.Err != nil { | ||
if strings.HasPrefix(call.Err.Error(), "The name org.kde.klipper was not provided") { | ||
return nil | ||
} | ||
return call.Err | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (s *Action) unclipNotify(ctx context.Context, msg string) error { | ||
conn, err := dbus.SessionBus() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
obj := conn.Object("org.freedesktop.Notifications", "/org/freedesktop/Notifications") | ||
call := obj.Call("org.freedesktop.Notifications.Notify", 0, "gopass", uint32(0), "", "gopass - clipboard", msg, []string{}, map[string]dbus.Variant{}, int32(5000)) | ||
if call.Err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// +build !linux | ||
|
||
package action | ||
|
||
import "context" | ||
|
||
func (s *Action) clearClipboardHistory(ctx context.Context) error { | ||
return nil | ||
} | ||
|
||
func (s *Action) unclipNotify(ctx context.Context, msg string) error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.