Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
password-store
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Karl Fogel
password-store
Commits
65cc7726
Commit
65cc7726
authored
12 years ago
by
Jason A. Donenfeld
Browse files
Options
Downloads
Patches
Plain Diff
Deal with klipper and new lines.
parent
b5405f53
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
password-store.sh
+19
-3
19 additions, 3 deletions
password-store.sh
with
19 additions
and
3 deletions
password-store.sh
+
19
−
3
View file @
65cc7726
...
...
@@ -45,9 +45,25 @@ isCommand() {
esac
}
clip
()
{
before
=
"
$(
xclip
-o
-selection
clipboard
)
"
echo
"
$1
"
| xclip
-selection
clipboard
(
sleep
45s
;
echo
"
$before
"
| xclip
-selection
clipboard
)
&
disown
# This base64 business is a disgusting hack to deal with newline inconsistancies
# in shell. There must be a better way to deal with this, but because I'm a dolt,
# we're going with this for now.
before
=
"
$(
xclip
-o
-selection
clipboard |
base64
)
"
echo
-n
"
$1
"
| xclip
-selection
clipboard
(
sleep
5s
now
=
"
$(
xclip
-o
-selection
clipboard |
base64
)
"
if
[[
$now
!=
$(
echo
-n
"
$1
"
|
base64
)
]]
;
then
before
=
"
$now
"
fi
# It might be nice to programatically check to see if klipper exists,
# as well as checking for other common clipboard managers. But for now,
# this works fine. Clipboard managers frequently write their history
# out in plaintext, so we axe it here.
qdbus org.kde.klipper /klipper org.kde.klipper.klipper.clearClipboardHistory
>
/dev/null 2>&1
echo
"
$before
"
|
base64
-d
| xclip
-selection
clipboard
)
&
disown
echo
"Copied
$2
to clipboard. Will clear in 45 seconds."
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment