Update control scripts for Elgato keylights

- in my main office, I have two Elgato keylights placed on my desk
  and the Python scripts in this commit allow me to control the lights
  with Gnome keyboard shortcuts
- add an installation scripts that sets up a Python venv to run
  the above scripts
This commit is contained in:
Alexander Hess 2023-05-04 02:17:32 +02:00
parent dedd6fdd64
commit f3f2417442
Signed by: alexander
GPG key ID: 344EA5AB10D868E0
5 changed files with 32 additions and 16 deletions

View file

@ -2,8 +2,8 @@
import leglight import leglight
LEFT_KEYLIGHT_IP = "192.168.20.72" LEFT_KEYLIGHT_IP = "192.168.190.62"
RIGHT_KEYLIGHT_IP = "192.168.20.73" RIGHT_KEYLIGHT_IP = "192.168.190.63"
left = leglight.LegLight(LEFT_KEYLIGHT_IP, port=9123) left = leglight.LegLight(LEFT_KEYLIGHT_IP, port=9123)
right = leglight.LegLight(RIGHT_KEYLIGHT_IP, port=9123) right = leglight.LegLight(RIGHT_KEYLIGHT_IP, port=9123)

View file

@ -2,8 +2,8 @@
import leglight import leglight
LEFT_KEYLIGHT_IP = "192.168.20.72" LEFT_KEYLIGHT_IP = "192.168.190.62"
RIGHT_KEYLIGHT_IP = "192.168.20.73" RIGHT_KEYLIGHT_IP = "192.168.190.63"
left = leglight.LegLight(LEFT_KEYLIGHT_IP, port=9123) left = leglight.LegLight(LEFT_KEYLIGHT_IP, port=9123)
right = leglight.LegLight(RIGHT_KEYLIGHT_IP, port=9123) right = leglight.LegLight(RIGHT_KEYLIGHT_IP, port=9123)

View file

@ -2,8 +2,8 @@
import leglight import leglight
LEFT_KEYLIGHT_IP = "192.168.20.72" LEFT_KEYLIGHT_IP = "192.168.190.62"
RIGHT_KEYLIGHT_IP = "192.168.20.73" RIGHT_KEYLIGHT_IP = "192.168.190.63"
left = leglight.LegLight(LEFT_KEYLIGHT_IP, port=9123) left = leglight.LegLight(LEFT_KEYLIGHT_IP, port=9123)
right = leglight.LegLight(RIGHT_KEYLIGHT_IP, port=9123) right = leglight.LegLight(RIGHT_KEYLIGHT_IP, port=9123)

View file

@ -55,7 +55,7 @@ toggle-tiled-left=@as []
toggle-tiled-right=@as [] toggle-tiled-right=@as []
[org/gnome/settings-daemon/plugins/media-keys] [org/gnome/settings-daemon/plugins/media-keys]
custom-keybindings=['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom4/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom5/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom6/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom7/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom8/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom9/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom10/'] custom-keybindings=['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom4/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom5/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom6/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom7/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom8/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom9/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom10/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom11/']
email=['<Super>e'] email=['<Super>e']
help=@as [] help=@as []
home=['<Super>f'] home=['<Super>f']
@ -114,21 +114,26 @@ command='alacritty'
name='Terminal (2)' name='Terminal (2)'
[org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom7] [org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom7]
binding='<Shift><Control>l' binding='<Super>l'
command='/home/alexander/.pyenv/versions/utils/bin/python /home/alexander/.config/gnome-settings/elgato/toggle_keylights.py' command='/home/alexander/.local/share/elgato/bin/python /home/alexander/.config/gnome-settings/elgato/toggle_keylights.py'
name='Toggle Keylights in the Office' name='Toggle Keylights in the Office (1)'
[org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom8] [org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom8]
binding='<Shift><Control>Up' binding='<Primary><Shift>Slash'
command='/home/alexander/.pyenv/versions/utils/bin/python /home/alexander/.config/gnome-settings/elgato/inc_brightness.py' command='/home/alexander/.local/share/elgato/bin/python /home/alexander/.config/gnome-settings/elgato/toggle_keylights.py'
name='Increase Brightness of Keylights in the Office' name='Toggle Keylights in the Office (2)'
[org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom9] [org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom9]
binding='<Shift><Control>Down' binding='<Primary><Shift>Period'
command='/home/alexander/.pyenv/versions/utils/bin/python /home/alexander/.config/gnome-settings/elgato/dec_brightness.py' command='/home/alexander/.local/share/elgato/bin/python /home/alexander/.config/gnome-settings/elgato/inc_brightness.py'
name='Decrease Brightness of Keylights in the Office' name='Increase Brightness of Keylights in the Office'
[org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom10] [org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom10]
binding='<Primary><Shift>Comma'
command='/home/alexander/.local/share/elgato/bin/python /home/alexander/.config/gnome-settings/elgato/dec_brightness.py'
name='Decrease Brightness of Keylights in the Office'
[org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom11]
binding='<Super>u' binding='<Super>u'
command='/usr/bin/flatpak run com.spotify.Client' command='/usr/bin/flatpak run com.spotify.Client'
name='Spotify' name='Spotify'

View file

@ -25,6 +25,17 @@ git --git-dir=$XDG_DATA_HOME/dotfiles/ --work-tree=$HOME config --local status.s
[ -d "$XDG_DATA_HOME/gnupg" ] && chmod 700 $XDG_DATA_HOME/gnupg [ -d "$XDG_DATA_HOME/gnupg" ] && chmod 700 $XDG_DATA_HOME/gnupg
if _command_exists python3; then
# Set up a Python venv to host the scripts controlling the Elgato keylights in my office
python3 -m venv $XDG_DATA_HOME/elgato
$XDG_DATA_HOME/elgato/bin/pip list
$XDG_DATA_HOME/elgato/bin/pip install --upgrade pip setuptools
$XDG_DATA_HOME/elgato/bin/pip install leglight
fi
if _command_exists pip; then if _command_exists pip; then
# Ensure `pipx` is installed in the user's local environment # Ensure `pipx` is installed in the user's local environment