In some of my scripts I need to know if my Thinkpad is docked or not. So far I'm just checking if any of the peripherals attached to the docking station can be found. For example I use
get-edid to get the list of attached monitors and understand if the laptop is docked.
However I see in the syslog that the kernel can see the docking event but I don't want to parse syslog looking for "docking something".
Do you know some smart way to check from bash if the laptop is docked without relying on the attached peripherals? It would be cool if I could both catch the docking/undocking event when it happens and check the docking status at any time.