forked from matschaffer/profile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stoken.conf
52 lines (41 loc) · 1.08 KB
/
stoken.conf
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
## stoken doesn't natively support multiple tokens, these functions allow you to have multiple
toke () {
## Grab the current token code
echo -n $(stoken) | pbcopy
echo $(tokes | grep "*" | sed -e's/ \*//') "token in buffer!"
}
tokes () {
## List available tokens, putting a `*` next to the active one
for i in $(ls ~/.stoken.d | sort); do
if ls -l ~/.stokenrc | grep "\/${i}" >/dev/null; then
echo ${i} " *"
else
echo ${i}
fi
done
}
light_up () {
## Activate a specific token from the available tokens.
new_token_file=$1
if [ -f ~/.stoken.d/${new_token_file} ]; then
rm ~/.stokenrc
ln -s ~/.stoken.d/${new_token_file} ~/.stokenrc
echo ${new_token_file} "is lit!"
else
echo "Bruh, there's no token called \"" ${new_token_file} "\""
fi
}
pack_bowl () {
## import a new token and make it active
if [[ $# -eq 2 ]] && [ -e "$1" ]; then
rm ~/.stokenrc
stoken import --file $1 << EOF 2>/dev/null
EOF
stoken setpin << EOF 2>/dev/null
0000
0000
EOF
mv ~/.stokenrc ~/.stoken.d/${2}
ln -s ~/.stoken.d/${2} ~/.stokenrc
fi
}