summaryrefslogtreecommitdiff
path: root/vpn.sh
blob: 0a973e1708409f991ba48af39a30bdd0c2b88d9c (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
ON_COLOR=${ON_COLOR:-"#00FF00"}
OFF_COLOR=${OFF_COLOR:-"#FF0000"}

while getopts O:o:h opt; do
    case "$opt" in
        O) ON_COLOR="$OPTARG" ;;
        o) OFF_COLOR="$OPTARG" ;;
        h) printf \
"Usage: vpn.sh [-O color] [-o color] [-h]
Options:
-O\tColor for connected VPN indicator. Default: $ON_COLOR
-o\tColor for disconnected VPN indicator. Default: $OFF_COLOR
-h\tShow this help text
" && exit 0;;
    esac
done

##Check VPN status
GET_VPN=$(ip link | grep "tun0\|wg0" | cut -d ' ' -f2)

##Store status in STATUS
if [[ $GET_VPN == *"0"* ]]
then   
    STATUS=''
else
    STATUS=' '
fi

echo " $STATUS"
echo " $STATUS"

##Colors
if [[ "$STATUS" == "" ]]
then
    echo "$ON_COLOR"
else
    echo "$OFF_COLOR"
fi

while getopts F:Sf:adH:M:L:X:T:t:C:c:i:m:s:h opt; do
    case "$opt" in
        S) SUBSCRIBE=1 ;;
        F) LONG_FORMAT="$OPTARG" ;;
        f) SHORT_FORMAT="$OPTARG" ;;
        a) USE_ALSA_NAME=1 ;;
        d) USE_DESCRIPTION=1 ;;
        H) AUDIO_HIGH_SYMBOL="$OPTARG" ;;
        M) AUDIO_MED_SYMBOL="$OPTARG" ;;
        L) AUDIO_LOW_SYMBOL="$OPTARG" ;;
        X) AUDIO_MUTED_SYMBOL="$OPTARG" ;;
        T) AUDIO_MED_THRESH="$OPTARG" ;;
        t) AUDIO_LOW_THRESH="$OPTARG" ;;
        C) DEFAULT_COLOR="$OPTARG" ;;
        c) MUTED_COLOR="$OPTARG" ;;
        i) AUDIO_INTERVAL="$OPTARG" ;;
        m) MIXER="$OPTARG" ;;
        s) SCONTROL="$OPTARG" ;;
        h) printf \
"Usage: volume-pulseaudio [-S] [-F format] [-f format] [-p] [-a|-d] [-H symb] [-M symb]
        [-L symb] [-X symb] [-T thresh] [-t thresh] [-C color] [-c color] [-i inter] 
        [-m mixer] [-s scontrol] [-h]
Options:
-F, -f\tOutput format (-F long format, -f short format) to use, with exposed variables:
\${SYMB}, \${VOL}, \${INDEX}, \${NAME}
-S\tSubscribe to volume events (requires persistent block, always uses long format)
-a\tUse ALSA name if possible
-d\tUse device description instead of name if possible
-H\tSymbol to use when audio level is high. Default: '$AUDIO_HIGH_SYMBOL'
-M\tSymbol to use when audio level is medium. Default: '$AUDIO_MED_SYMBOL'
-L\tSymbol to use when audio level is low. Default: '$AUDIO_LOW_SYMBOL'
-X\tSymbol to use when audio is muted. Default: '$AUDIO_MUTED_SYMBOL'
-T\tThreshold for medium audio level. Default: $AUDIO_MED_THRESH
-t\tThreshold for low audio level. Default: $AUDIO_LOW_THRESH
-C\tColor for non-muted audio. Default: $DEFAULT_COLOR
-c\tColor for muted audio. Default: $MUTED_COLOR
-i\tInterval size of volume increase/decrease. Default: $AUDIO_DELTA
-m\tUse the given mixer.
-s\tUse the given scontrol.
-h\tShow this help text
" && exit 0;;
    esac
done