diff options
author | Devaev Maxim <[email protected]> | 2018-07-28 13:23:27 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2018-07-28 13:23:27 +0300 |
commit | 01e5a8caeeeba2772acf5f888278e891aea09608 (patch) | |
tree | cad2c19d5ff7a9f086b3078069c4e483bcbacde4 /kvmd/web/js/keyboard.js | |
parent | c3939214bf07742b2e5a5c27d89dcd42dc94cb4a (diff) |
interactive hid leds
Diffstat (limited to 'kvmd/web/js/keyboard.js')
-rw-r--r-- | kvmd/web/js/keyboard.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/kvmd/web/js/keyboard.js b/kvmd/web/js/keyboard.js index c6690fdd..9d3f65e6 100644 --- a/kvmd/web/js/keyboard.js +++ b/kvmd/web/js/keyboard.js @@ -29,7 +29,12 @@ var keyboard = new function() { this.setSocket = function(ws) { keyboard.releaseAll(); __ws = ws; - $("hid-keyboard-led").className = (ws ? "led-on" : "led-off"); + keyboard.updateLeds(); + }; + + this.updateLeds = function() { + var focused = (__ws && (document.activeElement === $("stream-window") || document.activeElement === $("keyboard-window"))); + $("hid-keyboard-led").className = (focused ? "led-on" : "led-off"); }; this.releaseAll = function(ws) { |