mirror of
https://github.com/sezanzeb/input-remapper
synced 2024-11-08 07:10:36 +00:00
made it work on an old ubuntu laptop
This commit is contained in:
parent
77a0978e21
commit
a9b9cb56a3
@ -26,10 +26,21 @@ import os
|
|||||||
import site
|
import site
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
|
||||||
|
from keymapper.logger import logger
|
||||||
|
|
||||||
|
|
||||||
def get_data_path(filename=''):
|
def get_data_path(filename=''):
|
||||||
"""Depending on the installation prefix, return the data dir."""
|
"""Depending on the installation prefix, return the data dir."""
|
||||||
|
try:
|
||||||
source_path = pkg_resources.require('key-mapper')[0].location
|
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
|
# depending on where this file is installed to, make sure to use the proper
|
||||||
# prefix path for data
|
# prefix path for data
|
||||||
|
@ -135,7 +135,7 @@ class KeycodeInjector:
|
|||||||
if not needed:
|
if not needed:
|
||||||
# skipping reading and checking on events from those devices
|
# skipping reading and checking on events from those devices
|
||||||
# may be beneficial for performance.
|
# may be beneficial for performance.
|
||||||
logger.debug('No need to grab %s', device.path)
|
logger.debug('No need to grab %s', path)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
attempts = 0
|
attempts = 0
|
||||||
|
@ -35,6 +35,15 @@ from keymapper.logger import logger
|
|||||||
_devices = None
|
_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):
|
class _GetDevices(threading.Thread):
|
||||||
"""Process to get the devices that can be worked with.
|
"""Process to get the devices that can be worked with.
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ class Window:
|
|||||||
if keycode is None:
|
if keycode is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
if keycode == 280:
|
if keycode in [280, 333]:
|
||||||
# disable mapping the left mouse button because it would break
|
# disable mapping the left mouse button because it would break
|
||||||
# the mouse. Also it is emitted right when focusing the row
|
# the mouse. Also it is emitted right when focusing the row
|
||||||
# which breaks the current workflow.
|
# which breaks the current workflow.
|
||||||
|
@ -95,9 +95,13 @@ def is_debug():
|
|||||||
def log_info():
|
def log_info():
|
||||||
"""Log version and name to the console"""
|
"""Log version and name to the console"""
|
||||||
# read values from setup.py
|
# read values from setup.py
|
||||||
|
try:
|
||||||
version = pkg_resources.require('key-mapper')[0].version
|
version = pkg_resources.require('key-mapper')[0].version
|
||||||
name = pkg_resources.require('key-mapper')[0].project_name
|
name = pkg_resources.require('key-mapper')[0].project_name
|
||||||
logger.info('%s %s', version, 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):
|
def update_verbosity(debug):
|
||||||
|
Loading…
Reference in New Issue
Block a user