Add keyboard shortcuts for Elgato key lights

- create Gnome keyboard shortcuts to manage the Elgato key lights:
  + toggle
  + increase and decrease brightness
- we use Python scripts in ~/.config/gnome-settings/elgato
  based on the "leglight" PIP package
  (Source: https://gitlab.com/obviate.io/pyleglight)
This commit is contained in:
Alexander Hess 2022-08-10 13:06:52 +02:00
parent 9bc310ff9f
commit 337bebbb0c
Signed by: alexander
GPG key ID: 344EA5AB10D868E0
6 changed files with 67 additions and 2 deletions

View file

@ -0,0 +1,5 @@
# Elgato Key Lights
The Python files in this folder are hooked as keyboard shortcuts in Gnome.
They allow to toggle the key lights in my office.
In the long-run, these scripts should be improved a bit.

View file

@ -0,0 +1,12 @@
#!/usr/bin/env python
import leglight
LEFT_KEYLIGHT_IP = "192.168.20.72"
RIGHT_KEYLIGHT_IP = "192.168.20.73"
left = leglight.LegLight(LEFT_KEYLIGHT_IP, port=9123)
right = leglight.LegLight(RIGHT_KEYLIGHT_IP, port=9123)
left.decBrightness(5)
right.decBrightness(5)

View file

@ -0,0 +1,12 @@
#!/usr/bin/env python
import leglight
LEFT_KEYLIGHT_IP = "192.168.20.72"
RIGHT_KEYLIGHT_IP = "192.168.20.73"
left = leglight.LegLight(LEFT_KEYLIGHT_IP, port=9123)
right = leglight.LegLight(RIGHT_KEYLIGHT_IP, port=9123)
left.incBrightness(5)
right.incBrightness(5)

View file

@ -0,0 +1,21 @@
#!/usr/bin/env python
import leglight
LEFT_KEYLIGHT_IP = "192.168.20.72"
RIGHT_KEYLIGHT_IP = "192.168.20.73"
left = leglight.LegLight(LEFT_KEYLIGHT_IP, port=9123)
right = leglight.LegLight(RIGHT_KEYLIGHT_IP, port=9123)
if left.info()["on"] or right.info()["on"]:
left.off()
right.off()
else:
left.on()
right.on()
left.brightness(30)
right.brightness(30)
left.color(6000)
right.color(6000)

View file

@ -50,7 +50,7 @@ toggle-tiled-left=@as []
toggle-tiled-right=@as []
[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/']
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/']
email=['<Super>e']
help=@as []
home=['<Super>f']
@ -106,6 +106,21 @@ binding='<Super>t'
command='gnome-terminal'
name='Terminal (2)'
[org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom7]
binding='<Shift><Control>l'
command='/home/alexander/.pyenv/versions/utils/bin/python /home/alexander/.config/gnome-settings/elgato/toggle_keylights.py'
name='Toggle Keylights in the Office'
[org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom8]
binding='<Shift><Control>Up'
command='/home/alexander/.pyenv/versions/utils/bin/python /home/alexander/.config/gnome-settings/elgato/inc_brightness.py'
name='Increase Brightness of Keylights in the Office'
[org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom9]
binding='<Shift><Control>Down'
command='/home/alexander/.pyenv/versions/utils/bin/python /home/alexander/.config/gnome-settings/elgato/dec_brightness.py'
name='Decrease Brightness of Keylights in the Office'
[org/gnome/shell/extensions/pop-shell]
activate-launcher=['<Super>d']
pop-workspace-down=['<Primary><Alt>Down']

View file

@ -210,7 +210,7 @@ _py2_version='2.7.18'
_py3_site_packages=('black' 'pipenv' 'poetry')
# The pyenv virtualenv "utils" contains some globally available tools (e.g., mackup)
_py3_utils=('mackup' 'youtube-dl')
_py3_utils=('leglight' 'mackup' 'youtube-dl')
# Important: this REMOVES the old ~/.pyenv installation
_install_pyenv() {