Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignore events based on ignoreEvents pref #49

Closed
wants to merge 2 commits into from
Closed

ignore events based on ignoreEvents pref #49

wants to merge 2 commits into from

Conversation

thewisenerd
Copy link
Contributor

set this to true before invoking pass, unset at least 2*timerFrequency post copying password, assuming changeCount is updated by then.

set this to true before invoking pass, unset
at least 2*timerFrequency post copying password,
assuming changeCount is updated by then.
@p0deje
Copy link
Owner

p0deje commented Sep 29, 2019

What's the use case of this? I don't quite follow.

@p0deje p0deje added enhancement New feature or request needs triaging Further information is requested labels Sep 29, 2019
@thewisenerd
Copy link
Contributor Author

so, right now, the password copy handling is done as such

if let var = pasteboard.items.last {
  copyHooks()
} else {
  removeHooks()
}

the else'y bits would be triggered when the password manager would do a pasteboard.clearContents()

however, this need not be the case, if the password manager can preemptively tell the clipboard manager that they should start ignoring events, and the password manager co-operates.

since the clipboard data picking happens on changeCount and ?.last, changeCount will take care of the ignore bits, and the clipboard manager would never read the events which were triggered when the flag was set.

This fits into my workflow of using passwordstore.org, where there is a platform defined clip() function;

it overall looks something like this (for the sake of brevity):

clip() {
  before = $(pbpaste)
  defaults write "org.p0deje.Maccy" ignoreEvents true
  ( sleep 5; defaults write "org.p0deje.Maccy" ignoreEvents false ) &
  ( sleep $CLIP_TIME; echo -n "$before" | pbcopy ) &
  echo -n "$1" | pbcopy
}

@thewisenerd
Copy link
Contributor Author

the 2*timerFrequency to await until ignoreEvents is unset is so that changeCount is actually reflected

@p0deje
Copy link
Owner

p0deje commented Sep 30, 2019

Thank you, merged in 4fe79d8

@p0deje p0deje closed this Sep 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs triaging Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants