summarylogtreecommitdiffstats
path: root/mouselock.sh
blob: 4923ab80ceac859e6e57d0d79d2e2cb8d2754707 (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
#!/bin/bash

# Explain usage and exit
Help() {
    echo "This script does not accept any arguments."
    echo "You can set the XPOINTER_ARGS variable with"
    echo "any arguments you want to pass to xpointerbarrier."
}

# Run xpointerbarrier in the background
Start() {
    xpointerbarrier $XPOINTER_ARGS &
}

# Kill xpointerbarrier
Kill() {
    pkill xpointerbarrier
}

# If there are any arguments, show Help and exit
if [ $# -ne 0 ]; then
    Help
    exit 1
fi

# Start xpointerbarrier if it isn't running, otherwise, kill it
pidof xpointerbarrier >/dev/null
if [[ $? -ne 0 ]]; then
    Start
else
    Kill
fi