made it work on an old ubuntu laptop

xkb
sezanzeb 4 years ago committed by sezanzeb
parent ece186061d
commit 09dae2594f

@ -26,10 +26,21 @@ import os
import site
import pkg_resources
from keymapper.logger import logger
def get_data_path(filename=''):
"""Depending on the installation prefix, return the data dir."""
source_path = pkg_resources.require('key-mapper')[0].location
try:
source_path = pkg_resources.require('key-mapper')[0].location
except pkg_resources.DistributionNotFound as error:
# try to check where stuff usually should be
logger.debug(error)
data_path = '/usr/share/key-mapper'
if not os.path.exists(data_path):
logger.error('key-mapper data was not properly installed')
raise SystemExit(1)
return os.path.join('/usr/share/key-mapper', filename)
# depending on where this file is installed to, make sure to use the proper
# prefix path for data

@ -135,7 +135,7 @@ class KeycodeInjector:
if not needed:
# skipping reading and checking on events from those devices
# may be beneficial for performance.
logger.debug('No need to grab %s', device.path)
logger.debug('No need to grab %s', path)
return None
attempts = 0

@ -35,6 +35,15 @@ from keymapper.logger import logger
_devices = None
if not hasattr(evdev.InputDevice, 'path'):
# for evdev < 1.0.0 patch the path property
@property
def path(device):
return device.fn
evdev.InputDevice.path = path
class _GetDevices(threading.Thread):
"""Process to get the devices that can be worked with.

@ -206,7 +206,7 @@ class Window:
if keycode is None:
return
if keycode == 280:
if keycode in [280, 333]:
# disable mapping the left mouse button because it would break
# the mouse. Also it is emitted right when focusing the row
# which breaks the current workflow.

@ -95,9 +95,13 @@ def is_debug():
def log_info():
"""Log version and name to the console"""
# read values from setup.py
version = pkg_resources.require('key-mapper')[0].version
name = pkg_resources.require('key-mapper')[0].project_name
logger.info('%s %s', version, name)
try:
version = pkg_resources.require('key-mapper')[0].version
name = pkg_resources.require('key-mapper')[0].project_name
logger.info('%s %s', version, name)
except pkg_resources.DistributionNotFound as error:
logger.info('Could not figure out the version')
logger.debug(error)
def update_verbosity(debug):

Loading…
Cancel
Save