1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #!/bin/sh
- # Ref: https://feeding.cloud.geek.nz/posts/hooking-into-docking-undocking-events-to-run-scripts/
- function usage {
- echo "tdock <install|dock|undock>"
- exit 0
- }
- function install {
- echo "[+] installing tdock..."
- echo "[*] Info: this tool requires sudo access at some point"
- if [ -d "/opt/tdock" ]; then
- echo "[-] tdock is already installed (remove /opt/tdock)"
- exit 1
- fi
- # Bash allows not whitespaces infront :/
- cat <<- EOF > /tmp/dock.txt
- event=ibm/hotkey LEN0068:00 00000080 00006030
- action=su $(whoami) -c "/opt/tdock/tdock.sh dock"
- EOF
- # Bash allows not whitespaces infront :/
- cat <<- EOF > /tmp/undock.txt
- event=ibm/hotkey LEN0068:00 00000080 00004011
- action=su $(whoami) -c "/opt/tdock/tdock.sh undock"
- EOF
- }
- # having the wrong number of arguments
- if [ "$#" -ne 1 ]; then
- usage
- fi
- if [ "$1" = "install" ]; then
- install
- elif [ "$1" = "dock" ]; then
- dock
- elif [ "$1" = "undock" ]; then
- undock
- fi
|