summarylogtreecommitdiffstats
path: root/kps.sh
blob: 3d24cf55b0b4c1d54e511f53f3c866cc641cdcf4 (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
#!/bin/sh

# Configuration file for kps
export CONFIG_PATH

# Check for the config file's availability
if [ ! -z "$1" ]
then
  # The config path was given via an argument
  CONFIG_PATH="$1"
elif [ -e /opt/KeysPerSecond/config.kpsconf3 ]
then
  # The config file exists in the installation dir
  CONFIG_PATH="/opt/KeysPerSecond/config.kpsconf3"
fi

# The path passed as an argument is given priority
# over the config file in the installation dir, 
# meaning that even if the config file does exist
# in /opt/KeysPerSecond, if a different path is
# given as an argument, that path is the one
# that will be used

# Run Keys Per Second
if [ -z "$CONFIG_PATH" ]
then
  # No configuration path
  java -jar /opt/KeysPerSecond/KeysPerSecond.jar
  [ $? -ne 0 ] && notify-send "Keys Per Second" "Something went wrong..."
else
  # Available configuration path
  java -jar /opt/KeysPerSecond/KeysPerSecond.jar "$CONFIG_PATH"
  [ $? -ne 0 ] && notify-send "Keys Per Second" "Something went wrong..."
fi