Skip to content

Commit

Permalink
Quote device name string when grabbing/ungrabbing (#160)
Browse files Browse the repository at this point in the history
* Quote device name string when grabbing/ungrabbing

It can be confusing when the device name string includes something generic like 'keyboard', which can seem like just part of the logging. Quotes around the actual device name string when grabbing or ungrabbing the device will alleviate this. 

Example using my keyboard device name: 

(+K) Grabbing AT Translated Set 2 keyboard (/dev/input/event4)

(+K) Grabbing 'AT Translated Set 2 keyboard' (/dev/input/event4)

The device name is not 'AT Translated Set 2', which might be a natural assumption, but 'AT Translated Set 2 keyboard', which will be made clearer by adding the quotes.

* Remove colon from "Ungrabbing: " logging

Removing colon from "Ungrabbing: " log messages to match with "Grabbing " log message.
  • Loading branch information
RedBearAK authored Jun 7, 2023
1 parent 4138003 commit 8934b81
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/keyszer/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def autodetect(self):
self.grab(device)

def grab(self, device):
info(f"Grabbing {device.name} ({device.fn})", ctx="+K")
info(f"Grabbing '{device.name}' ({device.fn})", ctx="+K")
self._loop.add_reader(device, self._input_cb, device)
self._devices.append(device)
try:
Expand All @@ -93,7 +93,7 @@ def grab(self, device):
raise DeviceGrabError()

def ungrab(self, device):
info(f"Ungrabbing: {device.name} (removed)", ctx="-K")
info(f"Ungrabbing '{device.name}' (removed)", ctx="-K")
self._loop.remove_reader(device)
self._devices.remove(device)
try:
Expand All @@ -105,7 +105,7 @@ def ungrab_by_filename(self, fn):
for device in self._devices:
try:
if device.fn == fn:
info(f"Ungrabbing: {device.name} (removed)", ctx="-K")
info(f"Ungrabbing '{device.name}' (removed)", ctx="-K")
self._loop.remove_reader(device)
self._devices.remove(device)
device.ungrab()
Expand Down

0 comments on commit 8934b81

Please sign in to comment.