summaryrefslogtreecommitdiff
path: root/touchpad.sh
blob: 2a41ea485d9a363c675189aae2392e74e1c69809 (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
#!/bin/sh

export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-$HOME/.local/share}"
export STATUS_FILE="$XDG_RUNTIME_DIR/touchpad.status"

enable_touchpad() {
    printf "true" >"$STATUS_FILE"
    notify-send -u normal "Enabling touchpad"
    hyprctl keyword "\$LAPTOP_TP_ENABLED" "true" -r
}

disable_touchpad() {
    printf "false" >"$STATUS_FILE"
    notify-send -u normal "Disabling touchpad"
    hyprctl keyword "\$LAPTOP_TP_ENABLED" "false" -r
}

if ! [ -f "$STATUS_FILE" ]; then
  enable_touchpad
else
  if [ "$(cat "$STATUS_FILE")" = "true" ]; then
    disable_touchpad
  elif [ "$(cat "$STATUS_FILE")" = "false" ]; then
    enable_touchpad
  fi
fi