Giter VIP home page Giter VIP logo

thinkpad-dock's Introduction

thinkpad-dock

Small utility to handle docking and undocking of ThinkPad laptops running Linux. Tested with an x200s running Arch and an original Lenovo docking station hooked to a VGA FullHD monitor.

Getting Started

These instructions will get you a copy of the project up and running on your local machine. It is heavily reliant on my personal setup so you might need to adapt paths and names for your environment.

Prerequisites

What things you need to install the software and how to install them:

  • ThinkPad laptop
  • Docking station
  • Monitor
  • Linux distro
  • xrandr installed
  • udev installed

Installing

Run the included scrit to install the utility

./install.sh

It will install two components with sudo, for which you will be asked for your password:

  • udev rule to /etc/udev/rules.d/

  • Global script to /usr/local/sbin

And two components for your user, under ~/.config/dock/ and ~/local/bin/. It assumes that ~/local/bin is in your path. If not, adapt the install script according to your setup.

Inner workings

The utility is composed of 4 parts: udev rules, a global script, trigger scripts and user scripts

udev rules

The udev rules simply call the global script every time the dock kernel component changes

Global script

The global /usr/local/sbin/thinkpad-dock.sh script checks the docks status and calls the trigger scripts for any logged-in user.

Trigger scripts

The trigger scripts live under ~/.config/dock/[on|off]. They perform some basic checks to make sure the docking process is finished before calling the user scripts

User scripts

The user scripts should be called dock and undock and be callable from the shell. This allows call them manually, for instance after boot while docked does not call the udev rule.

The default behavior of the scripts is to turn the VGA output on/off and ajust the conky configuration file according to the docking status.

License

This project is licensed under GPL - see the LICENSE file for details If you think it should be under some other license, let me know, I don't have strong feelings about any of it, GPL just seems like a safe default.

Acknowledgments

  • Based on code and information found online, too long ago to remember.
  • Stackoverflow

thinkpad-dock's People

Contributors

bartpolot avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.