some small log improvements

This commit is contained in:
sezanzeb 2021-01-10 01:36:59 +01:00
parent b316f09cfa
commit 0ed8d9e44b
3 changed files with 10 additions and 2 deletions

View File

@ -97,6 +97,7 @@ def main(options, daemon):
continue continue
preset_path = os.path.join(presets_dir, device, preset + '.json') preset_path = os.path.join(presets_dir, device, preset + '.json')
logger.info('Starting injection: "%s", "%s"', device, preset_path)
daemon.start_injecting(device, preset_path, config_dir) daemon.start_injecting(device, preset_path, config_dir)
if options.command == START: if options.command == START:
@ -109,6 +110,7 @@ def main(options, daemon):
sys.exit(1) sys.exit(1)
preset_path = os.path.abspath(os.path.expanduser(options.preset)) preset_path = os.path.abspath(os.path.expanduser(options.preset))
logger.info('Starting injection: "%s", "%s"', options.device, preset_path)
daemon.start_injecting(options.device, preset_path, config_dir) daemon.start_injecting(options.device, preset_path, config_dir)
if options.command == STOP: if options.command == STOP:

View File

@ -64,7 +64,10 @@ NO_GRAB = 6
def is_numlock_on(): def is_numlock_on():
"""Get the current state of the numlock.""" """Get the current state of the numlock."""
try: try:
xset_q = subprocess.check_output(['xset', 'q']).decode() xset_q = subprocess.check_output(
['xset', 'q'],
stderr=subprocess.STDOUT
).decode()
num_lock_status = re.search( num_lock_status = re.search(
r'Num Lock:\s+(.+?)\s', r'Num Lock:\s+(.+?)\s',
xset_q xset_q

View File

@ -56,7 +56,10 @@ class SystemMapping:
self.clear() self.clear()
xmodmap_dict = {} xmodmap_dict = {}
try: try:
xmodmap = subprocess.check_output(['xmodmap', '-pke']).decode() xmodmap = subprocess.check_output(
['xmodmap', '-pke'],
stderr=subprocess.STDOUT
).decode()
xmodmap = xmodmap.lower() xmodmap = xmodmap.lower()
mappings = re.findall(r'(\d+) = (.+)\n', xmodmap + '\n') mappings = re.findall(r'(\d+) = (.+)\n', xmodmap + '\n')
for keycode, names in mappings: for keycode, names in mappings: