Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
keyringer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
rhatto
keyringer
Commits
9b26f57a
Commit
9b26f57a
authored
11 years ago
by
rhatto
Browse files
Options
Downloads
Patches
Plain Diff
Adding xclip action thanks to password-store
parent
28423310
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ChangeLog
+3
-1
3 additions, 1 deletion
ChangeLog
lib/keyringer/actions/clip
+1
-0
1 addition, 0 deletions
lib/keyringer/actions/clip
lib/keyringer/actions/xclip
+53
-0
53 additions, 0 deletions
lib/keyringer/actions/xclip
with
57 additions
and
1 deletion
ChangeLog
+
3
−
1
View file @
9b26f57a
2014-02-12 - Silvio Rhatto <rhatto@riseup.net>
2014-02-19 - Silvio Rhatto <rhatto@riseup.net>
Added xclip action (#33)
Check key expirations (#37)
...
...
This diff is collapsed.
Click to expand it.
lib/keyringer/actions/clip
0 → 120000
+
1
−
0
View file @
9b26f57a
xclip
\ No newline at end of file
This diff is collapsed.
Click to expand it.
lib/keyringer/actions/xclip
0 → 100755
+
53
−
0
View file @
9b26f57a
#!/bin/bash
#
# Decrypt secret header to clipboard.
#
# Copy contents to clipboard.
# Function thanks to Password Store by Jason A. Donenfeld <Jason@zx2c4.com>
# distributed under GPLv2+: http://www.zx2c4.com/projects/password-store/
clip
()
{
# 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
45
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 -- if qdbus isn't there or if klipper isn't running,
# this essentially becomes a no-op.
#
# 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
echo
"
$before
"
|
base64
-d
| xclip
-selection
clipboard
)
&
disown
echo
"Copied
$2
to clipboard. Will clear in 45 seconds."
}
# Load functions
LIB
=
"
`
dirname
$0
`
/../functions"
source
"
$LIB
"
||
exit
1
# Get file
keyringer_get_file
"
$2
"
# Decrypt
pass
=
"
$(
$GPG
--use-agent
-d
"
$KEYDIR
/
$FILE
"
|
head
-n
1
)
"
# Copy to clipboard
if
[
!
-z
"
$pass
"
]
;
then
clip
"
$pass
"
"
$2
"
fi
# Exit
exit
"
$?
"
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