aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmacropad.pyw3
-rwxr-xr-xreadme.rst4
-rw-r--r--[-rwxr-xr-x]socketserver.py2
-rw-r--r--xlib.py8
4 files changed, 12 insertions, 5 deletions
diff --git a/macropad.pyw b/macropad.pyw
index 87dfd40..3a3b7e2 100755
--- a/macropad.pyw
+++ b/macropad.pyw
@@ -186,6 +186,9 @@ class Application(object):
except Exception as e:
print(e)
+ """ Send the message to the endpoint.
+ If the content is the same, ignore the message and return.
+ """
def send(self, data: str):
if data == self.last_layout:
return
diff --git a/readme.rst b/readme.rst
index 1efcb06..1273a22 100755
--- a/readme.rst
+++ b/readme.rst
@@ -65,7 +65,9 @@ Socket server
host = localhost
name = The name of the application to associate with
-Use a proxy to connect with the keyboard (as server)
+Use a proxy to connect with the keyboard (as server). The name will be used to
+restore the registered layout if the application is selected. You can declare
+multiple application using a `,` as a separator.
The mapping
-----------
diff --git a/socketserver.py b/socketserver.py
index c68915a..74f0940 100755..100644
--- a/socketserver.py
+++ b/socketserver.py
@@ -60,7 +60,7 @@ class Handler(object):
if application_name is not None:
# Split the values using `,` as separator
reader = csv.reader([application_name])
- self.application_name = [name.lower() for name in next(reader)]
+ self.application_name = [name.lower().strip() for name in next(reader)]
else:
self.application_name = None
diff --git a/xlib.py b/xlib.py
index 4577e96..159e1c8 100644
--- a/xlib.py
+++ b/xlib.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python3
import Xlib
import Xlib.display
@@ -69,12 +68,15 @@ class Listener(Thread):
# the layer (because it is the same as the previous) we do not
# switch back to the default layer.
found = True
- if code != self.last_code:
+ if code != self.last_code:
component.handle(Debug("Switching to '%s' for '%s'" % (pattern, window_name)))
self.queue.put ( (code, None) )
self.last_code = code
- break
+ # We found a matching configuration. Even if the match is the
+ # same as the current one, we break the loop in order to
+ # prevent another layer to update.
+ break
if not found and self.last_code != "default":
default = self.mapping.get("default", None)
if default is None: