aboutsummaryrefslogtreecommitdiff
path: root/lib/keyringer/actions/sclip
blob: de9c3b58c5e5bc552aad015dbfcee955c4f897ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
#
# Decrypt secret header to clipboard, sleep and cleanup.
#

# Load functions
LIB="`dirname $0`/../functions"
source "$LIB" read $* || exit 1

# Clip password
shift
keyringer $KEYRING xclip $*

# Se window switch combo
if [ -z "$XDOTOOL_NEXT_WINDOW" ]; then
  XDOTOOL_NEXT_WINDOW="Alt_L+Tab"
fi

# Move to the next window
if which xdotool &> /dev/null; then
  # Use a smaller delay otherwise the window
  # manager might ignore the key combo
  xdotool key --delay 2 $XDOTOOL_NEXT_WINDOW
fi

# Sleep
sleep 5

# Overwrite clipboard
echo $RANDOM | sha256sum | base64 | xclip