pylight

A minimal Linux driver for the Logitech Spotlight written in python

Pure Nim score 15/100 · last commit 2022-02-28 · 1 stars · tests present · no docs generated

Summary

Latest Version Unknown
License Unknown
CI Status Failing
Stars 1
Forks 0
Open Issues 0
Last Commit 2022-02-28
Downloads 0
Last Indexed 2026-08-10 05:05

Installation

nimble install pylight
choosenim install pylight
git clone https://gitlab.com/yannickulrich/pylight

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
pylight - - - - - - - - -

README

pyLight

pyLight is a minimal driver for the Logitech Spotlight under Gnome. If you want a more complete driver with a graphical interface, try Projecteur.

Features

  • Laser pointer
  • Trapping the pointer in the presentation window
  • Navigation keys
  • Vibration
  • Stop watch

Installing pyLight

Debian

To use pyLight, clone this repository and install

$ sudo apt install unclutter wmctrl xdotool
$ sudo python pylight.py --install
$ sudo cp 99-spotlight.rules /etc/udev/rules.d/  # (recommended)

It is recommended that you copy the udev rules to allow pyLight to vibrate your Spotlight without using sudo.

Note: unclutter adds itself to the Xsession. To undo this,

$ sudo rm /etc/X11/Xsession.d/90unclutter

Fedora

To build pyLight you need numpy and pillow installed. If you haven't already,

$ pip install numpy pillow

To use pyLight, clone this repository and install

$ sudo dnf install xcursorgen xdotool wmctrl xwininfo libev-devel

# Build unclutter
$ git clone https://github.com/Airblader/unclutter-xfixes
$ sudo cp 99-spotlight.rules /etc/udev/rules.d/  # (recommended)
$ make -C unclutter-xfixes/ unclutter
$ mv unclutter-xfixes/unclutter ~/.local/bin

# Build pylight
$ sudo python pylight --install

# Clean up
$ sudo dnf remove xcursorgen libev-devel

Usage

  1. Connect your Spotlight through Bluetooth or USB. Note that vibration alerts are not supported over bluetooth)
  2. start pyLight
$ python pylight.py
  1. Click on the window containing your already fullscreen presentation (probably evince).
  2. You now have a laser pointer.

WARNING: pyLight traps your mouse in the presentation window!

  1. To escape, ALT-TAB back to the terminal and terminate pyLight with ^C.

Vibration alert

The Spotlight receive send vibration alerts from pyLight. You can schedule as many alerts as you want with the -a flag:

$ python pylight.py -a 00:15:00 \
                    -a 00:17:00 \
                    -a 00:19:30

This schedules alerts at minutes 15, 17 and 19 the talk. You can further specify the intensity of the vibration on a scale of 0x00 to 0x80 (default)

$ python pylight.py -a 00:15:00,0x50 \
                    -a 00:17:00,0x50 \
                    -a 00:19:30,0x80

The timer starts as soon as you click on your talk.

Timer

pyLight can present an ASCII art clock in the terminal in which you run it. For this, the terminal needs to be at least 141x22 characters in size.

$ python pylight.py -d

The timer starts as soon as you click on your talk.

Behind the scenes

Slide navigation and cursor movements work without any modifications on any reasonably modern Linux system.

pyLight creates a custom cursor that in the form of a red laser pointer during installation. When running pyLight, this cursor is activated using gsettings. When the pointer is turned off, it is hidden using unclutter.

The cursor is trapped in a pre-calculated area on the screen using xdotool as long as pyLight is running. This is to avoid accidentally losing the cursor on another screen, if a joined display mode is used.

Vibration

Vibration alerts have been adapted from the research for Projecteur.

To vibrate the Spotlight, the following seven bytes need to be send to the raw HID device

0x10
0x01
0x09
0x1a
0x03   # length between 0x00 and 0x0a
0xe8
0x80   # intensity between 0x00 and 0x80

This gets written to /dev/hidraw<n> where n is the device number assigned by the kernel. You can find this by grepping for the USB ID

$ ls -l /sys/class/hidraw/*/device | grep 046D:C53E

To execute a vibration, simply run

$ echo -en '\x10\x01\x09\x1a\x03\xe8\x80' > /dev/hidraw<n>