Skip to main content

ThinkPad mute-mic light daemon

Project description

tpmmld

tpmmld is the ThinkPad Mute-Mic Light Daemon. If you have a certain ThinkPad where you have a mute-mic indicator led on the F4 button, this daemon will control it, based on the current PulseAudio mute state of all input sources (So all input sources mute, all input sources unmute).

You can directly mute, unmute or toggle the mute states of all sources by using the -m, -u or -t arguments. This mode is essentially a one-shot where the process exits after doing the requested state change.

When no options are specified (run as daemon in foreground) or when passing -d to run in background (daemonized), tpmmld will monitor the ThinkPad Extra Buttons input device to keypresses (specifically, key event 248, the micmute button).

Prerequisites

  1. To read input from the micmute key, you need to be a member of the input group, or specifically, whichever group owns the device files under the /dev/input directory.

  2. To enable/disable the led, the sudo and tee commands are used. You have to configure sudo in such a way that you can run echo 1 | sudo tee /sys/class/leds/platform\:\:micmute/brightness non-interactively (i.e., without a password prompt).

Install

tpmmld is published in pypi, so you can simply install using pip:

pip install tpmmld

However, If it's not available there for whatever reason, or if you would like to run it from source, you can also get it going yourself, directly from the git repository:

git clone https://github.com/rubin55/tpmmld
cd tpmmld
python -m venv .venv
pip instal -r requirements.txt
bin/tpmmld.sh -s # shows available input source devices, with index number
bin/tpmmld.sh -t # toggle mute state on/off
bin/tpmmld.sh -m # explicitly mute all sources
bin/tpmmld.sh -u # explicitly unmute all sources
bin/tpmmld.sh    # run tpmmld in foreground
bin/tpmmld.sh -d # run tpmmld in background

Usage

$ tpmmld -h
usage: tpmmld [-h] [-d] [-s] [-t] [-m] [-u] [-l {INFO,ERROR,WARNING,DEBUG}]
              [-v]

options:
  -h, --help            show this help message and exit
  -d, --daemonize       run in background (daemonized mode). If not specified,
                        the process will run in the foreground output to stdin
  -s, --sources         show list of sources, with index numbers
  -t, --toggle          toggle mute/unmute of all sources directly and exit
  -m, --mute            mute all sources directly and exit
  -u, --unmute          unmute all sources directly and exit
  -l {INFO,ERROR,WARNING,DEBUG}, --loglevel {INFO,ERROR,WARNING,DEBUG}
                        specify the loglevel to use, defaults to 'INFO'
  -v, --version         show program's version number and exit

Build

Since this is a python package, you don't really need to build, but if you would like to build the pip packages, you can do that as follows:

python -m build

You will then find the pip package binaries in dist/. You can install them using pip.

Deploy

I use twine to publish tpmmld on pypi. To deploy, make sure you first run the build stage. After that you can deploy the artifacts in the dist directory as follows:

twine upload dist/*

Note that you need valid for this project pypi credentials to do so .

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tpmmld-2.1.1.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

tpmmld-2.1.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file tpmmld-2.1.1.tar.gz.

File metadata

  • Download URL: tpmmld-2.1.1.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for tpmmld-2.1.1.tar.gz
Algorithm Hash digest
SHA256 0387633a717304eb6973527942709dcfcf04a72e1f194e28d80c21c15209d02b
MD5 f9f37b8ac13b178362aadfaf4cf279eb
BLAKE2b-256 7ad234df0c78094dffbd23b7a5b7535fd640337e82eba8dbec400d919f93868d

See more details on using hashes here.

File details

Details for the file tpmmld-2.1.1-py3-none-any.whl.

File metadata

  • Download URL: tpmmld-2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for tpmmld-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 faf302f665e7d8e01c4fb85acdf919dc94444d47717657d3f4dedce866ddb176
MD5 8856ebb66de1137ad7a4bf215598b620
BLAKE2b-256 14a2516ddc8f13402ae7e805414d2c5a4b0f2f55c74c4345d8920139801997cc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page