Sen descrición

Hans Martin 5b70226dc3 mini %!s(int64=5) %!d(string=hai) anos
README.md 5b70226dc3 mini %!s(int64=5) %!d(string=hai) anos
tdock.sh 5b70226dc3 mini %!s(int64=5) %!d(string=hai) anos

README.md

tdock

ThinkPad + Linux + Docking Station = 💔

ThinkPad + Linux + Docking Station + tdock = 🧡

Support ACPI event triggers when un-/docking a lenovo thinkpad

Usage

tdock.sh <install|uninstall|config|isdocked>
  • install & uninstall to install/uninstall the acpi event hooks
  • config to list the configured scripts
  • isdocked returns '1' if the laptop is currently docked, '0' if not

Installation

  • Clone the repo

    git clone https://git.swrzm.de/msc/tdock.sh
    
  • Add the executable to the $PATH variable (for the event actions)

  • Install the hooks & generate sample config

    tdock.sh install
    
  • To uninstall the hooks again:

    tdock.sh uninstall
    

Setup Event Hooks

To setup the scripts that should be executed on the un-/docking events, use the $HOME/.config/tdock/tdock.conf configuration file.

Set it up with the following two lines and replace the paths to the scripts you want to have executed:

docked:/path/to/docked/script.sh
undocked:/path/to/undocked/script.sh
  • The scripts are executed after the thinkpad is docked/undocked (as non-root)
  • Make sure the scripts are executable (chmod +x)

Configure ThinkPad Event Triggers

Important: The un-/docking ACPI events can change from model to mode.

to change the event-code, the two variables can be changed in the tdock.sh script as seen below:

# event-codes
event_ondock="ibm/hotkey LEN0268:00 00000080 00006030"
event_onundock="ibm/hotkey LEN0268:00 00000080 00004010"

To get the correct event-codes, proceed like following:

  • Run acpi_listen
    • This records all acpi-events that happening
  • Undock your laptop and note down the event that is happening
  • Put your laptop in the docking station again and note down this event aswell
  • Change both variables in the script according to the recorded event codes.
  • They should start with: ibm/hotkey LEN0???:00