Renamed to Input Remapper

pull/257/head
Tobi 2 years ago committed by GitHub
parent d3d1d9124f
commit a2ed3696ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,8 +1,8 @@
[run]
branch = True
source = /usr/lib/python3.9/site-packages/keymapper
source = /usr/lib/python3.9/site-packages/inputremapper
concurrency = multiprocessing
debug = multiproc
omit =
# not used currently due to problems
/usr/lib/python3.9/site-packages/keymapper/ipc/socket.py
/usr/lib/python3.9/site-packages/inputremapper/ipc/socket.py

@ -11,14 +11,14 @@ Please install the newest version from source to see if the problem has already
Share some logs please:
1. `key-mapper-control --version`
1. `input-remapper-control --version`
2. which linux distro (ubuntu 20.04, manjaro, etc.)
3. `echo $XDG_SESSION_TYPE`
4. which desktop environment (gnome, plasma, xfce4, etc.)
5. `sudo ls -l /proc/1/exe`
6. `cat ~/.config/key-mapper/config.json`
7. `key-mapper-control --command hello`
8. `systemctl status key-mapper -n 50`
9. `sudo pkill -f key-mapper-service && sudo key-mapper-service -d & sleep 2 && key-mapper-control --command autoload`, are your keys mapped now?
6. `cat ~/.config/input-remapper/config.json`
7. `input-remapper-control --command hello`
8. `systemctl status input-remapper -n 50`
9. `sudo pkill -f input-remapper-service && sudo input-remapper-service -d & sleep 2 && input-remapper-control --command autoload`, are your keys mapped now?
10. (while the previous command is still running) `sudo evtest` and search for a device suffixed by "mapped". Select it, does it report any events? Share the output.

@ -11,6 +11,6 @@ Please install the newest version from source to see if the problem has already
Share some logs please:
1. `key-mapper-control --version`
2. If a button on your device doesn't show up in the GUI, verify that the button is reporting an event via `sudo evtest`. If not, key-mapper won't be able to map that button.
3. If yes, please run `key-mapper-gtk -d`, reproduce the problem and then share the logs.
1. `input-remapper-control --version`
2. If a button on your device doesn't show up in the GUI, verify that the button is reporting an event via `sudo evtest`. If not, input-remapper won't be able to map that button.
3. If yes, please run `input-remapper-gtk -d`, reproduce the problem and then share the logs.

@ -11,12 +11,12 @@ Please install the newest version from source to see if the problem has already
Share some logs please:
1. `key-mapper-control --version`
1. `input-remapper-control --version`
2. which linux distro (ubuntu 20.04, manjaro, etc.)
3. `echo $XDG_SESSION_TYPE`
4. which desktop environment (gnome, plasma, xfce4, etc.)
5. `sudo ls -l /proc/1/exe`
6. paste the affected preset .json file from ~/.config/key-mapper/presets
7. `sudo pkill -f key-mapper-service && key-mapper-gtk -d`, start the injection and hit your key. Then share that log.
6. paste the affected preset .json file from ~/.config/input-remapper/presets
7. `sudo pkill -f input-remapper-service && input-remapper-gtk -d`, start the injection and hit your key. Then share that log.
8. `sudo evtest` would also be interesting while the first command is still running, to see how your mappings are injected.

2
.gitignore vendored

@ -1,4 +1,4 @@
keymapper/commit_hash.py
inputremapper/commit_hash.py
*.glade~
*.glade#

@ -1,7 +1,8 @@
Package: key-mapper
Package: input-remapper
Version: 1.2.2
Architecture: all
Maintainer: Sezanzeb <proxima@sezanzeb.de>
Depends: build-essential, libpython3-dev, libdbus-1-dev, python3, python3-setuptools, python3-evdev, python3-pydbus, python3-gi, gettext, python3-cairo, libgtk-3-0
Description: A tool to change the mapping of your input device buttons
Replaces: python3-key-mapper
Replaces: python3-key-mapper, key-mapper
Conflicts: python3-key-mapper, key-mapper

@ -1,6 +1,11 @@
#!/bin/bash
if [ -d "/run/systemd/system/" ]; then
pkill -f key-mapper-service # might have been started by the gui previously
systemctl enable key-mapper
systemctl start key-mapper
# old name, those lines should at some point be removed from postinst
pkill -f key-mapper-service
systemctl disable key-mapper
systemctl stop key-mapper
pkill -f input-remapper-service # might have been started by the gui previously
systemctl enable input-remapper
systemctl start input-remapper
fi

@ -1,4 +0,0 @@
# for /scripts/build.sh
recursive-include data *
include bin/key-mapper-gtk
include bin/key-mapper-service

@ -1,6 +1,8 @@
<p align="center"><img src="data/key-mapper.svg" width=100/></p>
<p align="center"><img src="data/input-remapper.svg" width=100/></p>
<h1 align="center">Key Mapper</h1>
<h1 align="center">Input Remapper</h1>
<p align="center"><b>Formerly Key Mapper</b></p>
<p align="center">
An easy to use tool to change the mapping of your input device buttons.<br/>
@ -17,29 +19,29 @@
##### Manjaro/Arch
```bash
pacaur -S key-mapper-git
pacaur -S input-remapper-git
```
##### Ubuntu/Debian
Get a .deb file from the [release page](https://github.com/sezanzeb/key-mapper/releases)
Get a .deb file from the [release page](https://github.com/sezanzeb/input-remapper/releases)
or install the latest changes via:
```bash
sudo apt install git python3-setuptools gettext
git clone https://github.com/sezanzeb/key-mapper.git
cd key-mapper && ./scripts/build.sh
sudo apt install ./dist/key-mapper-1.2.2.deb
git clone https://github.com/sezanzeb/input-remapper.git
cd input-remapper && ./scripts/build.sh
sudo apt install ./dist/input-remapper-1.2.2.deb
```
key-mapper is now part of [Debian Unstable](https://packages.debian.org/sid/key-mapper)
input-remapper is now part of [Debian Unstable](https://packages.debian.org/sid/input-remapper)
##### pip
```bash
sudo pip install --no-binary :all: git+https://github.com/sezanzeb/key-mapper.git
sudo systemctl enable key-mapper
sudo systemctl restart key-mapper
sudo pip install --no-binary :all: git+https://github.com/sezanzeb/input-remapper.git
sudo systemctl enable input-remapper
sudo systemctl restart input-remapper
```
If it doesn't seem to install, you can also try `sudo python3 setup.py install`

@ -0,0 +1,295 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of input-remapper.
#
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Control the dbus service from the command line."""
import os
import grp
import sys
import argparse
import logging
import subprocess
from inputremapper.logger import logger, update_verbosity, log_info, add_filehandler
from inputremapper.config import config
# import inputremapper modules as late as possible to make sure the correct
# log level is applied before anything is logged
AUTOLOAD = 'autoload'
START = 'start'
STOP = 'stop'
STOP_ALL = 'stop-all'
HELLO = 'hello'
# internal stuff that the gui uses
START_DAEMON = 'start-daemon'
HELPER = 'helper'
def run(cmd):
"""Run and log a command."""
logger.info('Running `%s`...', cmd)
code = os.system(cmd)
if code != 0:
logger.error('Failed. exit code %d', code)
def group_exists(name):
"""Check if a group with that name exists."""
try:
grp.getgrnam(name)
return True
except KeyError:
return False
COMMANDS = [AUTOLOAD, START, STOP, HELLO, STOP_ALL]
INTERNALS = [START_DAEMON, HELPER]
def utils(options):
"""Listing names, tasks that don't require a running daemon."""
if options.list_devices:
logger.setLevel(logging.ERROR)
from inputremapper.groups import groups
for group in groups:
print(group.key)
if options.key_names:
from inputremapper.system_mapping import system_mapping
print('\n'.join(system_mapping.list_names()))
def communicate(options, daemon):
"""Commands that require a running daemon"""
# import stuff late to make sure the correct log level is applied
# before anything is logged
from inputremapper.groups import groups
from inputremapper.paths import USER
def require_group():
if options.device is None:
logger.error('--device missing')
sys.exit(1)
if options.device.startswith('/dev'):
group = groups.find(path=options.device)
else:
group = groups.find(key=options.device)
if group is None:
logger.error(
'Device "%s" is unknown or not an appropriate input device',
options.device
)
sys.exit(1)
return group
if daemon is None:
# probably broken tests
logger.error('Daemon missing')
sys.exit(1)
if options.config_dir is not None:
path = os.path.abspath(os.path.expanduser(os.path.join(
options.config_dir,
'config.json'
)))
if not os.path.exists(path):
logger.error('"%s" does not exist', path)
sys.exit(1)
logger.info('Using config from "%s" instead', path)
config.load_config(path)
if USER != 'root':
# Might be triggered by udev, so skip the root user.
# This will also refresh the config of the daemon if the user changed
# it in the meantime.
# config_dir is either the cli arg or the default path in home
config_dir = os.path.dirname(config.path)
daemon.set_config_dir(config_dir)
if options.command == AUTOLOAD:
# if device was specified, autoload for that one. if None autoload
# for all devices.
if options.device is None:
logger.info('Autoloading all')
# timeout is not documented, for more info see
# https://github.com/LEW21/pydbus/blob/master/pydbus/proxy_method.py
daemon.autoload(timeout=10)
else:
group = require_group()
logger.info('Asking daemon to autoload for %s', options.device)
daemon.autoload_single(group.key, timeout=2)
if options.command == START:
group = require_group()
logger.info(
'Starting injection: "%s", "%s"',
options.device, options.preset
)
daemon.start_injecting(group.key, options.preset)
if options.command == STOP:
group = require_group()
daemon.stop_injecting(group.key)
if options.command == STOP_ALL:
daemon.stop_all()
if options.command == HELLO:
response = daemon.hello('hello')
logger.info('Daemon answered with "%s"', response)
def internals(options):
"""Methods that are needed to get the gui to work and that require root.
input-remapper-control should be started with sudo or pkexec for this.
"""
debug = ' -d' if options.debug else ''
if options.command == HELPER:
cmd = f'input-remapper-helper{debug}'
elif options.command == START_DAEMON:
cmd = f'input-remapper-service --hide-info{debug}'
else:
return
# daemonize
cmd = f'{cmd} &'
os.system(cmd)
def systemd_finished():
"""Check if systemd finished booting."""
try:
systemd_analyze = subprocess.run(['systemd-analyze'], stdout=subprocess.PIPE)
except FileNotFoundError:
# probably not systemd, lets assume true to not block input-remapper for good
# on certain installations
return True
if 'finished' in systemd_analyze.stdout.decode():
return True
return False
def main(options):
if options.debug:
update_verbosity(True)
add_filehandler('/var/log/input-remapper-control')
if options.version:
log_info()
return
logger.debug('Call for "%s"', sys.argv)
from inputremapper.paths import USER
boot_finished = systemd_finished()
is_root = USER == "root"
is_autoload = options.command == AUTOLOAD
config_dir_set = options.config_dir is not None
if is_autoload and not boot_finished and is_root and not config_dir_set:
# this is probably happening during boot time and got
# triggered by udev. There is no need to try to inject anything if the
# service doesn't know where to look for a config file. This avoids a lot
# of confusing service logs. And also avoids potential for problems when
# input-remapper-control stresses about evdev, dbus and multiprocessing already
# while the system hasn't even booted completely.
logger.warning('Skipping autoload command without a logged in user')
return
if options.command is not None:
if options.command in INTERNALS:
internals(options)
elif options.command in COMMANDS:
from inputremapper.daemon import Daemon
daemon = Daemon.connect(fallback=False)
communicate(options, daemon)
else:
logger.error('Unknown command "%s"', options.command)
else:
utils(options)
if options.command:
logger.info('Done')
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument(
'--command', action='store', dest='command', help=(
'Communicate with the daemon. Available commands are start, '
'stop, autoload, hello or stop-all'
), default=None, metavar='NAME'
)
parser.add_argument(
'--config-dir', action='store', dest='config_dir',
help=(
'path to the config directory containing config.json, '
'xmodmap.json and the presets folder. '
'defaults to ~/.config/input-remapper/'
),
default=None, metavar='PATH',
)
parser.add_argument(
'--preset', action='store', dest='preset',
help='The filename of the preset without the .json extension.',
default=None, metavar='NAME',
)
parser.add_argument(
'--device', action='store', dest='device',
help='One of the device keys from --list-devices',
default=None, metavar='NAME'
)
parser.add_argument(
'--list-devices', action='store_true', dest='list_devices',
help='List available device keys and exit',
default=False
)
parser.add_argument(
'--symbol-names', action='store_true', dest='key_names',
help='Print all available names for the mapping',
default=False
)
parser.add_argument(
'-d', '--debug', action='store_true', dest='debug',
help='Displays additional debug information',
default=False
)
parser.add_argument(
'-v', '--version', action='store_true', dest='version',
help='Print the version and exit', default=False
)
main(parser.parse_args(sys.argv[1:]))

@ -0,0 +1,86 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of input-remapper.
#
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Starts the user interface."""
import sys
import atexit
import gettext
import locale
from inputremapper.data import get_data_path
import os.path
from argparse import ArgumentParser
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('GLib', '2.0')
from gi.repository import Gtk
APP_NAME = 'input-remapper'
LOCALE_DIR = os.path.join(get_data_path(), 'lang')
locale.bindtextdomain(APP_NAME, LOCALE_DIR)
locale.textdomain(APP_NAME)
translate = gettext.translation(APP_NAME, LOCALE_DIR, fallback=True)
_ = translate.gettext
# https://github.com/Nuitka/Nuitka/issues/607#issuecomment-650217096
Gtk.init()
from inputremapper.logger import logger, update_verbosity, log_info
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument(
'-d', '--debug', action='store_true', dest='debug',
help=_('Displays additional debug information'),
default=False
)
options = parser.parse_args(sys.argv[1:])
update_verbosity(options.debug)
log_info('input-remapper-gtk')
logger.debug('Using locale directory: {}'.format(LOCALE_DIR))
# import input-remapper stuff after setting the log verbosity
from inputremapper.gui.window import Window
from inputremapper.daemon import Daemon
from inputremapper.daemon import config
config.load_config()
window = Window()
def stop():
if isinstance(window.dbus, Daemon):
# it created its own temporary daemon inside the process
# because none was running
window.dbus.stop_all()
window.on_close()
atexit.register(stop)
Gtk.main()

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Starts the root helper."""
@ -28,7 +28,7 @@ import atexit
import signal
from argparse import ArgumentParser
from keymapper.logger import update_verbosity
from inputremapper.logger import update_verbosity
if __name__ == '__main__':
@ -42,8 +42,8 @@ if __name__ == '__main__':
update_verbosity(options.debug)
# import key-mapper stuff after setting the log verbosity
from keymapper.gui.helper import RootHelper
# import input-remapper stuff after setting the log verbosity
from inputremapper.gui.helper import RootHelper
def on_exit():
"""Don't remain idle and alive when the GUI exits via ctrl+c."""

@ -0,0 +1,55 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of input-remapper.
#
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Starts injecting keycodes based on the configuration."""
import sys
from argparse import ArgumentParser
from inputremapper.logger import update_verbosity, log_info, add_filehandler
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument(
'-d', '--debug', action='store_true', dest='debug',
help='Displays additional debug information', default=False
)
parser.add_argument(
'--hide-info', action='store_true', dest='hide_info',
help='Don\'t display version information', default=False
)
options = parser.parse_args(sys.argv[1:])
update_verbosity(options.debug)
# import input-remapper stuff after setting the log verbosity
from inputremapper.daemon import Daemon
add_filehandler()
if not options.hide_info:
log_info('input-remapper-service')
daemon = Daemon()
daemon.publish()
daemon.run()

@ -1,295 +1,30 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
print('key-mapper-control is deprecated, please use input-remapper-control instead')
"""Control the dbus service from the command line."""
from importlib.util import spec_from_loader, module_from_spec
from importlib.machinery import SourceFileLoader
import os
import grp
import sys
import argparse
import logging
import subprocess
from keymapper.logger import logger, update_verbosity, log_info, add_filehandler
from keymapper.config import config
# import keymapper modules as late as possible to make sure the correct
# log level is applied before anything is logged
AUTOLOAD = 'autoload'
START = 'start'
STOP = 'stop'
STOP_ALL = 'stop-all'
HELLO = 'hello'
# internal stuff that the gui uses
START_DAEMON = 'start-daemon'
HELPER = 'helper'
def run(cmd):
"""Run and log a command."""
logger.info('Running `%s`...', cmd)
code = os.system(cmd)
if code != 0:
logger.error('Failed. exit code %d', code)
def group_exists(name):
"""Check if a group with that name exists."""
try:
grp.getgrnam(name)
return True
except KeyError:
return False
COMMANDS = [AUTOLOAD, START, STOP, HELLO, STOP_ALL]
INTERNALS = [START_DAEMON, HELPER]
def utils(options):
"""Listing names, tasks that don't require a running daemon."""
if options.list_devices:
logger.setLevel(logging.ERROR)
from keymapper.groups import groups
for group in groups:
print(group.key)
if options.key_names:
from keymapper.system_mapping import system_mapping
print('\n'.join(system_mapping.list_names()))
def communicate(options, daemon):
"""Commands that require a running daemon"""
# import stuff late to make sure the correct log level is applied
# before anything is logged
from keymapper.groups import groups
from keymapper.paths import USER
def require_group():
if options.device is None:
logger.error('--device missing')
sys.exit(1)
if options.device.startswith('/dev'):
group = groups.find(path=options.device)
else:
group = groups.find(key=options.device)
if group is None:
logger.error(
'Device "%s" is unknown or not an appropriate input device',
options.device
)
sys.exit(1)
return group
if daemon is None:
# probably broken tests
logger.error('Daemon missing')
sys.exit(1)
if options.config_dir is not None:
path = os.path.abspath(os.path.expanduser(os.path.join(
options.config_dir,
'config.json'
)))
if not os.path.exists(path):
logger.error('"%s" does not exist', path)
sys.exit(1)
logger.info('Using config from "%s" instead', path)
config.load_config(path)
if USER != 'root':
# Might be triggered by udev, so skip the root user.
# This will also refresh the config of the daemon if the user changed
# it in the meantime.
# config_dir is either the cli arg or the default path in home
config_dir = os.path.dirname(config.path)
daemon.set_config_dir(config_dir)
if options.command == AUTOLOAD:
# if device was specified, autoload for that one. if None autoload
# for all devices.
if options.device is None:
logger.info('Autoloading all')
# timeout is not documented, for more info see
# https://github.com/LEW21/pydbus/blob/master/pydbus/proxy_method.py
daemon.autoload(timeout=10)
else:
group = require_group()
logger.info('Asking daemon to autoload for %s', options.device)
daemon.autoload_single(group.key, timeout=2)
if options.command == START:
group = require_group()
logger.info(
'Starting injection: "%s", "%s"',
options.device, options.preset
)
daemon.start_injecting(group.key, options.preset)
if options.command == STOP:
group = require_group()
daemon.stop_injecting(group.key)
if options.command == STOP_ALL:
daemon.stop_all()
if options.command == HELLO:
response = daemon.hello('hello')
logger.info('Daemon answered with "%s"', response)
def internals(options):
"""Methods that are needed to get the gui to work and that require root.
key-mapper-control should be started with sudo or pkexec for this.
"""
debug = ' -d' if options.debug else ''
if options.command == HELPER:
cmd = f'key-mapper-helper{debug}'
elif options.command == START_DAEMON:
cmd = f'key-mapper-service --hide-info{debug}'
else:
return
# daemonize
cmd = f'{cmd} &'
os.system(cmd)
def systemd_finished():
"""Check if systemd finished booting."""
try:
systemd_analyze = subprocess.run(['systemd-analyze'], stdout=subprocess.PIPE)
except FileNotFoundError:
# probably not systemd, lets assume true to not block key-mapper for good
# on certain installations
return True
if 'finished' in systemd_analyze.stdout.decode():
return True
return False
def main(options):
if options.debug:
update_verbosity(True)
add_filehandler('/var/log/key-mapper-control')
if options.version:
log_info()
return
logger.debug('Call for "%s"', sys.argv)
from keymapper.paths import USER
boot_finished = systemd_finished()
is_root = USER == "root"
is_autoload = options.command == AUTOLOAD
config_dir_set = options.config_dir is not None
if is_autoload and not boot_finished and is_root and not config_dir_set:
# this is probably happening during boot time and got
# triggered by udev. There is no need to try to inject anything if the
# service doesn't know where to look for a config file. This avoids a lot
# of confusing service logs. And also avoids potential for problems when
# key-mapper-control stresses about evdev, dbus and multiprocessing already
# while the system hasn't even booted completely.
logger.warning('Skipping autoload command without a logged in user')
return
if options.command is not None:
if options.command in INTERNALS:
internals(options)
elif options.command in COMMANDS:
from keymapper.daemon import Daemon
daemon = Daemon.connect(fallback=False)
communicate(options, daemon)
else:
logger.error('Unknown command "%s"', options.command)
else:
utils(options)
if options.command:
logger.info('Done')
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument(
'--command', action='store', dest='command', help=(
'Communicate with the daemon. Available commands are start, '
'stop, autoload, hello or stop-all'
), default=None, metavar='NAME'
)
parser.add_argument(
'--config-dir', action='store', dest='config_dir',
help=(
'path to the config directory containing config.json, '
'xmodmap.json and the presets folder. '
'defaults to ~/.config/key-mapper/'
),
default=None, metavar='PATH',
)
parser.add_argument(
'--preset', action='store', dest='preset',
help='The filename of the preset without the .json extension.',
default=None, metavar='NAME',
)
parser.add_argument(
'--device', action='store', dest='device',
help='One of the device keys from --list-devices',
default=None, metavar='NAME'
)
parser.add_argument(
'--list-devices', action='store_true', dest='list_devices',
help='List available device keys and exit',
default=False
)
parser.add_argument(
'--symbol-names', action='store_true', dest='key_names',
help='Print all available names for the mapping',
default=False
)
parser.add_argument(
'-d', '--debug', action='store_true', dest='debug',
help='Displays additional debug information',
default=False
)
parser.add_argument(
'-v', '--version', action='store_true', dest='version',
help='Print the version and exit', default=False
)
main(parser.parse_args(sys.argv[1:]))
bin_path = "/bin/input-remapper-control"
loader = SourceFileLoader("__main__", bin_path)
spec = spec_from_loader("__main__", loader)
module = module_from_spec(spec)
spec.loader.exec_module(module)

@ -1,86 +1,30 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
print('key-mapper-gtk is deprecated, please use input-remapper-gtk instead')
"""Starts the user interface."""
from importlib.util import spec_from_loader, module_from_spec
from importlib.machinery import SourceFileLoader
import sys
import atexit
import gettext
import locale
from keymapper.data import get_data_path
import os.path
from argparse import ArgumentParser
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('GLib', '2.0')
from gi.repository import Gtk
APP_NAME = 'key-mapper'
LOCALE_DIR = os.path.join(get_data_path(), 'lang')
locale.bindtextdomain(APP_NAME, LOCALE_DIR)
locale.textdomain(APP_NAME)
translate = gettext.translation(APP_NAME, LOCALE_DIR, fallback=True)
_ = translate.gettext
# https://github.com/Nuitka/Nuitka/issues/607#issuecomment-650217096
Gtk.init()
from keymapper.logger import logger, update_verbosity, log_info
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument(
'-d', '--debug', action='store_true', dest='debug',
help=_('Displays additional debug information'),
default=False
)
options = parser.parse_args(sys.argv[1:])
update_verbosity(options.debug)
log_info('key-mapper-gtk')
logger.debug('Using locale directory: {}'.format(LOCALE_DIR))
# import key-mapper stuff after setting the log verbosity
from keymapper.gui.window import Window
from keymapper.daemon import Daemon
from keymapper.daemon import config
config.load_config()
window = Window()
def stop():
if isinstance(window.dbus, Daemon):
# it created its own temporary daemon inside the process
# because none was running
window.dbus.stop_all()
window.on_close()
atexit.register(stop)
Gtk.main()
bin_path = "/bin/input-remapper-gtk"
loader = SourceFileLoader("__main__", bin_path)
spec = spec_from_loader("__main__", loader)
module = module_from_spec(spec)
spec.loader.exec_module(module)

@ -1,55 +1,30 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
print('key-mapper-service is deprecated, please use input-remapper-service instead')
"""Starts injecting keycodes based on the configuration."""
from importlib.util import spec_from_loader, module_from_spec
from importlib.machinery import SourceFileLoader
import sys
from argparse import ArgumentParser
from keymapper.logger import update_verbosity, log_info, add_filehandler
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument(
'-d', '--debug', action='store_true', dest='debug',
help='Displays additional debug information', default=False
)
parser.add_argument(
'--hide-info', action='store_true', dest='hide_info',
help='Don\'t display version information', default=False
)
options = parser.parse_args(sys.argv[1:])
update_verbosity(options.debug)
# import key-mapper stuff after setting the log verbosity
from keymapper.daemon import Daemon
add_filehandler()
if not options.hide_info:
log_info('key-mapper-service')
daemon = Daemon()
daemon.publish()
daemon.run()
bin_path = "/bin/input-remapper-service"
loader = SourceFileLoader("__main__", bin_path)
spec = spec_from_loader("__main__", loader)
module = module_from_spec(spec)
spec.loader.exec_module(module)

@ -5,4 +5,4 @@
# sudo udevadm control --log-priority=debug
# sudo udevadm control --reload-rules
# journalctl -f
ACTION=="add", SUBSYSTEM=="input", RUN+="/bin/key-mapper-control --command autoload --device $env{DEVNAME}"
ACTION=="add", SUBSYSTEM=="input", RUN+="/bin/input-remapper-control --command autoload --device $env{DEVNAME}"

@ -0,0 +1,6 @@
[Desktop Entry]
Type=Application
Exec=bash -c "input-remapper-control --command stop-all && input-remapper-control --command autoload"
Name=input-remapper-autoload
Icon=/usr/share/input-remapper/input-remapper.svg
Comment=Starts injecting all presets that are set to automatically load for the user

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

@ -1,8 +1,8 @@
[Desktop Entry]
Type=Application
Name=key-mapper
Icon=/usr/share/key-mapper/key-mapper.svg
Exec=key-mapper-gtk
Name=input-remapper
Icon=/usr/share/input-remapper/input-remapper.svg
Exec=input-remapper-gtk
Terminal=false
Categories=Settings
Comment=GUI for device specific key mappings

@ -51,8 +51,8 @@
<object class="GtkWindow" id="window">
<property name="width-request">750</property>
<property name="can-focus">False</property>
<property name="title" translatable="yes">Key Mapper</property>
<property name="icon">key-mapper.svg</property>
<property name="title" translatable="yes">Input Remapper</property>
<property name="icon">input-remapper.svg</property>
<signal name="delete-event" handler="on_close" swapped="no"/>
<signal name="key-press-event" handler="key_press" swapped="no"/>
<signal name="key-release-event" handler="key_release" swapped="no"/>
@ -805,7 +805,7 @@ To give your keys back their original mapping.</property>
<object class="GtkWindow" id="about-dialog">
<property name="can-focus">False</property>
<property name="modal">True</property>
<property name="icon">key-mapper.svg</property>
<property name="icon">input-remapper.svg</property>
<property name="type-hint">dialog</property>
<property name="urgency-hint">True</property>
<property name="transient-for">window</property>
@ -828,7 +828,7 @@ To give your keys back their original mapping.</property>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixbuf">key-mapper-large.png</property>
<property name="pixbuf">input-remapper-large.png</property>
</object>
<packing>
<property name="expand">False</property>
@ -858,7 +858,7 @@ To give your keys back their original mapping.</property>
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="label" translatable="yes">You can find more information and report bugs at
&lt;a href="https://github.com/sezanzeb/key-mapper"&gt;https://github.com/sezanzeb/key-mapper&lt;/a&gt;</property>
&lt;a href="https://github.com/sezanzeb/input-remapper"&gt;https://github.com/sezanzeb/input-remapper&lt;/a&gt;</property>
<property name="use-markup">True</property>
<property name="justify">center</property>
</object>
@ -923,13 +923,13 @@ See the &lt;a href="https://www.gnu.org/licenses/gpl-3.0.html"&gt;GNU General Pu
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">See &lt;a href="https://github.com/sezanzeb/key-mapper/blob/HEAD/readme/usage.md"&gt;usage.md&lt;/a&gt; online on github for comprehensive information.
<property name="label" translatable="yes">See &lt;a href="https://github.com/sezanzeb/input-remapper/blob/HEAD/readme/usage.md"&gt;usage.md&lt;/a&gt; online on github for comprehensive information.
A "key + key + ... + key" syntax can be used to trigger key combinations. For example "Control_L + a".
Writing "disable" as a mapping disables a key.
Macros allow multiple characters to be written with a single key-press. Information about programming them is available online on github. See &lt;a href="https://github.com/sezanzeb/key-mapper/blob/HEAD/readme/macros.md"&gt;macros.md&lt;/a&gt; and &lt;a href="https://github.com/sezanzeb/key-mapper/blob/HEAD/readme/examples.md"&gt;examples.md&lt;/a&gt;</property>
Macros allow multiple characters to be written with a single key-press. Information about programming them is available online on github. See &lt;a href="https://github.com/sezanzeb/input-remapper/blob/HEAD/readme/macros.md"&gt;macros.md&lt;/a&gt; and &lt;a href="https://github.com/sezanzeb/input-remapper/blob/HEAD/readme/examples.md"&gt;examples.md&lt;/a&gt;</property>
<property name="use-markup">True</property>
<property name="wrap">True</property>
<property name="xalign">0</property>
@ -1091,9 +1091,9 @@ Macros allow multiple characters to be written with a single key-press. Informat
<object class="GtkDialog" id="confirm-delete">
<property name="can-focus">False</property>
<property name="border-width">4</property>
<property name="title" translatable="yes">Key Mapper</property>
<property name="title" translatable="yes">Input Remapper</property>
<property name="modal">True</property>
<property name="icon">key-mapper.svg</property>
<property name="icon">input-remapper.svg</property>
<property name="type-hint">dialog</property>
<property name="urgency-hint">True</property>
<property name="transient-for">window</property>
@ -1203,9 +1203,9 @@ Macros allow multiple characters to be written with a single key-press. Informat
<object class="GtkDialog" id="error_dialog">
<property name="can-focus">False</property>
<property name="border-width">4</property>
<property name="title" translatable="yes">Key Mapper</property>
<property name="title" translatable="yes">Input Remapper</property>
<property name="modal">True</property>
<property name="icon">key-mapper.svg</property>
<property name="icon">input-remapper.svg</property>
<property name="type-hint">dialog</property>
<property name="urgency-hint">True</property>
<property name="transient-for">window</property>

@ -4,15 +4,15 @@
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd"
>
<policyconfig>
<action id="keymapper">
<description>Run Key Mapper as root</description>
<action id="inputremapper">
<description>Run Input Remapper as root</description>
<message>Authentication is required to discover and read devices.</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/key-mapper-control</annotate>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/input-remapper-control</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">false</annotate>
</action>
</policyconfig>

@ -1,14 +1,14 @@
[Unit]
Description=Service to inject keycodes without the GUI application
# dbus is required for ipc between gui and key-mapper-control
# dbus is required for ipc between gui and input-remapper-control
Requires=dbus.service
After=dbus.service
[Service]
Type=dbus
BusName=keymapper.Control
ExecStart=/usr/bin/key-mapper-service
BusName=inputremapper.Control
ExecStart=/usr/bin/input-remapper-service
[Install]
WantedBy=default.target
Alias=key-mapper.service
Alias=input-remapper.service

@ -13,7 +13,7 @@
version="1.1"
id="svg2873"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
sodipodi:docname="key-mapper.svg">
sodipodi:docname="input-remapper.svg">
<defs
id="defs2867">
<filter

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

@ -3,7 +3,7 @@
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy context="default">
<allow own="keymapper.Control"/>
<allow send_destination="keymapper.Control"/>
<allow own="inputremapper.Control"/>
<allow send_destination="inputremapper.Control"/>
</policy>
</busconfig>

@ -1,6 +0,0 @@
[Desktop Entry]
Type=Application
Exec=bash -c "key-mapper-control --command stop-all && key-mapper-control --command autoload"
Name=key-mapper-autoload
Icon=/usr/share/key-mapper/key-mapper.svg
Comment=Starts injecting all presets that are set to automatically load for the user

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Store which presets should be enabled for which device on login."""
@ -26,9 +26,9 @@ import os
import json
import copy
from keymapper.paths import CONFIG_PATH, USER, touch
from keymapper.logger import logger, VERSION
from keymapper.migrations import migrate
from inputremapper.paths import CONFIG_PATH, USER, touch
from inputremapper.logger import logger, VERSION
from inputremapper.migrations import migrate
MOUSE = "mouse"
WHEEL = "wheel"

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Starts injecting keycodes based on the configuration.
@ -37,17 +37,17 @@ import gi
gi.require_version("GLib", "2.0")
from gi.repository import GLib
from keymapper.logger import logger, is_debug
from keymapper.injection.injector import Injector, UNKNOWN
from keymapper.mapping import Mapping
from keymapper.config import config
from keymapper.system_mapping import system_mapping
from keymapper.groups import groups
from keymapper.paths import get_config_path, USER
from keymapper.injection.macros.macro import macro_variables
from inputremapper.logger import logger, is_debug
from inputremapper.injection.injector import Injector, UNKNOWN
from inputremapper.mapping import Mapping
from inputremapper.config import config
from inputremapper.system_mapping import system_mapping
from inputremapper.groups import groups
from inputremapper.paths import get_config_path, USER
from inputremapper.injection.macros.macro import macro_variables
BUS_NAME = "keymapper.Control"
BUS_NAME = "inputremapper.Control"
# timeout in seconds, see
# https://github.com/LEW21/pydbus/blob/cc407c8b1d25b7e28a6d661a29f9e661b1c9b964/pydbus/proxy.py
BUS_TIMEOUT = 10
@ -75,7 +75,7 @@ class AutoloadHistory:
This is needed because udev triggers multiple times per hardware
device, and because it should be possible to stop the injection
by unplugging the device if the preset goes wrong or if key-mapper
by unplugging the device if the preset goes wrong or if input-remapper
has some bug that prevents the computer from being controlled.
For that unplug and reconnect the device twice within a 15 seconds
@ -203,10 +203,10 @@ class Daemon:
logger.info("Starting the service")
# Blocks until pkexec is done asking for the password.
# Runs via key-mapper-control so that auth_admin_keep works
# Runs via input-remapper-control so that auth_admin_keep works
# for all pkexec calls of the gui
debug = " -d" if is_debug() else ""
cmd = f"pkexec key-mapper-control --command start-daemon {debug}"
cmd = f"pkexec input-remapper-control --command start-daemon {debug}"
# using pkexec will also cause the service to continue running in
# the background after the gui has been closed, which will keep
@ -328,7 +328,7 @@ class Daemon:
group = groups.find(key=group_key)
if group is None:
# even after groups.refresh, the device is unknown, so it's
# either not relevant for key-mapper, or not connected yet
# either not relevant for input-remapper, or not connected yet
return
preset = config.get(["autoload", group.key], log_unknown=False)
@ -368,7 +368,7 @@ class Daemon:
unique identifier used by the groups object
"""
# avoid some confusing logs and filter obviously invalid requests
if group_key.startswith("key-mapper"):
if group_key.startswith("input-remapper"):
return
logger.info('Request to autoload for "%s"', group_key)

@ -1,25 +1,25 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Get stuff from /usr/share/key-mapper, depending on the prefix."""
"""Get stuff from /usr/share/input-remapper, depending on the prefix."""
import sys
@ -27,7 +27,7 @@ import os
import site
import pkg_resources
from keymapper.logger import logger
from inputremapper.logger import logger
logged = False
@ -44,7 +44,7 @@ def get_data_path(filename=""):
source = None
try:
source = pkg_resources.require("key-mapper")[0].location
source = pkg_resources.require("input-remapper")[0].location
# failed in some ubuntu installations
except pkg_resources.DistributionNotFound:
pass
@ -65,9 +65,9 @@ def get_data_path(filename=""):
data = None
candidates = [
"/usr/share/key-mapper",
"/usr/local/share/key-mapper",
os.path.join(site.USER_BASE, "share/key-mapper"),
"/usr/share/input-remapper",
"/usr/local/share/input-remapper",
os.path.join(site.USER_BASE, "share/input-remapper"),
]
if data is None:

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Find, classify and group devices.
@ -52,8 +52,8 @@ from evdev.ecodes import (
REL_WHEEL,
)
from keymapper.logger import logger
from keymapper.paths import get_preset_path
from inputremapper.logger import logger
from inputremapper.paths import get_preset_path
TABLET_KEYS = [
@ -192,7 +192,7 @@ DENYLIST = [".*Yubico.*YubiKey.*", "Eee PC WMI hotkeys"]
def is_denylisted(device):
"""Check if a device should not be used in key-mapper.
"""Check if a device should not be used in input-remapper.
Parameters
----------
@ -420,7 +420,7 @@ class _Groups:
def __getattribute__(self, key):
"""To lazy load group info only when needed.
For example, this helps to keep logs of key-mapper-control clear when it doesnt
For example, this helps to keep logs of input-remapper-control clear when it doesnt
need it the information.
"""
if key == "_groups" and object.__getattribute__(self, "_groups") is None:
@ -447,12 +447,12 @@ class _Groups:
keys = [f'"{group.key}"' for group in self._groups]
logger.info("Found %s", ", ".join(keys))
def filter(self, include_keymapper=False):
def filter(self, include_inputremapper=False):
"""Filter groups."""
result = []
for group in self._groups:
name = group.name
if not include_keymapper and name.startswith("key-mapper"):
if not include_inputremapper and name.startswith("input-remapper"):
continue
result.append(group)
@ -468,7 +468,7 @@ class _Groups:
return [
group.name
for group in self._groups
if not group.name.startswith("key-mapper")
if not group.name.startswith("input-remapper")
]
def __len__(self):
@ -485,7 +485,7 @@ class _Groups:
"""Load a serialized representation created via dumps."""
self._groups = [_Group.loads(group) for group in json.loads(dump)]
def find(self, name=None, key=None, path=None, include_keymapper=False):
def find(self, name=None, key=None, path=None, include_inputremapper=False):
"""Find a group that matches the provided parameters.
Parameters
@ -499,7 +499,7 @@ class _Groups:
"/dev/input/event3"
"""
for group in self._groups:
if not include_keymapper and group.name.startswith("key-mapper"):
if not include_inputremapper and group.name.startswith("input-remapper"):
continue
if name and group.name != name:

@ -1,28 +1,28 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""One mapping object for the GUI application."""
from keymapper.mapping import Mapping
from inputremapper.mapping import Mapping
custom_mapping = Mapping()

@ -1,27 +1,27 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@hip70890b.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Process that sends stuff to the GUI.
It should be started via key-mapper-control and pkexec.
It should be started via input-remapper-control and pkexec.
GUIs should not run as root
https://wiki.archlinux.org/index.php/Running_GUI_applications_as_root
@ -41,11 +41,11 @@ import subprocess
import evdev
from evdev.ecodes import EV_KEY, EV_ABS
from keymapper.ipc.pipe import Pipe
from keymapper.logger import logger
from keymapper.groups import groups
from keymapper import utils
from keymapper.user import USER
from inputremapper.ipc.pipe import Pipe
from inputremapper.logger import logger
from inputremapper.groups import groups
from inputremapper import utils
from inputremapper.user import USER
TERMINATE = "terminate"
@ -55,7 +55,7 @@ REFRESH_GROUPS = "refresh_groups"
def is_helper_running():
"""Check if the helper is running."""
try:
subprocess.check_output(["pgrep", "-f", "key-mapper-helper"])
subprocess.check_output(["pgrep", "-f", "input-remapper-helper"])
except subprocess.CalledProcessError:
return False
return True
@ -72,8 +72,8 @@ class RootHelper:
def __init__(self):
"""Construct the helper and initialize its sockets."""
self._results = Pipe(f"/tmp/key-mapper-{USER}/results")
self._commands = Pipe(f"/tmp/key-mapper-{USER}/commands")
self._results = Pipe(f"/tmp/input-remapper-{USER}/results")
self._commands = Pipe(f"/tmp/input-remapper-{USER}/commands")
self._send_groups()

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Talking to the GUI helper that has root permissions.
@ -28,14 +28,14 @@ see gui.helper.helper
import evdev
from evdev.ecodes import EV_REL
from keymapper.logger import logger
from keymapper.key import Key
from keymapper.groups import groups, GAMEPAD
from keymapper.ipc.pipe import Pipe
from keymapper.gui.helper import TERMINATE, REFRESH_GROUPS
from keymapper import utils
from keymapper.gui.custom_mapping import custom_mapping
from keymapper.user import USER
from inputremapper.logger import logger
from inputremapper.key import Key
from inputremapper.groups import groups, GAMEPAD
from inputremapper.ipc.pipe import Pipe
from inputremapper.gui.helper import TERMINATE, REFRESH_GROUPS
from inputremapper import utils
from inputremapper.gui.custom_mapping import custom_mapping
from inputremapper.user import USER
DEBOUNCE_TICKS = 3
@ -71,8 +71,8 @@ class Reader:
def connect(self):
"""Connect to the helper."""
self._results = Pipe(f"/tmp/key-mapper-{USER}/results")
self._commands = Pipe(f"/tmp/key-mapper-{USER}/commands")
self._results = Pipe(f"/tmp/input-remapper-{USER}/results")
self._commands = Pipe(f"/tmp/input-remapper-{USER}/commands")
def are_new_devices_available(self):
"""Check if groups contains new devices.

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""A single, configurable key mapping."""
@ -25,11 +25,11 @@
import evdev
from gi.repository import Gtk, GLib, Gdk
from keymapper.system_mapping import system_mapping
from keymapper.gui.custom_mapping import custom_mapping
from keymapper.logger import logger
from keymapper.key import Key
from keymapper.gui.reader import reader
from inputremapper.system_mapping import system_mapping
from inputremapper.gui.custom_mapping import custom_mapping
from inputremapper.logger import logger
from inputremapper.key import Key
from inputremapper.gui.reader import reader
CTX_KEYCODE = 2

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""User Interface."""
@ -28,19 +28,19 @@ import sys
from gi.repository import Gtk, Gdk, GLib
from keymapper.data import get_data_path
from keymapper.paths import get_config_path
from keymapper.system_mapping import system_mapping
from keymapper.gui.custom_mapping import custom_mapping
from keymapper.presets import (
from inputremapper.data import get_data_path
from inputremapper.paths import get_config_path
from inputremapper.system_mapping import system_mapping
from inputremapper.gui.custom_mapping import custom_mapping
from inputremapper.presets import (
find_newest_preset,
get_presets,
delete_preset,
rename_preset,
get_available_preset_name,
)
from keymapper.logger import logger, COMMIT_HASH, VERSION, EVDEV_VERSION, is_debug
from keymapper.groups import (
from inputremapper.logger import logger, COMMIT_HASH, VERSION, EVDEV_VERSION, is_debug
from inputremapper.groups import (
groups,
GAMEPAD,
KEYBOARD,
@ -49,14 +49,14 @@ from keymapper.groups import (
TOUCHPAD,
MOUSE,
)
from keymapper.gui.row import Row, to_string
from keymapper.key import Key
from keymapper.gui.reader import reader
from keymapper.gui.helper import is_helper_running
from keymapper.injection.injector import RUNNING, FAILED, NO_GRAB
from keymapper.daemon import Daemon
from keymapper.config import config
from keymapper.injection.macros.parse import is_this_a_macro, parse
from inputremapper.gui.row import Row, to_string
from inputremapper.key import Key
from inputremapper.gui.reader import reader
from inputremapper.gui.helper import is_helper_running
from inputremapper.injection.injector import RUNNING, FAILED, NO_GRAB
from inputremapper.daemon import Daemon
from inputremapper.config import config
from inputremapper.injection.macros.parse import is_this_a_macro, parse
def gtk_iteration():
@ -155,7 +155,7 @@ class Window:
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION,
)
gladefile = get_data_path("key-mapper.glade")
gladefile = get_data_path("input-remapper.glade")
builder = Gtk.Builder()
builder.add_from_file(gladefile)
builder.connect_signals(self)
@ -183,7 +183,7 @@ class Window:
self.about.set_position(Gtk.WindowPosition.CENTER_ON_PARENT)
self.get("version-label").set_text(
f"key-mapper {VERSION} {COMMIT_HASH[:7]}" f"\npython-evdev {EVDEV_VERSION}"
f"input-remapper {VERSION} {COMMIT_HASH[:7]}" f"\npython-evdev {EVDEV_VERSION}"
if EVDEV_VERSION
else ""
)
@ -231,7 +231,7 @@ class Window:
self.dbus = Daemon.connect()
debug = " -d" if is_debug() else ""
cmd = f"pkexec key-mapper-control --command helper {debug}"
cmd = f"pkexec input-remapper-control --command helper {debug}"
logger.debug("Running `%s`", cmd)
exit_code = os.system(cmd)
@ -373,7 +373,7 @@ class Window:
with HandlerDisabled(device_selection, self.on_select_device):
self.device_store.clear()
for group in groups.filter(include_keymapper=False):
for group in groups.filter(include_inputremapper=False):
types = group.types
if len(types) > 0:
device_type = sorted(types, key=ICON_PRIORITIES.index)[0]
@ -700,7 +700,7 @@ class Window:
return True
def show_device_mapping_status(self):
"""Figure out if this device is currently under keymappers control."""
"""Figure out if this device is currently under inputremappers control."""
group_key = self.group.key
state = self.dbus.get_state(group_key)
if state == RUNNING:

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""The injection process.

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Because multiple calls to async_read_loop won't work."""
@ -26,9 +26,9 @@ import asyncio
import evdev
from keymapper.injection.consumers.joystick_to_mouse import JoystickToMouse
from keymapper.injection.consumers.keycode_mapper import KeycodeMapper
from keymapper.logger import logger
from inputremapper.injection.consumers.joystick_to_mouse import JoystickToMouse
from inputremapper.injection.consumers.keycode_mapper import KeycodeMapper
from inputremapper.logger import logger
consumer_classes = [

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Consumers

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Consumer base class.

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Keeps mapping joystick to mouse movements."""
@ -38,11 +38,11 @@ from evdev.ecodes import (
ABS_RY,
)
from keymapper.logger import logger
from keymapper.config import MOUSE, WHEEL
from keymapper import utils
from keymapper.injection.consumers.consumer import Consumer
from keymapper.groups import classify, GAMEPAD
from inputremapper.logger import logger
from inputremapper.config import MOUSE, WHEEL
from inputremapper import utils
from inputremapper.injection.consumers.consumer import Consumer
from inputremapper.groups import classify, GAMEPAD
# miniscule movements on the joystick should not trigger a mouse wheel event
WHEEL_THRESHOLD = 0.15

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Inject a keycode based on the mapping."""
@ -29,12 +29,12 @@ import time
import evdev
from evdev.ecodes import EV_KEY, EV_ABS
from keymapper.logger import logger
from keymapper.mapping import DISABLE_CODE
from keymapper import utils
from keymapper.injection.consumers.consumer import Consumer
from keymapper.utils import RELEASE
from keymapper.groups import classify, GAMEPAD
from inputremapper.logger import logger
from inputremapper.mapping import DISABLE_CODE
from inputremapper import utils
from inputremapper.injection.consumers.consumer import Consumer
from inputremapper.utils import RELEASE
from inputremapper.groups import classify, GAMEPAD
# this state is shared by all KeycodeMappers of this process

@ -1,31 +1,31 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Stores injection-process wide information."""
from keymapper.logger import logger
from keymapper.injection.macros.parse import parse, is_this_a_macro
from keymapper.system_mapping import system_mapping
from keymapper.config import NONE, MOUSE, WHEEL, BUTTONS
from inputremapper.logger import logger
from inputremapper.injection.macros.parse import parse, is_this_a_macro
from inputremapper.system_mapping import system_mapping
from inputremapper.config import NONE, MOUSE, WHEEL, BUTTONS
class Context:

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Keeps injecting keycodes in the background based on the mapping."""
@ -29,15 +29,15 @@ import multiprocessing
import evdev
from evdev.ecodes import EV_KEY, EV_REL
from keymapper.logger import logger
from keymapper.groups import classify, GAMEPAD
from keymapper.mapping import DISABLE_CODE
from keymapper.injection.context import Context
from keymapper.injection.numlock import set_numlock, is_numlock_on, ensure_numlock
from keymapper.injection.consumer_control import ConsumerControl
from inputremapper.logger import logger
from inputremapper.groups import classify, GAMEPAD
from inputremapper.mapping import DISABLE_CODE
from inputremapper.injection.context import Context
from inputremapper.injection.numlock import set_numlock, is_numlock_on, ensure_numlock
from inputremapper.injection.consumer_control import ConsumerControl
DEV_NAME = "key-mapper"
DEV_NAME = "input-remapper"
# messages
CLOSE = 0

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Executes more complex patterns of keystrokes.
@ -41,10 +41,10 @@ import re
from evdev.ecodes import ecodes, EV_KEY, EV_REL, REL_X, REL_Y, REL_WHEEL, REL_HWHEEL
from keymapper.logger import logger
from keymapper.system_mapping import system_mapping
from keymapper.ipc.shared_dict import SharedDict
from keymapper.utils import PRESS, PRESS_NEGATIVE
from inputremapper.logger import logger
from inputremapper.system_mapping import system_mapping
from inputremapper.ipc.shared_dict import SharedDict
from inputremapper.utils import PRESS, PRESS_NEGATIVE
macro_variables = SharedDict()

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Parse macro code"""
@ -26,8 +26,8 @@ import re
import traceback
import inspect
from keymapper.logger import logger
from keymapper.injection.macros.macro import Macro, Variable
from inputremapper.logger import logger
from inputremapper.injection.macros.macro import Macro, Variable
def is_this_a_macro(output):
@ -397,6 +397,6 @@ def parse(macro, context, return_errors=False):
return macro_object if not return_errors else None
except Exception as error:
logger.error('Failed to parse macro "%s": %s', macro, error.__repr__())
# print the traceback in case this is a bug of key-mapper
# print the traceback in case this is a bug of input-remapper
logger.debug("".join(traceback.format_tb(error.__traceback__)).strip())
return f"{error.__class__.__name__}: {str(error)}" if return_errors else None

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Functions to handle numlocks.
@ -29,7 +29,7 @@ which is why these functions exist.
import re
import subprocess
from keymapper.logger import logger
from inputremapper.logger import logger
def is_numlock_on():

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Since I'm not forking, I can't use multiprocessing.Pipe.

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Named bidirectional non-blocking pipes.
@ -41,8 +41,8 @@ import os
import time
import json
from keymapper.logger import logger
from keymapper.paths import mkdir, chown
from inputremapper.logger import logger
from inputremapper.paths import mkdir, chown
class Pipe:

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Share a dictionary across processes."""
@ -26,7 +26,7 @@ import multiprocessing
import atexit
import select
from keymapper.logger import logger
from inputremapper.logger import logger
class SharedDict:

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Non-blocking abstraction of unix domain sockets.
@ -56,8 +56,8 @@ import os
import time
import json
from keymapper.logger import logger
from keymapper.paths import mkdir, chown
from inputremapper.logger import logger
from inputremapper.paths import mkdir, chown
# something funny that most likely won't appear in messages.

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""A button or a key combination."""

@ -1,25 +1,25 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Logging setup for key-mapper."""
"""Logging setup for input-remapper."""
import os
@ -29,10 +29,10 @@ import logging
import pkg_resources
from datetime import datetime
from keymapper.user import HOME
from inputremapper.user import HOME
try:
from keymapper.commit_hash import COMMIT_HASH
from inputremapper.commit_hash import COMMIT_HASH
except ImportError:
COMMIT_HASH = ""
@ -89,9 +89,9 @@ logging.Logger.spam = spam
logging.Logger.key_spam = key_spam
LOG_PATH = (
"/var/log/key-mapper"
"/var/log/input-remapper"
if os.access("/var/log", os.W_OK)
else f"{HOME}/.log/key-mapper"
else f"{HOME}/.log/input-remapper"
)
logger = logging.getLogger()
@ -152,17 +152,17 @@ logging.getLogger("asyncio").setLevel(logging.WARNING)
VERSION = ""
EVDEV_VERSION = None
try:
VERSION = pkg_resources.require("key-mapper")[0].version
VERSION = pkg_resources.require("input-remapper")[0].version
EVDEV_VERSION = pkg_resources.require("evdev")[0].version
except pkg_resources.DistributionNotFound as error:
logger.info("Could not figure out the version")
logger.debug(error)
def log_info(name="key-mapper"):
def log_info(name="input-remapper"):
"""Log version and name to the console."""
logger.info(
"%s %s %s https://github.com/sezanzeb/key-mapper", name, VERSION, COMMIT_HASH
"%s %s %s https://github.com/sezanzeb/input-remapper", name, VERSION, COMMIT_HASH
)
if EVDEV_VERSION:

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Contains and manages mappings."""
@ -28,10 +28,10 @@ import copy
from evdev.ecodes import EV_KEY, BTN_LEFT
from keymapper.logger import logger
from keymapper.paths import touch
from keymapper.config import ConfigBase, config
from keymapper.key import Key
from inputremapper.logger import logger
from inputremapper.paths import touch
from inputremapper.config import ConfigBase, config
from inputremapper.key import Key
DISABLE_NAME = "disable"

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Migration functions"""
@ -25,16 +25,18 @@
import os
import json
import copy
import shutil
from pathlib import Path
import pkg_resources
from keymapper.logger import logger, VERSION
from keymapper.paths import get_preset_path, mkdir, CONFIG_PATH
from inputremapper.logger import logger, VERSION
from inputremapper.user import HOME
from inputremapper.paths import get_preset_path, mkdir, CONFIG_PATH
def all_presets():
"""All presets for all groups as list"""
"""Get all presets for all groups as list."""
preset_path = Path(get_preset_path())
presets = []
for folder in preset_path.iterdir():
@ -48,7 +50,7 @@ def all_presets():
def config_version():
"""Version string in the config.json as packaging.Version"""
"""Get the version string in config.json as packaging.Version object."""
config_path = os.path.join(CONFIG_PATH, "config.json")
config = {}
@ -65,7 +67,7 @@ def config_version():
def _config_suffix():
"""append .json suffix to config file"""
"""Append the .json suffix to the config file."""
deprecated_path = os.path.join(CONFIG_PATH, "config")
config_path = os.path.join(CONFIG_PATH, "config.json")
if os.path.exists(deprecated_path) and not os.path.exists(config_path):
@ -96,7 +98,7 @@ def _preset_path():
def _mapping_keys():
"""update all preset mappings
"""Update all preset mappings.
Update all keys in mapping to include value e.g.: "1,5"->"1,5,1"
"""
@ -118,12 +120,12 @@ def _mapping_keys():
def _update_version():
"""Write current version string to the config file"""
"""Write the current version to the config file."""
config_file = os.path.join(CONFIG_PATH, "config.json")
if not os.path.exists(config_file):
return
logger.info("version in config file to %s", VERSION)
logger.info("Updating version in config to %s", VERSION)
with open(config_file, "r") as file:
config = json.load(file)
@ -132,8 +134,16 @@ def _update_version():
json.dump(config, file, indent=4)
def _rename_config():
"""Rename .config/key-mapper to .config/input-remapper."""
old_config_path = os.path.join(HOME, ".config/key-mapper")
if not os.path.exists(CONFIG_PATH) and os.path.exists(old_config_path):
logger.info("Moving %s to %s", old_config_path, CONFIG_PATH)
shutil.move(old_config_path, CONFIG_PATH)
def migrate():
"""Migrate config files to the current release"""
"""Migrate config files to the current release."""
v = config_version()
if v < pkg_resources.parse_version("0.4.0"):
_config_suffix()
@ -142,6 +152,9 @@ def migrate():
if v < pkg_resources.parse_version("1.2.2"):
_mapping_keys()
if v < pkg_resources.parse_version("1.3.0"):
_rename_config()
# add new migrations here
if v < pkg_resources.parse_version(VERSION):

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Path constants to be used."""
@ -25,8 +25,8 @@
import os
import shutil
from keymapper.logger import logger
from keymapper.user import USER, CONFIG_PATH
from inputremapper.logger import logger
from inputremapper.user import USER, CONFIG_PATH
def chown(path):
@ -67,7 +67,7 @@ def mkdir(path, log=True):
logger.info('Creating dir "%s"', path)
# give all newly created folders to the user.
# e.g. if .config/key-mapper/mouse/ is created the latter two
# e.g. if .config/input-remapper/mouse/ is created the latter two
base = os.path.split(path)[0]
mkdir(base, log=False)
@ -107,5 +107,5 @@ def get_preset_path(group_name=None, preset=None):
def get_config_path(*paths):
"""Get a path in ~/.config/key-mapper/"""
"""Get a path in ~/.config/input-remapper/"""
return os.path.join(CONFIG_PATH, *paths)

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Helperfunctions to find device ids, names, and to load presets."""
@ -27,9 +27,9 @@ import time
import glob
import re
from keymapper.paths import get_preset_path, mkdir, CONFIG_PATH
from keymapper.logger import logger
from keymapper.groups import groups
from inputremapper.paths import get_preset_path, mkdir, CONFIG_PATH
from inputremapper.logger import logger
from inputremapper.groups import groups
def get_available_preset_name(group_name, preset="new preset", copy=False):

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Make the systems/environments mapping of keys and codes accessible."""
@ -27,10 +27,10 @@ import json
import subprocess
import evdev
from keymapper.logger import logger
from keymapper.mapping import DISABLE_NAME, DISABLE_CODE
from keymapper.paths import get_config_path, touch
from keymapper.utils import is_service
from inputremapper.logger import logger
from inputremapper.mapping import DISABLE_NAME, DISABLE_CODE
from inputremapper.paths import get_config_path, touch
from inputremapper.utils import is_service
# xkb uses keycodes that are 8 higher than those from evdev
@ -51,7 +51,7 @@ class SystemMapping:
def __getattribute__(self, key):
"""To lazy load system_mapping info only when needed.
For example, this helps to keep logs of key-mapper-control clear when it doesnt
For example, this helps to keep logs of input-remapper-control clear when it doesnt
need it the information.
"""
if key == "_mapping" and object.__getattribute__(self, "_mapping") is None:
@ -91,7 +91,7 @@ class SystemMapping:
if not is_service():
# Clients usually take care of that, don't let the service do funny things.
# Write this stuff into the key-mapper config directory, because
# Write this stuff into the input-remapper config directory, because
# the systemd service won't know the user sessions xmodmap.
path = get_config_path(XMODMAP_FILENAME)
touch(path)

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Figure out the user."""
@ -67,4 +67,4 @@ USER = get_user()
HOME = get_home(USER)
CONFIG_PATH = os.path.join(HOME, ".config/key-mapper")
CONFIG_PATH = os.path.join(HOME, ".config/input-remapper")

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Utility functions."""
@ -38,8 +38,8 @@ from evdev.ecodes import (
REL_HWHEEL,
)
from keymapper.logger import logger
from keymapper.config import BUTTONS
from inputremapper.logger import logger
from inputremapper.config import BUTTONS
# other events for ABS include buttons
@ -238,4 +238,4 @@ def get_max_abs(device, code=ABS_X):
def is_service():
return sys.argv[0].endswith("key-mapper-service")
return sys.argv[0].endswith("input-remapper-service")

@ -17,15 +17,15 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: data/key-mapper.glade:1128
#: data/input-remapper.glade:1128
msgid "."
msgstr ""
#: data/key-mapper.glade:1348
#: data/input-remapper.glade:1348
msgid "1, 2"
msgstr ""
#: data/key-mapper.glade:926
#: data/input-remapper.glade:926
msgid ""
"A \"key + key + ... + key\" syntax can be used to trigger key combinations. "
"For example \"control_l + a\".\n"
@ -33,307 +33,307 @@ msgid ""
"\"disable\" disables a key."
msgstr ""
#: data/key-mapper.glade:898
#: data/input-remapper.glade:898
msgid "About"
msgstr ""
#: data/key-mapper.glade:209
#: data/input-remapper.glade:209
msgid "Apply"
msgstr ""
#: data/key-mapper.glade:403
#: data/input-remapper.glade:403
msgid "Autoload"
msgstr ""
#: data/key-mapper.glade:1420
#: data/input-remapper.glade:1420
msgid ""
"Between calls to k, key down and key up events, macros will sleep for 10ms "
"by default, which can be configured in ~/.config/key-mapper/config"
"by default, which can be configured in ~/.config/input-remapper/config"
msgstr ""
#: data/key-mapper.glade:482 data/key-mapper.glade:526
#: data/input-remapper.glade:482 data/input-remapper.glade:526
msgid "Buttons"
msgstr ""
#: data/key-mapper.glade:1286
#: data/input-remapper.glade:1286
msgid "CTRL + a, CTRL + x"
msgstr ""
#: data/key-mapper.glade:706
#: data/input-remapper.glade:706
msgid ""
"Click on a cell below and hit a key on your device. Click the \"Restore "
"Defaults\" button beforehand."
msgstr ""
#: data/key-mapper.glade:228
#: data/input-remapper.glade:228
msgid "Copy"
msgstr ""
#: data/key-mapper.glade:265
#: data/input-remapper.glade:265
msgid "Delete"
msgstr ""
#: data/key-mapper.glade:96
#: data/input-remapper.glade:96
msgid "Device"
msgstr ""
#: bin/key-mapper-gtk:58
#: bin/input-remapper-gtk:58
msgid "Displays additional debug information"
msgstr ""
#: data/key-mapper.glade:214
#: data/input-remapper.glade:214
msgid "Don't hold down any keys while the injection starts."
msgstr ""
#: data/key-mapper.glade:1213
#: data/input-remapper.glade:1213
msgid "Examples"
msgstr ""
#: data/key-mapper.glade:1604
#: data/input-remapper.glade:1604
msgid "Go Back"
msgstr ""
#: data/key-mapper.glade:483 data/key-mapper.glade:527
#: data/input-remapper.glade:483 data/input-remapper.glade:527
msgid "Joystick"
msgstr ""
#: data/key-mapper.glade:709
#: data/input-remapper.glade:709
msgid "Key"
msgstr ""
#: data/key-mapper.glade:54 data/key-mapper.glade:1583
#: data/key-mapper.glade:1695
msgid "Key Mapper"
#: data/input-remapper.glade:54 data/input-remapper.glade:1583
#: data/input-remapper.glade:1695
msgid "Input Remapper"
msgstr ""
#: data/key-mapper.glade:465
#: data/input-remapper.glade:465
msgid "Left joystick"
msgstr ""
#: data/key-mapper.glade:948
#: data/input-remapper.glade:948
msgid "Macros"
msgstr ""
#: data/key-mapper.glade:964
#: data/input-remapper.glade:964
msgid "Macros allow multiple characters to be written with a single key-press."
msgstr ""
#: data/key-mapper.glade:723
#: data/input-remapper.glade:723
msgid "Mapping"
msgstr ""
#: data/key-mapper.glade:480 data/key-mapper.glade:524
#: data/input-remapper.glade:480 data/input-remapper.glade:524
msgid "Mouse"
msgstr ""
#: data/key-mapper.glade:553
#: data/input-remapper.glade:553
msgid "Mouse speed"
msgstr ""
#: data/key-mapper.glade:246
#: data/input-remapper.glade:246
msgid "New"
msgstr ""
#: data/key-mapper.glade:298
#: data/input-remapper.glade:298
msgid "Preset"
msgstr ""
#: data/key-mapper.glade:337
#: data/input-remapper.glade:337
msgid "Rename"
msgstr ""
#: data/key-mapper.glade:120
#: data/input-remapper.glade:120
msgid "Restore Defaults"
msgstr ""
#: data/key-mapper.glade:509
#: data/input-remapper.glade:509
msgid "Right joystick"
msgstr ""
#: data/key-mapper.glade:368
#: data/input-remapper.glade:368
msgid "Save the entered name"
msgstr ""
#: data/key-mapper.glade:124
#: data/input-remapper.glade:124
msgid ""
"Shortcut: ctrl + del\n"
"To give your keys back their original mapping."
msgstr ""
#: data/key-mapper.glade:1556
#: data/input-remapper.glade:1556
msgid "Shortcuts"
msgstr ""
#: data/key-mapper.glade:1458
#: data/input-remapper.glade:1458
msgid ""
"Shortcuts only work while keys are not being recorded and the gui is in "
"focus."
msgstr ""
#: data/key-mapper.glade:402
#: data/input-remapper.glade:402
msgid "To automatically apply the preset after your login or when it connects."
msgstr ""
#: data/key-mapper.glade:1439
#: data/input-remapper.glade:1439
msgid "Usage"
msgstr ""
#: data/key-mapper.glade:843
#: data/input-remapper.glade:843
msgid "Version unknown"
msgstr ""
#: data/key-mapper.glade:481 data/key-mapper.glade:525
#: data/input-remapper.glade:481 data/input-remapper.glade:525
msgid "Wheel"
msgstr ""
#: data/key-mapper.glade:860
#: data/input-remapper.glade:860
msgid ""
"You can find more information and report bugs at\n"
"<a href=\"https://github.com/sezanzeb/key-mapper\">https://github.com/"
"sezanzeb/key-mapper</a>"
"<a href=\"https://github.com/sezanzeb/input-remapper\">https://github.com/"
"sezanzeb/input-remapper</a>"
msgstr ""
#: data/key-mapper.glade:1248
#: data/input-remapper.glade:1248
msgid "a, a, a with 500ms pause"
msgstr ""
#: data/key-mapper.glade:1490
#: data/input-remapper.glade:1490
msgid "closes the application"
msgstr ""
#: data/key-mapper.glade:1478
#: data/input-remapper.glade:1478
msgid "ctrl + del"
msgstr ""
#: data/key-mapper.glade:1502
#: data/input-remapper.glade:1502
msgid "ctrl + q"
msgstr ""
#: data/key-mapper.glade:1514
#: data/input-remapper.glade:1514
msgid "ctrl + r"
msgstr ""
#: data/key-mapper.glade:1044
#: data/input-remapper.glade:1044
msgid "e"
msgstr ""
#: data/key-mapper.glade:1335
#: data/input-remapper.glade:1335
msgid "e(EV_REL, REL_X, 10)"
msgstr ""
#: data/key-mapper.glade:1104
#: data/input-remapper.glade:1104
msgid "executes the parameter as long as the key is pressed down"
msgstr ""
#: data/key-mapper.glade:1140
#: data/input-remapper.glade:1140
msgid "executes two actions behind each other"
msgstr ""
#: data/key-mapper.glade:1116
#: data/input-remapper.glade:1116
msgid "h"
msgstr ""
#: data/key-mapper.glade:1056
#: data/input-remapper.glade:1056
msgid "holds a modifier while executing the second parameter"
msgstr ""
#: data/key-mapper.glade:1020
#: data/input-remapper.glade:1020
msgid "k"
msgstr ""
#: data/key-mapper.glade:1298
#: data/input-remapper.glade:1298
msgid "k(1).h(k(2)).k(3)"
msgstr ""
#: data/key-mapper.glade:1235
#: data/input-remapper.glade:1235
msgid "k(1).k(2)"
msgstr ""
#: data/key-mapper.glade:1398
#: data/input-remapper.glade:1398
msgid "keeps scrolling down while held"
msgstr ""
#: data/key-mapper.glade:1080
#: data/input-remapper.glade:1080
msgid "m"
msgstr ""
#: data/key-mapper.glade:1273
#: data/input-remapper.glade:1273
msgid "m(Control_L, k(a).k(x))"
msgstr ""
#: data/key-mapper.glade:1152
#: data/input-remapper.glade:1152
msgid "mouse"
msgstr ""
#: data/key-mapper.glade:1372
#: data/input-remapper.glade:1372
msgid "mouse(right, 4)"
msgstr ""
#: data/key-mapper.glade:1311
#: data/input-remapper.glade:1311
msgid "moves the mouse cursor 10px to the right"
msgstr ""
#: data/key-mapper.glade:984
#: data/input-remapper.glade:984
msgid "r"
msgstr ""
#: data/key-mapper.glade:1260
#: data/input-remapper.glade:1260
msgid "r(3, k(a).w(500))"
msgstr ""
#: data/key-mapper.glade:1526
#: data/input-remapper.glade:1526
msgid "refreshes the device list"
msgstr ""
#: data/key-mapper.glade:1092
#: data/input-remapper.glade:1092
msgid "repeats the execution of the second parameter"
msgstr ""
#: data/key-mapper.glade:1188
#: data/input-remapper.glade:1188
msgid "same as mouse"
msgstr ""
#: data/key-mapper.glade:1538
#: data/input-remapper.glade:1538
msgid "stops the injection"
msgstr ""
#: data/key-mapper.glade:1176
#: data/input-remapper.glade:1176
msgid "takes direction (up, left, ...) and speed as parameters"
msgstr ""
#: data/key-mapper.glade:1008
#: data/input-remapper.glade:1008
msgid "w"
msgstr ""
#: data/key-mapper.glade:996
#: data/input-remapper.glade:996
msgid "waits in milliseconds"
msgstr ""
#: data/key-mapper.glade:1164
#: data/input-remapper.glade:1164
msgid "wheel"
msgstr ""
#: data/key-mapper.glade:1385
#: data/input-remapper.glade:1385
msgid "wheel(down, 1)"
msgstr ""
#: data/key-mapper.glade:1360
#: data/input-remapper.glade:1360
msgid "which keeps moving the mouse while pressed"
msgstr ""
#: data/key-mapper.glade:1323
#: data/input-remapper.glade:1323
msgid "writes 1 2 2 ... 2 2 3 while the key is pressed"
msgstr ""
#: data/key-mapper.glade:1032
#: data/input-remapper.glade:1032
msgid "writes a single keystroke"
msgstr ""
#: data/key-mapper.glade:1068
#: data/input-remapper.glade:1068
msgid "writes an event"
msgstr ""
#: data/key-mapper.glade:880
#: data/input-remapper.glade:880
msgid ""
"© 2021 Sezanzeb proxima@sezanzeb.de\n"
"This program comes with absolutely no warranty.\n"

@ -1,4 +1,4 @@
# ITALIAN TRANSLATION FOR KEY-MAPPER.
# ITALIAN TRANSLATION FOR INPUT-REMAPPER.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# ALBANO BATTISTELLA <albano_battistella@hotmail.com>, 2021.
@ -16,15 +16,15 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: data/key-mapper.glade:1128
#: data/input-remapper.glade:1128
msgid "."
msgstr "."
#: data/key-mapper.glade:1348
#: data/input-remapper.glade:1348
msgid "1, 2"
msgstr "1, 2"
#: data/key-mapper.glade:926
#: data/input-remapper.glade:926
msgid ""
"A \"key + key + ... + key\" syntax can be used to trigger key combinations. "
"For example \"control_l + a\".\n"
@ -36,35 +36,35 @@ msgstr ""
"\n"
"\"disabilita\"disabilitato la mappatura dei tasti."
#: data/key-mapper.glade:898
#: data/input-remapper.glade:898
msgid "About"
msgstr "Informazioni"
#: data/key-mapper.glade:209
#: data/input-remapper.glade:209
msgid "Apply"
msgstr "Applica"
#: data/key-mapper.glade:403
#: data/input-remapper.glade:403
msgid "Autoload"
msgstr "Caricamento automatico"
#: data/key-mapper.glade:1420
#: data/input-remapper.glade:1420
msgid ""
"Between calls to k, key down and key up events, macros will sleep for 10ms "
"by default, which can be configured in ~/.config/key-mapper/config"
"by default, which can be configured in ~/.config/input-remapper/config"
msgstr ""
"Tra chiamate a k, battitura ed eventi rilasciati,le macro dormiranno per 10 ms "
"per impostazione predefinita, che può essere configurato in ~/.config/key-mapper/config"
"per impostazione predefinita, che può essere configurato in ~/.config/input-remapper/config"
#: data/key-mapper.glade:482 data/key-mapper.glade:526
#: data/input-remapper.glade:482 data/input-remapper.glade:526
msgid "Buttons"
msgstr "Pulsanti"
#: data/key-mapper.glade:1286
#: data/input-remapper.glade:1286
msgid "CTRL + a, CTRL + x"
msgstr "CTRL + a, CTRL + x"
#: data/key-mapper.glade:706
#: data/input-remapper.glade:706
msgid ""
"Click on a cell below and hit a key on your device. Click the \"Restore "
"Defaults\" button beforehand."
@ -72,96 +72,96 @@ msgstr ""
"Fai clic su una cella in basso e premi un tasto sul dispositivo. Fai clic su \"Ripristina "
"Pulsante \"Predefiniti\" in anticipo."
#: data/key-mapper.glade:228
#: data/input-remapper.glade:228
msgid "Copy"
msgstr "Copia"
#: data/key-mapper.glade:265
#: data/input-remapper.glade:265
msgid "Delete"
msgstr "Cancella"
#: data/key-mapper.glade:96
#: data/input-remapper.glade:96
msgid "Device"
msgstr "Dispositivo"
#: bin/key-mapper-gtk:58
#: bin/input-remapper-gtk:58
msgid "Displays additional debug information"
msgstr "Visualizza ulteriori informazioni di debug"
#: data/key-mapper.glade:214
#: data/input-remapper.glade:214
msgid "Don't hold down any keys while the injection starts."
msgstr "Non tenere premuto alcun tasto durante l'avvio dell'iniezione."
#: data/key-mapper.glade:1213
#: data/input-remapper.glade:1213
msgid "Examples"
msgstr "Esempi"
#: data/key-mapper.glade:1604
#: data/input-remapper.glade:1604
msgid "Go Back"
msgstr "Indietro"
#: data/key-mapper.glade:483 data/key-mapper.glade:527
#: data/input-remapper.glade:483 data/input-remapper.glade:527
msgid "Joystick"
msgstr "Joystick"
#: data/key-mapper.glade:709
#: data/input-remapper.glade:709
msgid "Key"
msgstr "Tasto"
#: data/key-mapper.glade:54 data/key-mapper.glade:1583
#: data/key-mapper.glade:1695
msgid "Key Mapper"
msgstr "Key Mapper"
#: data/input-remapper.glade:54 data/input-remapper.glade:1583
#: data/input-remapper.glade:1695
msgid "Input Remapper"
msgstr "Input Remapper"
#: data/key-mapper.glade:465
#: data/input-remapper.glade:465
msgid "Left joystick"
msgstr "Joystick sinistro"
#: data/key-mapper.glade:948
#: data/input-remapper.glade:948
msgid "Macros"
msgstr "Macro"
#: data/key-mapper.glade:964
#: data/input-remapper.glade:964
msgid "Macros allow multiple characters to be written with a single key-press."
msgstr "Le macro consentono di scrivere più caratteri premendo un solo tasto."
#: data/key-mapper.glade:723
#: data/input-remapper.glade:723
msgid "Mapping"
msgstr "Mappatura"
#: data/key-mapper.glade:480 data/key-mapper.glade:524
#: data/input-remapper.glade:480 data/input-remapper.glade:524
msgid "Mouse"
msgstr "Mouse"
#: data/key-mapper.glade:553
#: data/input-remapper.glade:553
msgid "Mouse speed"
msgstr "Velocità mouse"
#: data/key-mapper.glade:246
#: data/input-remapper.glade:246
msgid "New"
msgstr "Nuovo"
#: data/key-mapper.glade:298
#: data/input-remapper.glade:298
msgid "Preset"
msgstr "Preimpostato"
#: data/key-mapper.glade:337
#: data/input-remapper.glade:337
msgid "Rename"
msgstr "Rinomina"
#: data/key-mapper.glade:120
#: data/input-remapper.glade:120
msgid "Restore Defaults"
msgstr "Ripristina impostazioni predefinite"
#: data/key-mapper.glade:509
#: data/input-remapper.glade:509
msgid "Right joystick"
msgstr "Joystick destro"
#: data/key-mapper.glade:368
#: data/input-remapper.glade:368
msgid "Save the entered name"
msgstr "Salva il nome inserito"
#: data/key-mapper.glade:124
#: data/input-remapper.glade:124
msgid ""
"Shortcut: ctrl + del\n"
"To give your keys back their original mapping."
@ -169,11 +169,11 @@ msgstr ""
"Scorciatoia: ctrl + del\n"
"Per restituire alle tue chiavi la loro mappatura originale."
#: data/key-mapper.glade:1556
#: data/input-remapper.glade:1556
msgid "Shortcuts"
msgstr "Scorciatoie"
#: data/key-mapper.glade:1458
#: data/input-remapper.glade:1458
msgid ""
"Shortcuts only work while keys are not being recorded and the gui is in "
"focus."
@ -181,173 +181,173 @@ msgstr ""
"Le scorciatoie funzionano solo mentre i tasti non vengono registrati e la GUI è in "
"messa a fuoco."
#: data/key-mapper.glade:402
#: data/input-remapper.glade:402
msgid "To automatically apply the preset after your login or when it connects."
msgstr "Per applicare automaticamente il predefinito dopo il login o quando si connette."
#: data/key-mapper.glade:1439
#: data/input-remapper.glade:1439
msgid "Usage"
msgstr "Uso"
#: data/key-mapper.glade:843
#: data/input-remapper.glade:843
msgid "Version unknown"
msgstr "Versione sconosciuta"
#: data/key-mapper.glade:481 data/key-mapper.glade:525
#: data/input-remapper.glade:481 data/input-remapper.glade:525
msgid "Wheel"
msgstr ""
#: data/key-mapper.glade:860
#: data/input-remapper.glade:860
msgid ""
"You can find more information and report bugs at\n"
"<a href=\"https://github.com/sezanzeb/key-mapper\">https://github.com/"
"sezanzeb/key-mapper</a>"
"<a href=\"https://github.com/sezanzeb/input-remapper\">https://github.com/"
"sezanzeb/input-remapper</a>"
msgstr ""
"Puoi trovare maggiori informazioni e segnalare bug su\n"
"<a href=\"https://github.com/sezanzeb/key-mapper\">https://github.com/"
"sezanzeb/key-mapper</a>"
"<a href=\"https://github.com/sezanzeb/input-remapper\">https://github.com/"
"sezanzeb/input-remapper</a>"
#: data/key-mapper.glade:1248
#: data/input-remapper.glade:1248
msgid "a, a, a with 500ms pause"
msgstr "a, a, a con pausa di 500 ms"
#: data/key-mapper.glade:1490
#: data/input-remapper.glade:1490
msgid "closes the application"
msgstr "chiude l'applicazione"
#: data/key-mapper.glade:1478
#: data/input-remapper.glade:1478
msgid "ctrl + del"
msgstr "ctrl + del"
#: data/key-mapper.glade:1502
#: data/input-remapper.glade:1502
msgid "ctrl + q"
msgstr "ctrl + q"
#: data/key-mapper.glade:1514
#: data/input-remapper.glade:1514
msgid "ctrl + r"
msgstr "ctrl + r"
#: data/key-mapper.glade:1044
#: data/input-remapper.glade:1044
msgid "e"
msgstr "e"
#: data/key-mapper.glade:1335
#: data/input-remapper.glade:1335
msgid "e(EV_REL, REL_X, 10)"
msgstr "e(EV_REL, REL_X, 10)"
#: data/key-mapper.glade:1104
#: data/input-remapper.glade:1104
msgid "executes the parameter as long as the key is pressed down"
msgstr "esegue il parametro fintanto che si tiene premuto il tasto"
#: data/key-mapper.glade:1140
#: data/input-remapper.glade:1140
msgid "executes two actions behind each other"
msgstr "esegue due azioni una dietro l'altra"
#: data/key-mapper.glade:1116
#: data/input-remapper.glade:1116
msgid "h"
msgstr "h"
#: data/key-mapper.glade:1056
#: data/input-remapper.glade:1056
msgid "holds a modifier while executing the second parameter"
msgstr "contiene un modificatore durante l'esecuzione del secondo parametro"
#: data/key-mapper.glade:1020
#: data/input-remapper.glade:1020
msgid "k"
msgstr "k"
#: data/key-mapper.glade:1298
#: data/input-remapper.glade:1298
msgid "k(1).h(k(2)).k(3)"
msgstr "k(1).h(k(2)).k(3)"
#: data/key-mapper.glade:1235
#: data/input-remapper.glade:1235
msgid "k(1).k(2)"
msgstr "k(1).k(2)"
#: data/key-mapper.glade:1398
#: data/input-remapper.glade:1398
msgid "keeps scrolling down while held"
msgstr "continua a scorrere verso il basso mentre si tiene premuto"
#: data/key-mapper.glade:1080
#: data/input-remapper.glade:1080
msgid "m"
msgstr "m"
#: data/key-mapper.glade:1273
#: data/input-remapper.glade:1273
msgid "m(Control_L, k(a).k(x))"
msgstr "m(Control_L, k(a).k(x))"
#: data/key-mapper.glade:1152
#: data/input-remapper.glade:1152
msgid "mouse"
msgstr "mouse"
#: data/key-mapper.glade:1372
#: data/input-remapper.glade:1372
msgid "mouse(right, 4)"
msgstr "mouse(destra, 4)"
#: data/key-mapper.glade:1311
#: data/input-remapper.glade:1311
msgid "moves the mouse cursor 10px to the right"
msgstr "sposta il cursore del mouse di 10 pixel a destra"
#: data/key-mapper.glade:984
#: data/input-remapper.glade:984
msgid "r"
msgstr "r"
#: data/key-mapper.glade:1260
#: data/input-remapper.glade:1260
msgid "r(3, k(a).w(500))"
msgstr "r(3, k(a).w(500))"
#: data/key-mapper.glade:1526
#: data/input-remapper.glade:1526
msgid "refreshes the device list"
msgstr "aggiorna l'elenco dei dispositivi"
#: data/key-mapper.glade:1092
#: data/input-remapper.glade:1092
msgid "repeats the execution of the second parameter"
msgstr "ripete l'esecuzione del secondo parametro"
#: data/key-mapper.glade:1188
#: data/input-remapper.glade:1188
msgid "same as mouse"
msgstr "come al mouse"
#: data/key-mapper.glade:1538
#: data/input-remapper.glade:1538
msgid "stops the injection"
msgstr "ferma l'iniezione"
#: data/key-mapper.glade:1176
#: data/input-remapper.glade:1176
msgid "takes direction (up, left, ...) and speed as parameters"
msgstr "prende la direzione (su, sinistra, ...) e la velocità come parametri"
#: data/key-mapper.glade:1008
#: data/input-remapper.glade:1008
msgid "w"
msgstr "w"
#: data/key-mapper.glade:996
#: data/input-remapper.glade:996
msgid "waits in milliseconds"
msgstr "in attesa (in millisecondi)"
#: data/key-mapper.glade:1164
#: data/input-remapper.glade:1164
msgid "wheel"
msgstr ""
#: data/key-mapper.glade:1385
#: data/input-remapper.glade:1385
msgid "wheel(down, 1)"
msgstr ""
#: data/key-mapper.glade:1360
#: data/input-remapper.glade:1360
msgid "which keeps moving the mouse while pressed"
msgstr "che continua a muovere il mouse mentre viene premuto"
#: data/key-mapper.glade:1323
#: data/input-remapper.glade:1323
msgid "writes 1 2 2 ... 2 2 3 while the key is pressed"
msgstr "scrive 1 2 2 ... 2 2 3 mentre il tasto è premuto"
#: data/key-mapper.glade:1032
#: data/input-remapper.glade:1032
msgid "writes a single keystroke"
msgstr "scrive una singola sequenza di tasti"
#: data/key-mapper.glade:1068
#: data/input-remapper.glade:1068
msgid "writes an event"
msgstr "scrive un evento"
#: data/key-mapper.glade:880
#: data/input-remapper.glade:880
msgid ""
"© 2021 Sezanzeb proxima@sezanzeb.de\n"
"This program comes with absolutely no warranty.\n"

@ -1,6 +1,6 @@
# Slovak translation of key-mapper.
# Slovak translation of input-remapper.
# Copyright (C) 2021.
# This file is distributed under the same license as the key-mapper package.
# This file is distributed under the same license as the input-remapper package.
# Jose Riha <jose 1711 gmail com>, 2021.
#
msgid ""
@ -18,15 +18,15 @@ msgstr ""
"X-Generator: Poedit 3.0\n"
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 ? 1 : 2);\n"
#: data/key-mapper.glade:1128
#: data/input-remapper.glade:1128
msgid "."
msgstr "."
#: data/key-mapper.glade:1348
#: data/input-remapper.glade:1348
msgid "1, 2"
msgstr "1, 2"
#: data/key-mapper.glade:926
#: data/input-remapper.glade:926
msgid ""
"A \"key + key + ... + key\" syntax can be used to trigger key combinations. "
"For example \"control_l + a\".\n"
@ -38,36 +38,36 @@ msgstr ""
"\n"
"\"disable\" deaktivuje mapovanie klávesu."
#: data/key-mapper.glade:898
#: data/input-remapper.glade:898
msgid "About"
msgstr "O programe"
#: data/key-mapper.glade:209
#: data/input-remapper.glade:209
msgid "Apply"
msgstr "Použiť"
#: data/key-mapper.glade:403
#: data/input-remapper.glade:403
msgid "Autoload"
msgstr "Automatické načítanie"
#: data/key-mapper.glade:1420
#: data/input-remapper.glade:1420
msgid ""
"Between calls to k, key down and key up events, macros will sleep for 10ms "
"by default, which can be configured in ~/.config/key-mapper/config"
"by default, which can be configured in ~/.config/input-remapper/config"
msgstr ""
"Medzi volaniami k, udalosťami stlačeného a uvoľneného klávesu štandardne "
"čakajú makrá 10 ms. Toto nastavenie môžete zmeniť v ~/.config/key-mapper/"
"čakajú makrá 10 ms. Toto nastavenie môžete zmeniť v ~/.config/input-remapper/"
"config"
#: data/key-mapper.glade:482 data/key-mapper.glade:526
#: data/input-remapper.glade:482 data/input-remapper.glade:526
msgid "Buttons"
msgstr "Tlačidlá"
#: data/key-mapper.glade:1286
#: data/input-remapper.glade:1286
msgid "CTRL + a, CTRL + x"
msgstr "CTRL + a, CTRL + x"
#: data/key-mapper.glade:706
#: data/input-remapper.glade:706
msgid ""
"Click on a cell below and hit a key on your device. Click the \"Restore "
"Defaults\" button beforehand."
@ -75,92 +75,92 @@ msgstr ""
"Kliknite do poľa nižšie a stlačte tlačidlo na vašom zariadení. Predtým "
"kliknite na tlačidlo \"Obnoviť predvolené\"."
#: data/key-mapper.glade:228
#: data/input-remapper.glade:228
msgid "Copy"
msgstr "Kopírovať"
#: data/key-mapper.glade:265
#: data/input-remapper.glade:265
msgid "Delete"
msgstr "Odstrániť"
#: data/key-mapper.glade:96
#: data/input-remapper.glade:96
msgid "Device"
msgstr "Zariadenie"
#: data/key-mapper.glade:214
#: data/input-remapper.glade:214
msgid "Don't hold down any keys while the injection starts."
msgstr "Nedržte stlačené žiadne tlačidlá kým prebieha injektáž."
#: data/key-mapper.glade:1213
#: data/input-remapper.glade:1213
msgid "Examples"
msgstr "Príklady"
#: data/key-mapper.glade:1604
#: data/input-remapper.glade:1604
msgid "Go Back"
msgstr "Prejsť späť"
#: data/key-mapper.glade:483 data/key-mapper.glade:527
#: data/input-remapper.glade:483 data/input-remapper.glade:527
msgid "Joystick"
msgstr "Joystick"
#: data/key-mapper.glade:709
#: data/input-remapper.glade:709
msgid "Key"
msgstr "Kláves"
#: data/key-mapper.glade:54 data/key-mapper.glade:1583
#: data/key-mapper.glade:1695
msgid "Key Mapper"
#: data/input-remapper.glade:54 data/input-remapper.glade:1583
#: data/input-remapper.glade:1695
msgid "Input Remapper"
msgstr "Mapovač klávesov"
#: data/key-mapper.glade:465
#: data/input-remapper.glade:465
msgid "Left joystick"
msgstr "Ľavý joystick"
#: data/key-mapper.glade:948
#: data/input-remapper.glade:948
msgid "Macros"
msgstr "Makrá"
#: data/key-mapper.glade:964
#: data/input-remapper.glade:964
msgid "Macros allow multiple characters to be written with a single key-press."
msgstr "Makrá vám umožnia zapísať po stlačení jedného klávesu viacero znakov."
#: data/key-mapper.glade:723
#: data/input-remapper.glade:723
msgid "Mapping"
msgstr "Mapovanie"
#: data/key-mapper.glade:480 data/key-mapper.glade:524
#: data/input-remapper.glade:480 data/input-remapper.glade:524
msgid "Mouse"
msgstr "Myš"
#: data/key-mapper.glade:553
#: data/input-remapper.glade:553
msgid "Mouse speed"
msgstr "Citlivosť myši"
#: data/key-mapper.glade:246
#: data/input-remapper.glade:246
msgid "New"
msgstr "Nový"
#: data/key-mapper.glade:298
#: data/input-remapper.glade:298
msgid "Preset"
msgstr "Prednastavenie"
#: data/key-mapper.glade:337
#: data/input-remapper.glade:337
msgid "Rename"
msgstr "Premenovať"
#: data/key-mapper.glade:120
#: data/input-remapper.glade:120
msgid "Restore Defaults"
msgstr "Obnoviť predvolené"
#: data/key-mapper.glade:509
#: data/input-remapper.glade:509
msgid "Right joystick"
msgstr "Pravý joystick"
#: data/key-mapper.glade:368
#: data/input-remapper.glade:368
msgid "Save the entered name"
msgstr "Uložiť zadané meno"
#: data/key-mapper.glade:124
#: data/input-remapper.glade:124
msgid ""
"Shortcut: ctrl + del\n"
"To give your keys back their original mapping."
@ -168,11 +168,11 @@ msgstr ""
"Skratka: ctrl + del\n"
"Pre návrat na pôvodné mapovanie klávesov."
#: data/key-mapper.glade:1556
#: data/input-remapper.glade:1556
msgid "Shortcuts"
msgstr "Skratky"
#: data/key-mapper.glade:1458
#: data/input-remapper.glade:1458
msgid ""
"Shortcuts only work while keys are not being recorded and the gui is in "
"focus."
@ -180,175 +180,175 @@ msgstr ""
"Skratky fungujú iba vtedy, ak sa tlačidlá nenahrávaju a okno programu je "
"aktívne."
#: data/key-mapper.glade:402
#: data/input-remapper.glade:402
msgid "To automatically apply the preset after your login or when it connects."
msgstr ""
"Na automatické použitie prednastavenia po prihlásení alebo pripojení "
"zariadenia."
#: data/key-mapper.glade:1439
#: data/input-remapper.glade:1439
msgid "Usage"
msgstr "Použitie"
#: data/key-mapper.glade:843
#: data/input-remapper.glade:843
msgid "Version unknown"
msgstr "Neznáma verzia"
#: data/key-mapper.glade:481 data/key-mapper.glade:525
#: data/input-remapper.glade:481 data/input-remapper.glade:525
msgid "Wheel"
msgstr "Koliesko"
#: data/key-mapper.glade:860
#: data/input-remapper.glade:860
msgid ""
"You can find more information and report bugs at\n"
"<a href=\"https://github.com/sezanzeb/key-mapper\">https://github.com/"
"sezanzeb/key-mapper</a>"
"<a href=\"https://github.com/sezanzeb/input-remapper\">https://github.com/"
"sezanzeb/input-remapper</a>"
msgstr ""
"Viac informácií a hlásenia chýb nájdete na\n"
"<a href=\"https://github.com/sezanzeb/key-mapper\">https://github.com/"
"sezanzeb/key-mapper</a>"
"<a href=\"https://github.com/sezanzeb/input-remapper\">https://github.com/"
"sezanzeb/input-remapper</a>"
#: data/key-mapper.glade:1248
#: data/input-remapper.glade:1248
msgid "a, a, a with 500ms pause"
msgstr "a, a, a s 500ms oneskorením"
#: data/key-mapper.glade:1490
#: data/input-remapper.glade:1490
msgid "closes the application"
msgstr "zavrie aplikáciu"
#: data/key-mapper.glade:1478
#: data/input-remapper.glade:1478
msgid "ctrl + del"
msgstr "ctrl + del"
#: data/key-mapper.glade:1502
#: data/input-remapper.glade:1502
msgid "ctrl + q"
msgstr "ctrl + q"
#: data/key-mapper.glade:1514
#: data/input-remapper.glade:1514
msgid "ctrl + r"
msgstr "ctrl + r"
#: data/key-mapper.glade:1044
#: data/input-remapper.glade:1044
msgid "e"
msgstr "e"
#: data/key-mapper.glade:1335
#: data/input-remapper.glade:1335
msgid "e(EV_REL, REL_X, 10)"
msgstr "e(EV_REL, REL_X, 10)"
#: data/key-mapper.glade:1104
#: data/input-remapper.glade:1104
msgid "executes the parameter as long as the key is pressed down"
msgstr "vykoná parameter, kým je kláves stlačený"
#: data/key-mapper.glade:1140
#: data/input-remapper.glade:1140
msgid "executes two actions behind each other"
msgstr "vykoná dve akcie za sebou"
#: data/key-mapper.glade:1116
#: data/input-remapper.glade:1116
msgid "h"
msgstr "h"
#: data/key-mapper.glade:1056
#: data/input-remapper.glade:1056
msgid "holds a modifier while executing the second parameter"
msgstr "počas vykonávania druhého parametra je stlačený modifikátor"
#: data/key-mapper.glade:1020
#: data/input-remapper.glade:1020
msgid "k"
msgstr "k"
#: data/key-mapper.glade:1298
#: data/input-remapper.glade:1298
msgid "k(1).h(k(2)).k(3)"
msgstr "k(1).h(k(2)).k(3)"
#: data/key-mapper.glade:1235
#: data/input-remapper.glade:1235
msgid "k(1).k(2)"
msgstr "k(1).k(2)"
#: data/key-mapper.glade:1398
#: data/input-remapper.glade:1398
msgid "keeps scrolling down while held"
msgstr "kým je držaný aktivuje sa skrolovanie smerom nadol"
#: data/key-mapper.glade:1080
#: data/input-remapper.glade:1080
msgid "m"
msgstr "m"
#: data/key-mapper.glade:1273
#: data/input-remapper.glade:1273
msgid "m(Control_L, k(a).k(x))"
msgstr "m(Control_L, k(a).k(x))"
#: data/key-mapper.glade:1152
#: data/input-remapper.glade:1152
msgid "mouse"
msgstr "mouse"
#: data/key-mapper.glade:1372
#: data/input-remapper.glade:1372
msgid "mouse(right, 4)"
msgstr "mouse(right, 4)"
#: data/key-mapper.glade:1311
#: data/input-remapper.glade:1311
msgid "moves the mouse cursor 10px to the right"
msgstr "posunie kurzor myši o 10 pixelov doprava"
#: data/key-mapper.glade:984
#: data/input-remapper.glade:984
msgid "r"
msgstr "r"
#: data/key-mapper.glade:1260
#: data/input-remapper.glade:1260
msgid "r(3, k(a).w(500))"
msgstr "r(3, k(a).w(500))"
#: data/key-mapper.glade:1526
#: data/input-remapper.glade:1526
msgid "refreshes the device list"
msgstr "aktualizuje zoznam zariadení"
#: data/key-mapper.glade:1092
#: data/input-remapper.glade:1092
msgid "repeats the execution of the second parameter"
msgstr "zopakuje spustenie druhého parametra"
#: data/key-mapper.glade:1188
#: data/input-remapper.glade:1188
msgid "same as mouse"
msgstr "tie isté ako pri myši"
#: data/key-mapper.glade:1538
#: data/input-remapper.glade:1538
msgid "stops the injection"
msgstr "zastaví injektáž"
#: data/key-mapper.glade:1176
#: data/input-remapper.glade:1176
msgid "takes direction (up, left, ...) and speed as parameters"
msgstr "prijíma smer (hore, vľavo, ...) a rýchlosť ako parametre"
#: data/key-mapper.glade:1008
#: data/input-remapper.glade:1008
msgid "w"
msgstr "w"
#: data/key-mapper.glade:996
#: data/input-remapper.glade:996
msgid "waits in milliseconds"
msgstr "čakanie (v milisekundách)"
#: data/key-mapper.glade:1164
#: data/input-remapper.glade:1164
msgid "wheel"
msgstr "wheel"
#: data/key-mapper.glade:1385
#: data/input-remapper.glade:1385
msgid "wheel(down, 1)"
msgstr "wheel(down, 1)"
#: data/key-mapper.glade:1360
#: data/input-remapper.glade:1360
msgid "which keeps moving the mouse while pressed"
msgstr "kým je stlačený, kurzor myši sa bude posúvať"
#: data/key-mapper.glade:1323
#: data/input-remapper.glade:1323
msgid "writes 1 2 2 ... 2 2 3 while the key is pressed"
msgstr "zapíše 1 2 2 ... 2 2 3, kým je kláves stlačený"
#: data/key-mapper.glade:1032
#: data/input-remapper.glade:1032
msgid "writes a single keystroke"
msgstr "zapíše jedno stlačenie klávesu"
#: data/key-mapper.glade:1068
#: data/input-remapper.glade:1068
msgid "writes an event"
msgstr "zapíše udalosť"
#: data/key-mapper.glade:880
#: data/input-remapper.glade:880
msgid ""
"© 2021 Sezanzeb proxima@sezanzeb.de\n"
"This program comes with absolutely no warranty.\n"

@ -2,8 +2,8 @@
Contributions are very welcome, I will gladly review and discuss any merge
requests. If you have questions about the code and architecture, feel free
to [open an issue](https://github.com/sezanzeb/key-mapper/issues). This
file should give an overview about some internals of key-mapper.
to [open an issue](https://github.com/sezanzeb/input-remapper/issues). This
file should give an overview about some internals of input-remapper.
All pull requests will at some point require unittests (see below for more
info), the code coverage may only be improved, not decreased. It also has to
@ -47,13 +47,13 @@ be mostly compliant with pylint.
```bash
sudo pip install coverage
pylint keymapper --extension-pkg-whitelist=evdev
sudo pkill -f key-mapper
pylint inputremapper --extension-pkg-whitelist=evdev
sudo pkill -f input-remapper
sudo pip install . && coverage run tests/test.py
coverage combine && coverage report -m
```
To read events, `evtest` is very helpful. Add `-d` to `key-mapper-gtk`
To read events, `evtest` is very helpful. Add `-d` to `input-remapper-gtk`
to get debug output.
Single tests can be executed via
@ -67,9 +67,9 @@ with the gui, which might make tests fail.
## Writing Tests
Tests are in https://github.com/sezanzeb/key-mapper/tree/main/tests
Tests are in https://github.com/sezanzeb/input-remapper/tree/main/tests
https://github.com/sezanzeb/key-mapper/blob/main/tests/test.py patches some modules and runs tests. The tests need
https://github.com/sezanzeb/input-remapper/blob/main/tests/test.py patches some modules and runs tests. The tests need
patches because every environment that runs them will be different. By using patches they all look the same to the
individual tests. Some patches also allow to make some handy assertions, like the `write_history` of `UInput`.
@ -86,7 +86,7 @@ ssh/login into a debian/ubuntu environment
./scripts/build.sh
```
This will generate `key-mapper/deb/key-mapper-1.2.2.deb`
This will generate `input-remapper/deb/input-remapper-1.2.2.deb`
## Badges
@ -102,19 +102,19 @@ just need to be commited.
**gui**
- `bin/key-mapper-gtk` the executable that starts the gui. It also sends
- `bin/input-remapper-gtk` the executable that starts the gui. It also sends
messages to the service via dbus if certain buttons are clicked.
- `bin/key-mapper-helper` provides information to the gui that requires
- `bin/input-remapper-helper` provides information to the gui that requires
root rights. Is stopped when the gui closes.
- `data/key-mapper.policy` configures pkexec. By using auth_admin_keep
- `data/input-remapper.policy` configures pkexec. By using auth_admin_keep
the user is not asked multiple times for each task that needs elevated
rights. This is done instead of granting the whole application root rights
because it is [considered problematic](https://wiki.archlinux.org/index.php/Running_GUI_applications_as_root).
- `data/key-mapper.desktop` is the entry in the start menu
- `data/input-remapper.desktop` is the entry in the start menu
**cli**
- `bin/key-mapper-control` is an executable to send messages to the service
- `bin/input-remapper-control` is an executable to send messages to the service
via dbus. It can be used to start and stop injection without a GUI.
The gui also uses it to run the service (if not already running) and
helper, because by using one single command for both the polkit rules file
@ -122,37 +122,37 @@ just need to be commited.
**service**
- `bin/key-mapper-service` executable that starts listening for
- `bin/input-remapper-service` executable that starts listening for
commands via dbus and runs the injector when needed. It shouldn't matter how
it is started as long as it manages to start without throwing errors. It
usually needs root rights.
- `data/key-mapper.service` starts key-mapper-service automatically on boot
- `data/input-remapper.service` starts input-remapper-service automatically on boot
on distros using systemd.
- `data/keymapper.Control.conf` is needed to connect to dbus services started
- `data/inputremapper.Control.conf` is needed to connect to dbus services started
by systemd from other applications.
**autoload**
- `data/key-mapper-autoload.desktop` executes on login and tells the systemd
- `data/input-remapper-autoload.desktop` executes on login and tells the systemd
service to stop injecting (possibly the presets of another user) and to
inject the users autoloaded presets instead (if any are configured)
- `data/key-mapper.rules` udev rule that sends a message to the service to
- `data/input-remapper.rules` udev rule that sends a message to the service to
start injecting for new devices when they are seen for the first time.
**Example system startup**
1. systemd loads `key-mapper.service` on boot
2. on login, `key-mapper-autoload.desktop` is executed, which has knowledge
1. systemd loads `input-remapper.service` on boot
2. on login, `input-remapper-autoload.desktop` is executed, which has knowledge
of the current user und doesn't run as root
2.1 it sends the users config directory to the service
2.2 it makes the service stop all ongoing injectings
2.3 it tells the service to start loading all of the configured presets
3. a bluetooth device gets connected, so udev runs `key-mapper.rules` which
3. a bluetooth device gets connected, so udev runs `input-remapper.rules` which
tells the service to start injecting for that device if it has a preset
assigned. Works because step 2 told the service about the current users
config.
Communication to the service always happens via `key-mapper-control`
Communication to the service always happens via `input-remapper-control`
## Permissions
@ -205,20 +205,20 @@ It uses evdev. The links below point to the 1.0.0 release, line numbers might ha
1. It grabs a device (e.g. /dev/input/event3), so that the key events won't
reach X11/Wayland anymore
[source](https://github.com/sezanzeb/key-mapper/blob/1.0.0/keymapper/injection/injector.py#L197)
[source](https://github.com/sezanzeb/input-remapper/blob/1.0.0/inputremapper/injection/injector.py#L197)
2. Reads the events from it (`evtest` can do it, you can also do
`cat /dev/input/event3` which yields binary stuff)
[source](https://github.com/sezanzeb/key-mapper/blob/1.0.0/keymapper/injection/injector.py#L443)
[source](https://github.com/sezanzeb/input-remapper/blob/1.0.0/inputremapper/injection/injector.py#L443)
3. Looks up the mapping if that event maps to anything
[source](https://github.com/sezanzeb/key-mapper/blob/1.0.0/keymapper/injection/keycode_mapper.py#L434)
4. Injects the output event in a new device that key-mapper created (another
[source](https://github.com/sezanzeb/input-remapper/blob/1.0.0/inputremapper/injection/keycode_mapper.py#L434)
4. Injects the output event in a new device that input-remapper created (another
new path in /dev/input, device name is suffixed by "mapped")
[source](https://github.com/sezanzeb/key-mapper/blob/1.0.0/keymapper/injection/keycode_mapper.py#L242),
[new device](https://github.com/sezanzeb/key-mapper/blob/1.0.0/keymapper/injection/injector.py#L356)
[source](https://github.com/sezanzeb/input-remapper/blob/1.0.0/inputremapper/injection/keycode_mapper.py#L242),
[new device](https://github.com/sezanzeb/input-remapper/blob/1.0.0/inputremapper/injection/injector.py#L356)
5. Forwards any events that should not be mapped to anything in another new
device (device name is suffixed by "forwarded")
[source](https://github.com/sezanzeb/key-mapper/blob/1.0.0/keymapper/injection/keycode_mapper.py#L247),
[new device](https://github.com/sezanzeb/key-mapper/blob/1.0.0/keymapper/injection/injector.py#L367)
[source](https://github.com/sezanzeb/input-remapper/blob/1.0.0/inputremapper/injection/keycode_mapper.py#L247),
[new device](https://github.com/sezanzeb/input-remapper/blob/1.0.0/inputremapper/injection/injector.py#L367)
This stuff is going on as a daemon in the background
@ -231,20 +231,20 @@ a -> x
a + b -> y
```
1. the `a` button is pressed with your finger, `a 1` arrives via evdev in key-mapper
2. key-mapper maps it to `x 1` and injects it
3. `b` is pressed with your finger, `b 1` arrives via evdev in key-mapper
4. key-mapper sees a triggered combination and maps it to `y 1` and injects it
5. `b` is released, `b 0` arrives at key-mapper
6. key-mapper remembered that it was the trigger for a combination and maps that release to `y 0` and injects it
7. the `a` button is released, `a 0` arrives at key-mapper
8. key-mapper maps that release to `x 0` and injects it
1. the `a` button is pressed with your finger, `a 1` arrives via evdev in input-remapper
2. input-remapper maps it to `x 1` and injects it
3. `b` is pressed with your finger, `b 1` arrives via evdev in input-remapper
4. input-remapper sees a triggered combination and maps it to `y 1` and injects it
5. `b` is released, `b 0` arrives at input-remapper
6. input-remapper remembered that it was the trigger for a combination and maps that release to `y 0` and injects it
7. the `a` button is released, `a 0` arrives at input-remapper
8. input-remapper maps that release to `x 0` and injects it
## Multiple sources, single UInput
https://github.com/sezanzeb/key-mapper/blob/1.0.0/keymapper/injection/injector.py
https://github.com/sezanzeb/input-remapper/blob/1.0.0/inputremapper/injection/injector.py
This "Injector" process is the only process that injects if key-mapper is used for a single device.
This "Injector" process is the only process that injects if input-remapper is used for a single device.
Inside `run` of that process there is an iteration of `for source in sources:`,
which runs an event loop for each possible source for events.
@ -256,16 +256,16 @@ Consider this typical example of device capabilities:
- "BrandXY Mouse" -> KEY_1, KEY_2
There are two devices called "BrandXY Mouse", and they report different events.
Key-mapper creates a single uinput to inject all mapped events to. For example
Input-remapper creates a single uinput to inject all mapped events to. For example
- BTN_LEFT -> a
- KEY_2 -> b
so you end up with a new device with the following capabilities
"key-mapper BrandXY Mouse mapped" -> KEY_A, KEY_B
"input-remapper BrandXY Mouse mapped" -> KEY_A, KEY_B
while key-mapper reads from multiple InputDevices it injects the mapped letters into a single UInput.
while input-remapper reads from multiple InputDevices it injects the mapped letters into a single UInput.
## Resources

@ -143,7 +143,7 @@ for available symbols.
```
xmodmap keyboard_layout
key-mapper-gtk
input-remapper-gtk
```
"kana_YA" should be in the dropdown of available symbols now. Map it

@ -1,4 +1,4 @@
# Why does key-mapper not use xkb configs?
# Why does input-remapper not use xkb configs?
**Initial target** You write a symbols file based on your specified mapping,
and that's pretty much it. There were two mappings: The first one is in the
@ -11,9 +11,9 @@ pressing that mouse button and that keyboard button at the same time.
This was quite mature, pretty much finished and tested.
It still exists in the [first](https://github.com/sezanzeb/key-mapper/tree/first) branch
It still exists in the [first](https://github.com/sezanzeb/input-remapper/tree/first) branch
**The second idea** was to write special keycodes known only to key-mapper
**The second idea** was to write special keycodes known only to input-remapper
(256 - 511) into the input device of your mouse in /dev/input, and map
those to SHIFT and such, whenever a button is clicked. A mapping would have
existed to prevent the original keycode 10 from writing a 1. But this device
@ -21,15 +21,15 @@ doesn't have the capabilities set for those keycodes, so it won't use them.
At that time I didn't know about capabilities though.
**The third idea** is to create a new input device that uses 8 - 255, just
like other layouts, and key-mapper always tries to use the same keycodes for
like other layouts, and input-remapper always tries to use the same keycodes for
SHIFT as already used in the system default. The pipeline is like this:
1. A human thumb presses an extra-button of the device "mouse"
2. key-mapper uses evdev to get the event from "mouse", sees "ahh, it's a
2. input-remapper uses evdev to get the event from "mouse", sees "ahh, it's a
10, I know that one and will now write 50 into my own device". 50 is
the keycode for SHIFT on my regular keyboard, so it won't clash anymore
with alphanumeric keys and such.
3. X has key-mappers configs for the key-mapper device loaded and
3. X has input-remappers configs for the input-remapper device loaded and
checks in it's keycodes config file "50, that would be <50>", then looks
into it's symbols config "<50> is mapped to SHIFT", and then it actually
presses the SHIFT down to modify all other future buttons.
@ -43,15 +43,15 @@ long
**Fourth idea**: Based on the second idea, instead of using keycodes greater
than 255, use unused keycodes starting from 255, going down. For example
pressing key 10 triggers key-mapper to write key 253 into the /dev device
pressing key 10 triggers input-remapper to write key 253 into the /dev device
while mapping key 10 to nothing. This has the same problem, the device
capabilities ignore many of those keycodes. 140 works, 145 won't, 150 works.
**Fifth idea**: Instead of writing xkb symbol files, just disable all
mouse buttons with a single symbol file. Key-mapper listens for key events
mouse buttons with a single symbol file. Input-remapper listens for key events
in /dev and then writes the mapped keycode into a new device in /dev. For
example, if 10 should be mapped to Shift_L, xkb configs would disable
key 10 and key-mapper would write 50 into /dev, which is Shift_L in the system
key 10 and input-remapper would write 50 into /dev, which is Shift_L in the system
mapping. This sounds incredibly simple and makes me throw away tons of code.
But somehow writing into the new /dev file makes the original keycode
@ -80,18 +80,18 @@ the new /dev device. The KB1 keycode comes first and is then realized as
Which means in order to prevent "!!!!!!" being written while holding down
keycode 10 on the mouse, which is supposed to be shift, the 10 of the
key-mapper /dev node has to be mapped to none as well. But that would
input-remapper /dev node has to be mapped to none as well. But that would
prevent a key that is mapped to "1", which translates to 10, from working.
So instead of using the output from xmodmap to determine the correct
keycode, use a custom mapping that starts at 255 and just offsets xmodmap
by 255. The correct capabilities need to exist this time. Everything below
255 is disabled. This mapping is applied to key-mappers custom /dev node.
255 is disabled. This mapping is applied to input-remappers custom /dev node.
However, if you try to map Shift to button 10 of your mouse, and use
mouse-shift + keyboard-1, you need to press keyboard-1 again to do anything.
I assume this is because:
- mouse-10 down
- keymapper says: 50 down
- inputremapper says: 50 down
- xkb mapping: 10 is none. 50 is shift.
- keyboard-10 down (down again? X/Linux ignores that)
- keyboard-10 up
@ -109,7 +109,7 @@ configurations are needed at all anymore.
This solution would have made the macro thing impossible though
setxkbmap -layout ~/.config/key-mapper/mouse -Foo Device3
setxkbmap -layout ~/.config/input-remapper/mouse -Foo Device3
config looks like:
```

@ -1,6 +1,6 @@
# Macros
key-mapper comes with an optional custom macro language with support for cross-device
input-remapper comes with an optional custom macro language with support for cross-device
variables, conditions and named parameters.
Syntax errors are shown in the UI on save. Each `k` function adds a short delay of 10ms

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

@ -1,9 +1,9 @@
# Usage
To open the UI to modify the mappings, look into your applications menu
and search for 'Key Mapper'. You should be prompted for your sudo password
and search for 'Input Remapper'. You should be prompted for your sudo password
as special permissions are needed to read events from `/dev/input/` files.
You can also start it via `key-mapper-gtk`.
You can also start it via `input-remapper-gtk`.
<p align="center">
<img src="usage_1.png"/>
@ -25,12 +25,12 @@ invisible since the daemon maps it independently of the GUI.
## Troubleshooting
If stuff doesn't work, check the output of `key-mapper-gtk -d` and feel free
to [open up an issue here](https://github.com/sezanzeb/key-mapper/issues/new).
If stuff doesn't work, check the output of `input-remapper-gtk -d` and feel free
to [open up an issue here](https://github.com/sezanzeb/input-remapper/issues/new).
Make sure to not post any debug logs that were generated while you entered
private information with your device. Debug logs are quite verbose.
If key-mapper or your presets prevents your input device from working
If input-remapper or your presets prevents your input device from working
at all due to autoload, please try to unplug and plug it in twice.
No injection should be running anymore.
@ -85,10 +85,10 @@ names can be chained using ` + `.
## Key Names
Check the autocompletion of the GUI for possible values. You can also
obtain a complete list of possiblities using `key-mapper-control --symbol-names`.
obtain a complete list of possiblities using `input-remapper-control --symbol-names`.
Key-mapper only recognizes symbol names, but not the symbols themselfes. So for
example, key-mapper might (depending on the system layout) know what a `minus` is, but
Input-remapper only recognizes symbol names, but not the symbols themselfes. So for
example, input-remapper might (depending on the system layout) know what a `minus` is, but
it doesn't know `-`.
Key names that start with `KEY_` are keyboard layout independent constants that might
@ -98,20 +98,20 @@ correctly result in "y" to be written.
## Limitations
**If your fingers can't type it on your keyboard, key-mapper can't inject it.**
**If your fingers can't type it on your keyboard, input-remapper can't inject it.**
The available symbols depend on the environments keyboard layout, and only those that
don't require a combination to be pressed can be used without workarounds (so most
special characters need some extra steps to use them). Furthermore, if your configured
keyboard layout doesn't support the special character at all (not even via a
combination), then it also won't be possible for key-mapper to map that character at
combination), then it also won't be possible for input-remapper to map that character at
all.
For example, mapping a key to an exclamation mark is not possible if the keyboard
layout is set to german. However, it is possible to mimic the combination that would
be required to write it, by writing `Shift_L + 1` into the mapping.
This is because key-mapper creates a new virtual keyboard and injects numeric keycodes,
This is because input-remapper creates a new virtual keyboard and injects numeric keycodes,
and it won't be able to inject anything a usb keyboard wouldn't been able to. This has
the benefit of being compatible to all display servers, but means the environment will
ultimately decide which character to write.
@ -130,7 +130,7 @@ ultimately decide which character to write.
If you don't have a graphical user interface, you'll need to edit the
configuration files.
The default configuration is stored at `~/.config/key-mapper/config.json`,
The default configuration is stored at `~/.config/input-remapper/config.json`,
which doesn't include any mappings, but rather other parameters that
are interesting for injections. The current default configuration as of 1.2.1
looks like, with an example autoload entry:
@ -156,12 +156,12 @@ looks like, with an example autoload entry:
}
```
`preset name` refers to `~/.config/key-mapper/presets/device name/preset name.json`.
The device name can be found with `sudo key-mapper-control --list-devices`.
`preset name` refers to `~/.config/input-remapper/presets/device name/preset name.json`.
The device name can be found with `sudo input-remapper-control --list-devices`.
Anything that is relevant to presets can be overwritten in them as well.
Here is an example configuration for preset "a" for the "gamepad" device:
`~/.config/key-mapper/presets/gamepad/a.json`
`~/.config/input-remapper/presets/gamepad/a.json`
```json
{
@ -182,39 +182,39 @@ consists of two events: down and up. The other mapping is a key combination,
chained using `+`.
Other than that, it inherits all configurations from
`~/.config/key-mapper/config.json`. If config.json is missing some stuff,
`~/.config/input-remapper/config.json`. If config.json is missing some stuff,
it will query the hardcoded default values.
The event codes can be read using `evtest`. Available names in the mapping
can be listed with `key-mapper-control --symbol-names`.
can be listed with `input-remapper-control --symbol-names`.
## CLI
**key-mapper-control**
**input-remapper-control**
`--command` requires the service to be running. You can start it via
`systemctl start key-mapper` or `sudo key-mapper-service` if it isn't already
`systemctl start input-remapper` or `sudo input-remapper-service` if it isn't already
running (or without sudo if your user has the appropriate permissions).
Examples:
| Description | Command |
|-----------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------|
| Load all configured presets for all devices | `key-mapper-control --command autoload` |
| If you are running as root user, provide information about the whereabouts of the key-mapper config | `key-mapper-control --command autoload --config-dir "~/.config/key-mapper/"` |
| List available device names for the `--device` parameter | `sudo key-mapper-control --list-devices` |
| Stop injecting | `key-mapper-control --command stop --device "Razer Razer Naga Trinity"` |
| Load `~/.config/key-mapper/presets/Razer Razer Naga Trinity/a.json` | `key-mapper-control --command start --device "Razer Razer Naga Trinity" --preset "a"` |
| Loads the configured preset for whatever device is using this /dev path | `/bin/key-mapper-control --command autoload --device /dev/input/event5` |
| Load all configured presets for all devices | `input-remapper-control --command autoload` |
| If you are running as root user, provide information about the whereabouts of the input-remapper config | `input-remapper-control --command autoload --config-dir "~/.config/input-remapper/"` |
| List available device names for the `--device` parameter | `sudo input-remapper-control --list-devices` |
| Stop injecting | `input-remapper-control --command stop --device "Razer Razer Naga Trinity"` |
| Load `~/.config/input-remapper/presets/Razer Razer Naga Trinity/a.json` | `input-remapper-control --command start --device "Razer Razer Naga Trinity" --preset "a"` |
| Loads the configured preset for whatever device is using this /dev path | `/bin/input-remapper-control --command autoload --device /dev/input/event5` |
**systemctl**
Stopping the service will stop all ongoing injections
```bash
sudo systemctl stop key-mapper
sudo systemctl start key-mapper
systemctl status key-mapper
sudo systemctl stop input-remapper
sudo systemctl start input-remapper
systemctl status input-remapper
```
## Testing your Installation
@ -222,15 +222,15 @@ systemctl status key-mapper
The following commands can be used to make sure it works:
```bash
sudo key-mapper-service &
key-mapper-control --command hello
sudo input-remapper-service &
input-remapper-control --command hello
```
should print `Daemon answered with "hello"`. And
```bash
sudo key-mapper-control --list-devices
sudo input-remapper-control --list-devices
```
should print `Found "...", ...`. If anything looks wrong, feel free to [create
an issue](https://github.com/sezanzeb/key-mapper/issues/new).
an issue](https://github.com/sezanzeb/input-remapper/issues/new).

@ -14,7 +14,7 @@ coverage_badge() {
}
pylint_badge() {
pylint_output=$(pylint keymapper --extension-pkg-whitelist=evdev)
pylint_output=$(pylint inputremapper --extension-pkg-whitelist=evdev)
rating=$(echo $pylint_output | grep -Po "rated at .+?/" | grep -Po "\d+.\d+")
rm readme/pylint.svg
anybadge -l pylint -v $rating -f readme/pylint.svg pylint

@ -9,8 +9,8 @@ build_deb() {
mv build/deb/usr/local/lib/python3.*/ build/deb/usr/lib/python3/
cp ./DEBIAN build/deb/ -r
mkdir dist -p
rm dist/key-mapper-1.2.2.deb || true
dpkg -b build/deb dist/key-mapper-1.2.2.deb
rm dist/input-remapper-1.2.2.deb || true
dpkg -b build/deb dist/input-remapper-1.2.2.deb
}
build_deb &

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
import glob
@ -40,9 +40,9 @@ class Install(install):
if re.match(r"^([a-z]|[0-9])+$", commit):
# for whatever reason different systems have different paths here
build_dir = ""
if os.path.exists("build/lib/keymapper"):
if os.path.exists("build/lib/inputremapper"):
build_dir = "build/lib/"
with open(f"{build_dir}keymapper/commit_hash.py", "w+") as f:
with open(f"{build_dir}inputremapper/commit_hash.py", "w+") as f:
f.write(f"COMMIT_HASH = '{commit}'\n")
except Exception as e:
print("Failed to save the commit hash:", e)
@ -53,10 +53,10 @@ class Install(install):
install.run(self)
def get_packages(base="keymapper"):
"""Return all modules used in key-mapper.
def get_packages(base="inputremapper"):
"""Return all modules used in input-remapper.
For example 'keymapper.gui' or 'keymapper.injection.consumers'
For example 'inputremapper.gui' or 'inputremapper.injection.consumers'
"""
if not os.path.exists(os.path.join(base, "__init__.py")):
# only python modules
@ -84,7 +84,7 @@ def make_lang():
os.makedirs(join("mo", lang), exist_ok=True)
print(f"generating translation for {lang}")
subprocess.run(
["msgfmt", "-o", join("mo", lang, "key-mapper.mo"), str(po_file)],
["msgfmt", "-o", join("mo", lang, "input-remapper.mo"), str(po_file)],
check=True,
)
@ -93,34 +93,38 @@ lang_data = []
for po_file in glob.glob(PO_FILES):
lang = splitext(basename(po_file))[0]
lang_data.append(
(f"/usr/share/key-mapper/lang/{lang}/LC_MESSAGES", [f"mo/{lang}/key-mapper.mo"])
(f"/usr/share/input-remapper/lang/{lang}/LC_MESSAGES", [f"mo/{lang}/input-remapper.mo"])
)
setup(
name="key-mapper",
name="input-remapper",
version="1.2.2",
description="A tool to change the mapping of your input device buttons",
author="Sezanzeb",
author_email="proxima@sezanzeb.de",
url="https://github.com/sezanzeb/key-mapper",
url="https://github.com/sezanzeb/input-remapper",
license="GPL-3.0",
packages=get_packages(),
include_package_data=True,
data_files=[
# see development.md#files
*lang_data,
("/usr/share/key-mapper/", glob.glob("data/*")),
("/usr/share/applications/", ["data/key-mapper.desktop"]),
("/usr/share/polkit-1/actions/", ["data/key-mapper.policy"]),
("/usr/lib/systemd/system", ["data/key-mapper.service"]),
("/etc/dbus-1/system.d/", ["data/keymapper.Control.conf"]),
("/etc/xdg/autostart/", ["data/key-mapper-autoload.desktop"]),
("/usr/lib/udev/rules.d", ["data/99-key-mapper.rules"]),
("/usr/share/input-remapper/", glob.glob("data/*")),
("/usr/share/applications/", ["data/input-remapper.desktop"]),
("/usr/share/polkit-1/actions/", ["data/input-remapper.policy"]),
("/usr/lib/systemd/system", ["data/input-remapper.service"]),
("/etc/dbus-1/system.d/", ["data/inputremapper.Control.conf"]),
("/etc/xdg/autostart/", ["data/input-remapper-autoload.desktop"]),
("/usr/lib/udev/rules.d", ["data/99-input-remapper.rules"]),
("/usr/bin/", ["bin/input-remapper-gtk"]),
("/usr/bin/", ["bin/input-remapper-service"]),
("/usr/bin/", ["bin/input-remapper-control"]),
("/usr/bin/", ["bin/input-remapper-helper"]),
# those will be deleted at some point:
("/usr/bin/", ["bin/key-mapper-gtk"]),
("/usr/bin/", ["bin/key-mapper-service"]),
("/usr/bin/", ["bin/key-mapper-control"]),
("/usr/bin/", ["bin/key-mapper-helper"]),
],
install_requires=[
"setuptools",

@ -1,25 +1,25 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Sets up key-mapper for the tests and runs them."""
"""Sets up input-remapper for the tests and runs them."""
import os
@ -56,7 +56,7 @@ def grey_log(*msgs):
def is_service_running():
"""Check if the daemon is running."""
try:
subprocess.check_output(["pgrep", "-f", "key-mapper-service"])
subprocess.check_output(["pgrep", "-f", "input-remapper-service"])
return True
except subprocess.CalledProcessError:
return False
@ -102,7 +102,7 @@ MIN_ABS = -(2 ** 15)
MAX_ABS = 2 ** 15
tmp = "/tmp/key-mapper-test"
tmp = "/tmp/input-remapper-test"
uinput_write_history = []
# for tests that makes the injector create its processes
uinput_write_history_pipe = multiprocessing.Pipe()
@ -122,7 +122,7 @@ def read_write_history_pipe():
return history
# key-mapper is only interested in devices that have EV_KEY, add some
# input-remapper is only interested in devices that have EV_KEY, add some
# random other stuff to test that they are ignored.
phys_foo = "usb-0000:03:00.0-1/input2"
info_foo = evdev.device.DeviceInfo(1, 1, 1, 1)
@ -210,13 +210,13 @@ fixtures = {
"info": evdev.device.DeviceInfo(4, 1, 4, 1),
"name": "Power Button",
},
# key-mapper devices are not displayed in the ui, some instance
# of key-mapper started injecting apparently.
# input-remapper devices are not displayed in the ui, some instance
# of input-remapper started injecting apparently.
"/dev/input/event40": {
"capabilities": {evdev.ecodes.EV_KEY: keyboard_keys},
"phys": "key-mapper/input1",
"phys": "input-remapper/input1",
"info": evdev.device.DeviceInfo(5, 1, 5, 1),
"name": "key-mapper Bar Device",
"name": "input-remapper Bar Device",
},
# denylisted
"/dev/input/event51": {
@ -282,9 +282,9 @@ def new_event(type, code, value, timestamp=None, offset=0):
def patch_paths():
from keymapper import paths
from inputremapper import paths
paths.CONFIG_PATH = "/tmp/key-mapper-test"
paths.CONFIG_PATH = "/tmp/input-remapper-test"
class InputDevice:
@ -511,19 +511,19 @@ patch_events()
patch_os_system()
patch_check_output()
from keymapper.logger import update_verbosity
from inputremapper.logger import update_verbosity
update_verbosity(True)
from keymapper.injection.injector import Injector
from keymapper.config import config
from keymapper.gui.reader import reader
from keymapper.groups import groups
from keymapper.system_mapping import system_mapping
from keymapper.gui.custom_mapping import custom_mapping
from keymapper.paths import get_config_path
from keymapper.injection.macros.macro import macro_variables
from keymapper.injection.consumers.keycode_mapper import active_macros, unreleased
from inputremapper.injection.injector import Injector
from inputremapper.config import config
from inputremapper.gui.reader import reader
from inputremapper.groups import groups
from inputremapper.system_mapping import system_mapping
from inputremapper.gui.custom_mapping import custom_mapping
from inputremapper.paths import get_config_path
from inputremapper.injection.macros.macro import macro_variables
from inputremapper.injection.consumers.keycode_mapper import active_macros, unreleased
# no need for a high number in tests
Injector.regrab_timeout = 0.05
@ -634,8 +634,8 @@ def cleanup():
"""
print("cleanup")
os.system("pkill -f key-mapper-service")
os.system("pkill -f key-mapper-control")
os.system("pkill -f input-remapper-service")
os.system("pkill -f input-remapper-control")
time.sleep(0.05)
quick_cleanup(log=False)

@ -1,30 +1,30 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
import os
import unittest
from keymapper.config import config, GlobalConfig
from keymapper.paths import touch, CONFIG_PATH
from keymapper.logger import logger
from inputremapper.config import config, GlobalConfig
from inputremapper.paths import touch, CONFIG_PATH
from inputremapper.logger import logger
from tests.test import quick_cleanup, tmp

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
import unittest
@ -25,16 +25,16 @@ import asyncio
import evdev
from evdev.ecodes import EV_KEY, EV_ABS, ABS_Y, EV_REL
from keymapper.injection.consumers.keycode_mapper import active_macros
from keymapper.config import BUTTONS, MOUSE, WHEEL
from inputremapper.injection.consumers.keycode_mapper import active_macros
from inputremapper.config import BUTTONS, MOUSE, WHEEL
from keymapper.injection.context import Context
from keymapper.mapping import Mapping
from keymapper.key import Key
from keymapper.injection.consumer_control import ConsumerControl, consumer_classes
from keymapper.injection.consumers.consumer import Consumer
from keymapper.injection.consumers.keycode_mapper import KeycodeMapper
from keymapper.system_mapping import system_mapping
from inputremapper.injection.context import Context
from inputremapper.mapping import Mapping
from inputremapper.key import Key
from inputremapper.injection.consumer_control import ConsumerControl, consumer_classes
from inputremapper.injection.consumers.consumer import Consumer
from inputremapper.injection.consumers.keycode_mapper import KeycodeMapper
from inputremapper.system_mapping import system_mapping
from tests.test import new_event, quick_cleanup

@ -1,31 +1,31 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
import unittest
from keymapper.injection.context import Context
from keymapper.mapping import Mapping
from keymapper.key import Key
from keymapper.config import NONE, MOUSE, WHEEL, BUTTONS
from keymapper.system_mapping import system_mapping
from inputremapper.injection.context import Context
from inputremapper.mapping import Mapping
from inputremapper.key import Key
from inputremapper.config import NONE, MOUSE, WHEEL, BUTTONS
from inputremapper.system_mapping import system_mapping
from tests.test import quick_cleanup

@ -1,25 +1,25 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
"""Testing the key-mapper-control command"""
"""Testing the input-remapper-control command"""
import os
@ -30,21 +30,21 @@ import collections
from importlib.util import spec_from_loader, module_from_spec
from importlib.machinery import SourceFileLoader
from keymapper.gui.custom_mapping import custom_mapping
from keymapper.config import config
from keymapper.daemon import Daemon
from keymapper.mapping import Mapping
from keymapper.paths import get_preset_path
from keymapper.groups import groups
from inputremapper.gui.custom_mapping import custom_mapping
from inputremapper.config import config
from inputremapper.daemon import Daemon
from inputremapper.mapping import Mapping
from inputremapper.paths import get_preset_path
from inputremapper.groups import groups
from tests.test import quick_cleanup, tmp
def import_control():
"""Import the core function of the key-mapper-control command."""
"""Import the core function of the input-remapper-control command."""
custom_mapping.empty()
bin_path = os.path.join(os.getcwd(), "bin", "key-mapper-control")
bin_path = os.path.join(os.getcwd(), "bin", "input-remapper-control")
loader = SourceFileLoader("__not_main_idk__", bin_path)
spec = spec_from_loader("__not_main_idk__", loader)
@ -300,13 +300,13 @@ class TestControl(unittest.TestCase):
with mock.patch("os.system") as os_system_patch:
internals(options("helper", None, None, None, False, False, False))
os_system_patch.assert_called_once()
self.assertIn("key-mapper-helper", os_system_patch.call_args.args[0])
self.assertIn("input-remapper-helper", os_system_patch.call_args.args[0])
self.assertNotIn("-d", os_system_patch.call_args.args[0])
with mock.patch("os.system") as os_system_patch:
internals(options("start-daemon", None, None, None, False, False, True))
os_system_patch.assert_called_once()
self.assertIn("key-mapper-service", os_system_patch.call_args.args[0])
self.assertIn("input-remapper-service", os_system_patch.call_args.args[0])
self.assertIn("-d", os_system_patch.call_args.args[0])

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
import os
@ -31,15 +31,15 @@ from evdev.ecodes import EV_KEY, EV_ABS, KEY_B, KEY_A
from gi.repository import Gtk
from pydbus import SystemBus
from keymapper.system_mapping import system_mapping
from keymapper.gui.custom_mapping import custom_mapping
from keymapper.config import config
from keymapper.groups import groups
from keymapper.paths import get_config_path, mkdir, get_preset_path
from keymapper.key import Key
from keymapper.mapping import Mapping
from keymapper.injection.injector import STARTING, RUNNING, STOPPED, UNKNOWN
from keymapper.daemon import Daemon, BUS_NAME
from inputremapper.system_mapping import system_mapping
from inputremapper.gui.custom_mapping import custom_mapping
from inputremapper.config import config
from inputremapper.groups import groups
from inputremapper.paths import get_config_path, mkdir, get_preset_path
from inputremapper.key import Key
from inputremapper.mapping import Mapping
from inputremapper.injection.injector import STARTING, RUNNING, STOPPED, UNKNOWN
from inputremapper.daemon import Daemon, BUS_NAME
from tests.test import (
cleanup,
@ -61,7 +61,7 @@ def gtk_iteration():
class TestDBusDaemon(unittest.TestCase):
def setUp(self):
self.process = multiprocessing.Process(
target=os.system, args=("key-mapper-service -d",)
target=os.system, args=("input-remapper-service -d",)
)
self.process.start()
time.sleep(0.5)
@ -72,7 +72,7 @@ class TestDBusDaemon(unittest.TestCase):
def tearDown(self):
self.interface.stop_all()
os.system("pkill -f key-mapper-service")
os.system("pkill -f input-remapper-service")
for _ in range(10):
time.sleep(0.1)
@ -448,7 +448,7 @@ class TestDaemon(unittest.TestCase):
len_after = len(self.daemon.autoload_history._autoload_history)
self.assertEqual(len_before, len_after)
# autoloading key-mapper devices does nothing
# autoloading input-remapper devices does nothing
len_before = len(self.daemon.autoload_history._autoload_history)
self.daemon.autoload_single("Bar Device")
len_after = len(self.daemon.autoload_history._autoload_history)

@ -1,47 +1,47 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
import unittest
import os
import pkg_resources
from keymapper.data import get_data_path
from inputremapper.data import get_data_path
class TestData(unittest.TestCase):
def test_data_editable(self):
path = os.getcwd()
pkg_resources.require("key-mapper")[0].location = path
pkg_resources.require("input-remapper")[0].location = path
self.assertEqual(get_data_path(), path + "/data/")
self.assertEqual(get_data_path("a"), path + "/data/a")
def test_data_usr(self):
path = "/usr/some/where/python3.8/dist-packages/"
pkg_resources.require("key-mapper")[0].location = path
pkg_resources.require("input-remapper")[0].location = path
self.assertTrue(get_data_path().startswith("/usr/"))
self.assertTrue(get_data_path().endswith("key-mapper/"))
self.assertTrue(get_data_path().endswith("input-remapper/"))
self.assertTrue(get_data_path("a").startswith("/usr/"))
self.assertTrue(get_data_path("a").endswith("key-mapper/a"))
self.assertTrue(get_data_path("a").endswith("input-remapper/a"))
if __name__ == "__main__":

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
import unittest
@ -33,9 +33,9 @@ from evdev.ecodes import (
REL_HWHEEL,
)
from keymapper.config import config, BUTTONS
from keymapper.mapping import Mapping
from keymapper import utils
from inputremapper.config import config, BUTTONS
from inputremapper.mapping import Mapping
from inputremapper import utils
from tests.test import new_event, InputDevice, MAX_ABS, MIN_ABS

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
import unittest
@ -35,10 +35,10 @@ from evdev.ecodes import (
ABS_RY,
)
from keymapper.config import config
from keymapper.mapping import Mapping
from keymapper.injection.context import Context
from keymapper.injection.consumers.joystick_to_mouse import (
from inputremapper.config import config
from inputremapper.mapping import Mapping
from inputremapper.injection.context import Context
from inputremapper.injection.consumers.joystick_to_mouse import (
JoystickToMouse,
MOUSE,
WHEEL,

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
import os
@ -26,8 +26,8 @@ import json
import evdev
from evdev.ecodes import EV_KEY, KEY_A
from keymapper.paths import CONFIG_PATH
from keymapper.groups import (
from inputremapper.paths import CONFIG_PATH
from inputremapper.groups import (
_FindGroups,
groups,
classify,
@ -120,9 +120,9 @@ class TestGroups(unittest.TestCase):
json.dumps(
{
"paths": ["/dev/input/event40"],
"names": ["key-mapper Bar Device"],
"names": ["input-remapper Bar Device"],
"types": [KEYBOARD],
"key": "key-mapper Bar Device",
"key": "input-remapper Bar Device",
}
),
]
@ -130,7 +130,7 @@ class TestGroups(unittest.TestCase):
)
groups2 = json.dumps(
[group.dumps() for group in groups.filter(include_keymapper=True)]
[group.dumps() for group in groups.filter(include_inputremapper=True)]
)
self.assertEqual(pipe.groups, groups2)
@ -146,11 +146,11 @@ class TestGroups(unittest.TestCase):
)
def test_filter(self):
# by default no key-mapper devices are present
# by default no input-remapper devices are present
filtered = groups.filter()
keys = [group.key for group in filtered]
self.assertIn("Foo Device 2", keys)
self.assertNotIn("key-mapper Bar Device", keys)
self.assertNotIn("input-remapper Bar Device", keys)
def test_skip_camera(self):
fixtures["/foo/bar"] = {

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
import unittest
@ -46,8 +46,8 @@ from evdev.ecodes import (
KEY_C,
)
from keymapper.injection.consumers.joystick_to_mouse import JoystickToMouse
from keymapper.injection.injector import (
from inputremapper.injection.consumers.joystick_to_mouse import JoystickToMouse
from inputremapper.injection.injector import (
Injector,
is_in_capabilities,
STARTING,
@ -57,15 +57,15 @@ from keymapper.injection.injector import (
UNKNOWN,
get_udev_name,
)
from keymapper.injection.numlock import is_numlock_on, set_numlock, ensure_numlock
from keymapper.system_mapping import system_mapping
from keymapper.gui.custom_mapping import custom_mapping
from keymapper.mapping import Mapping, DISABLE_CODE, DISABLE_NAME
from keymapper.config import config, NONE, MOUSE, WHEEL, BUTTONS
from keymapper.key import Key
from keymapper.injection.macros.parse import parse
from keymapper.injection.context import Context
from keymapper.groups import groups, classify, GAMEPAD
from inputremapper.injection.numlock import is_numlock_on, set_numlock, ensure_numlock
from inputremapper.system_mapping import system_mapping
from inputremapper.gui.custom_mapping import custom_mapping
from inputremapper.mapping import Mapping, DISABLE_CODE, DISABLE_NAME
from inputremapper.config import config, NONE, MOUSE, WHEEL, BUTTONS
from inputremapper.key import Key
from inputremapper.injection.macros.parse import parse
from inputremapper.injection.context import Context
from inputremapper.groups import groups, classify, GAMEPAD
from tests.test import (
new_event,
@ -511,7 +511,7 @@ class TestInjector(unittest.IsolatedAsyncioTestCase):
def test_get_udev_name(self):
self.injector = Injector(groups.find(key="Foo Device 2"), custom_mapping)
suffix = "mapped"
prefix = "key-mapper"
prefix = "input-remapper"
expected = f'{prefix} {"a" * (80 - len(suffix) - len(prefix) - 2)} {suffix}'
self.assertEqual(len(expected), 80)
self.assertEqual(get_udev_name("a" * 100, suffix), expected)
@ -519,7 +519,7 @@ class TestInjector(unittest.IsolatedAsyncioTestCase):
self.injector.device = "abcd"
self.assertEqual(
get_udev_name("abcd", "forwarded"),
"key-mapper abcd forwarded",
"input-remapper abcd forwarded",
)
@mock.patch("evdev.InputDevice.ungrab")
@ -549,22 +549,22 @@ class TestInjector(unittest.IsolatedAsyncioTestCase):
[
# reading and preventing original events from reaching the
# display server
"key-mapper Foo Device foo forwarded",
"key-mapper Foo Device forwarded",
"input-remapper Foo Device foo forwarded",
"input-remapper Foo Device forwarded",
# injection
"key-mapper Foo Device 2 mapped",
"input-remapper Foo Device 2 mapped",
]
),
)
forwarded_foo = uinputs.get("key-mapper Foo Device foo forwarded")
forwarded = uinputs.get("key-mapper Foo Device forwarded")
mapped = uinputs.get("key-mapper Foo Device 2 mapped")
forwarded_foo = uinputs.get("input-remapper Foo Device foo forwarded")
forwarded = uinputs.get("input-remapper Foo Device forwarded")
mapped = uinputs.get("input-remapper Foo Device 2 mapped")
self.assertIsNotNone(forwarded_foo)
self.assertIsNotNone(forwarded)
self.assertIsNotNone(mapped)
# puts the needed capabilities into the new key-mapper device
# puts the needed capabilities into the new input-remapper device
self.assertIn(EV_KEY, mapped.capabilities())
self.assertEqual(len(mapped.capabilities()[EV_KEY]), 2)
self.assertIn(KEY_C, mapped.capabilities()[EV_KEY])
@ -747,7 +747,7 @@ class TestInjector(unittest.IsolatedAsyncioTestCase):
"""yes"""
with mock.patch("keymapper.utils.should_map_as_btn", lambda *_: True):
with mock.patch("inputremapper.utils.should_map_as_btn", lambda *_: True):
history = do_stuff()
self.assertEqual(history.count((EV_KEY, code_w, 1)), 1)
self.assertEqual(history.count((EV_KEY, code_d, 1)), 1)

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
import sys
@ -46,18 +46,18 @@ import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk
from keymapper.system_mapping import system_mapping, XMODMAP_FILENAME
from keymapper.gui.custom_mapping import custom_mapping
from keymapper.paths import CONFIG_PATH, get_preset_path, get_config_path
from keymapper.config import config, WHEEL, MOUSE, BUTTONS
from keymapper.gui.reader import reader
from keymapper.injection.injector import RUNNING, FAILED, UNKNOWN
from keymapper.gui.row import Row, to_string, HOLDING, IDLE
from keymapper.gui.window import Window
from keymapper.key import Key
from keymapper.daemon import Daemon
from keymapper.groups import groups
from keymapper.gui.helper import RootHelper
from inputremapper.system_mapping import system_mapping, XMODMAP_FILENAME
from inputremapper.gui.custom_mapping import custom_mapping
from inputremapper.paths import CONFIG_PATH, get_preset_path, get_config_path
from inputremapper.config import config, WHEEL, MOUSE, BUTTONS
from inputremapper.gui.reader import reader
from inputremapper.injection.injector import RUNNING, FAILED, UNKNOWN
from inputremapper.gui.row import Row, to_string, HOLDING, IDLE
from inputremapper.gui.window import Window
from inputremapper.key import Key
from inputremapper.daemon import Daemon
from inputremapper.groups import groups
from inputremapper.gui.helper import RootHelper
from tests.test import (
tmp,
@ -89,13 +89,13 @@ Gtk.main_quit = lambda: None
def launch(argv=None):
"""Start key-mapper-gtk with the command line argument array argv."""
bin_path = os.path.join(os.getcwd(), "bin", "key-mapper-gtk")
"""Start input-remapper-gtk with the command line argument array argv."""
bin_path = os.path.join(os.getcwd(), "bin", "input-remapper-gtk")
if not argv:
argv = ["-d"]
with patch("keymapper.gui.window.Window.setup_timeouts", lambda *args: None):
with patch("inputremapper.gui.window.Window.setup_timeouts", lambda *args: None):
with patch.object(sys, "argv", [""] + [str(arg) for arg in argv]):
loader = SourceFileLoader("__main__", bin_path)
spec = spec_from_loader("__main__", loader)
@ -191,7 +191,7 @@ class TestGroupsFromHelper(unittest.TestCase):
def os_system(cmd):
# instead of running pkexec, fork instead. This will make
# the helper aware of all the test patches
if "pkexec key-mapper-control --command helper" in cmd:
if "pkexec input-remapper-control --command helper" in cmd:
# the forked process should get the initial groups
groups.refresh()
multiprocessing.Process(target=RootHelper).start()
@ -219,7 +219,7 @@ class TestGroupsFromHelper(unittest.TestCase):
os.system = cls.original_os_system
Daemon.connect = cls.original_connect
@patch("keymapper.gui.window.Window.on_select_preset")
@patch("inputremapper.gui.window.Window.on_select_preset")
def test_knows_devices(self, on_select_preset_patch):
# verify that it is working as expected
gtk_iteration()
@ -1401,12 +1401,12 @@ class TestIntegration(unittest.TestCase):
self.assertEqual(event.code, keycode_to)
self.assertEqual(event.value, 0)
# the key-mapper device will not be shown
# the input-remapper device will not be shown
groups.refresh()
self.window.populate_devices()
for entry in self.window.device_store:
# whichever attribute contains "key-mapper"
self.assertNotIn("key-mapper", "".join(entry))
# whichever attribute contains "input-remapper"
self.assertNotIn("input-remapper", "".join(entry))
def test_gamepad_purpose_mouse_and_button(self):
self.window.on_select_device(FakeDeviceDropdown("gamepad"))

@ -1,31 +1,31 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
import unittest
import select
import time
from keymapper.ipc.pipe import Pipe
from keymapper.ipc.shared_dict import SharedDict
from keymapper.ipc.socket import Server, Client, Base
from inputremapper.ipc.pipe import Pipe
from inputremapper.ipc.shared_dict import SharedDict
from inputremapper.ipc.socket import Server, Client, Base
from tests.test import quick_cleanup
@ -70,21 +70,21 @@ class TestSocket(unittest.TestCase):
self.assertFalse(s2.poll())
self.assertEqual(s2.recv(), None)
server = Server("/tmp/key-mapper-test/socket1")
client = Client("/tmp/key-mapper-test/socket1")
server = Server("/tmp/input-remapper-test/socket1")
client = Client("/tmp/input-remapper-test/socket1")
test(server, client)
client = Client("/tmp/key-mapper-test/socket2")
server = Server("/tmp/key-mapper-test/socket2")
client = Client("/tmp/input-remapper-test/socket2")
server = Server("/tmp/input-remapper-test/socket2")
test(client, server)
def test_not_connected_1(self):
# client discards old message, because it might have had a purpose
# for a different client and not for the current one
server = Server("/tmp/key-mapper-test/socket3")
server = Server("/tmp/input-remapper-test/socket3")
server.send(1)
client = Client("/tmp/key-mapper-test/socket3")
client = Client("/tmp/input-remapper-test/socket3")
server.send(2)
self.assertTrue(client.poll())
@ -93,10 +93,10 @@ class TestSocket(unittest.TestCase):
self.assertEqual(client.recv(), None)
def test_not_connected_2(self):
client = Client("/tmp/key-mapper-test/socket4")
client = Client("/tmp/input-remapper-test/socket4")
client.send(1)
server = Server("/tmp/key-mapper-test/socket4")
server = Server("/tmp/input-remapper-test/socket4")
client.send(2)
self.assertTrue(server.poll())
@ -106,8 +106,8 @@ class TestSocket(unittest.TestCase):
def test_select(self):
"""is compatible to select.select"""
server = Server("/tmp/key-mapper-test/socket6")
client = Client("/tmp/key-mapper-test/socket6")
server = Server("/tmp/input-remapper-test/socket6")
client = Client("/tmp/input-remapper-test/socket6")
server.send(1)
ready = select.select([client], [], [], 0)[0][0]
@ -126,7 +126,7 @@ class TestSocket(unittest.TestCase):
class TestPipe(unittest.TestCase):
def test_pipe_single(self):
p1 = Pipe(f"/tmp/key-mapper-test/pipe")
p1 = Pipe(f"/tmp/input-remapper-test/pipe")
self.assertEqual(p1.recv(), None)
p1.send(1)
@ -146,8 +146,8 @@ class TestPipe(unittest.TestCase):
self.assertEqual(p1.recv(), None)
def test_pipe_duo(self):
p1 = Pipe(f"/tmp/key-mapper-test/pipe")
p2 = Pipe(f"/tmp/key-mapper-test/pipe")
p1 = Pipe(f"/tmp/input-remapper-test/pipe")
p2 = Pipe(f"/tmp/input-remapper-test/pipe")
self.assertEqual(p2.recv(), None)
p1.send(1)

@ -1,29 +1,29 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
import unittest
from evdev.ecodes import KEY_LEFTSHIFT, KEY_RIGHTALT, KEY_LEFTCTRL
from keymapper.key import Key
from inputremapper.key import Key
class TestKey(unittest.TestCase):

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
import unittest
@ -35,18 +35,18 @@ from evdev.ecodes import (
ABS_Y,
)
from keymapper.injection.consumers.keycode_mapper import (
from inputremapper.injection.consumers.keycode_mapper import (
active_macros,
KeycodeMapper,
unreleased,
subsets,
)
from keymapper.system_mapping import system_mapping
from keymapper.injection.macros.parse import parse
from keymapper.injection.context import Context
from keymapper.utils import RELEASE, PRESS
from keymapper.config import config, BUTTONS
from keymapper.mapping import Mapping, DISABLE_CODE
from inputremapper.system_mapping import system_mapping
from inputremapper.injection.macros.parse import parse
from inputremapper.injection.context import Context
from inputremapper.utils import RELEASE, PRESS
from inputremapper.config import config, BUTTONS
from inputremapper.mapping import Mapping, DISABLE_CODE
from tests.test import (
new_event,
@ -968,8 +968,8 @@ class TestKeycodeMapper(unittest.IsolatedAsyncioTestCase):
async def test_ignore_hold(self):
# hold as in event-value 2, not in macro-hold.
# linux will generate events with value 2 after key-mapper injected
# the key-press, so key-mapper doesn't need to forward them. That
# linux will generate events with value 2 after input-remapper injected
# the key-press, so input-remapper doesn't need to forward them. That
# would cause duplicate events of those values otherwise.
key = (EV_KEY, KEY_A)
ev_1 = (*key, 1)

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
import os
@ -24,8 +24,8 @@ import shutil
import unittest
import logging
from keymapper.logger import logger, add_filehandler, update_verbosity, log_info
from keymapper.paths import remove
from inputremapper.logger import logger, add_filehandler, update_verbosity, log_info
from inputremapper.paths import remove
from tests.test import tmp
@ -60,7 +60,7 @@ class TestLogger(unittest.TestCase):
log_info()
with open(path, "r") as f:
content = f.read().lower()
self.assertIn("key-mapper", content)
self.assertIn("input-remapper", content)
def test_makes_path(self):
path = os.path.join(tmp, "logger-test")

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
import time
@ -39,7 +39,7 @@ from evdev.ecodes import (
KEY_E,
)
from keymapper.injection.macros.macro import (
from inputremapper.injection.macros.macro import (
Macro,
_type_check,
macro_variables,
@ -47,7 +47,7 @@ from keymapper.injection.macros.macro import (
_resolve,
Variable,
)
from keymapper.injection.macros.parse import (
from inputremapper.injection.macros.parse import (
parse,
_extract_args,
is_this_a_macro,
@ -58,11 +58,11 @@ from keymapper.injection.macros.parse import (
_remove_whitespaces,
_remove_comments,
)
from keymapper.injection.context import Context
from keymapper.config import config
from keymapper.mapping import Mapping
from keymapper.system_mapping import system_mapping
from keymapper.utils import PRESS, RELEASE
from inputremapper.injection.context import Context
from inputremapper.config import config
from inputremapper.mapping import Mapping
from inputremapper.system_mapping import system_mapping
from inputremapper.utils import PRESS, RELEASE
from tests.test import quick_cleanup, new_event
@ -100,7 +100,7 @@ class TestMacros(MacroTestBase):
result.append((a, b, c, d))
functions = {"k": patch}
with mock.patch("keymapper.injection.macros.parse.FUNCTIONS", functions):
with mock.patch("inputremapper.injection.macros.parse.FUNCTIONS", functions):
await parse("k(1, d=4, b=2, c=3)", self.context).run(self.handler)
await parse("k(1, b=2, c=3)", self.context).run(self.handler)
self.assertListEqual(result, [(1, 2, 3, 4), (1, 2, 3, 400)])

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
import os
@ -25,11 +25,11 @@ import json
from evdev.ecodes import EV_KEY, EV_ABS, ABS_HAT0X, KEY_A
from keymapper.mapping import Mapping, split_key
from keymapper.system_mapping import SystemMapping, XMODMAP_FILENAME
from keymapper.config import config
from keymapper.paths import get_preset_path
from keymapper.key import Key
from inputremapper.mapping import Mapping, split_key
from inputremapper.system_mapping import SystemMapping, XMODMAP_FILENAME
from inputremapper.config import config
from inputremapper.paths import get_preset_path
from inputremapper.key import Key
from tests.test import tmp, quick_cleanup

@ -1,16 +1,16 @@
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
import os
@ -18,15 +18,16 @@ import unittest
import shutil
import json
from evdev.ecodes import EV_KEY, EV_ABS, ABS_HAT0X, KEY_A
from evdev.ecodes import EV_KEY, EV_ABS, ABS_HAT0X
from keymapper.migrations import migrate, config_version
from keymapper.mapping import Mapping, split_key
from keymapper.config import config, GlobalConfig
from keymapper.paths import touch, CONFIG_PATH, mkdir, get_preset_path
from keymapper.key import Key
from inputremapper.migrations import migrate, config_version
from inputremapper.mapping import Mapping
from inputremapper.config import config
from inputremapper.paths import touch, CONFIG_PATH, mkdir, get_preset_path
from inputremapper.key import Key
from inputremapper.user import HOME
from keymapper.logger import logger, VERSION
from inputremapper.logger import VERSION
from tests.test import quick_cleanup, tmp
@ -39,17 +40,48 @@ class TestMigrations(unittest.TestCase):
def test_migrate_suffix(self):
old = os.path.join(CONFIG_PATH, "config")
new = os.path.join(CONFIG_PATH, "config.json")
try:
os.remove(new)
except FileNotFoundError:
pass
touch(old)
with open(old, "w") as f:
f.write("{}")
migrate()
self.assertTrue(os.path.exists(new))
self.assertFalse(os.path.exists(old))
def test_rename_config(self):
old = os.path.join(HOME, ".config", "key-mapper")
new = CONFIG_PATH
# we are not destroying our actual config files with this test
self.assertTrue(new.startswith("/tmp"))
try:
os.rmdir(new)
except FileNotFoundError:
pass
old_config_json = os.path.join(old, "config.json")
touch(old_config_json)
with open(old_config_json, "w") as f:
f.write('{"foo":"bar"}')
migrate()
self.assertTrue(os.path.exists(new))
self.assertFalse(os.path.exists(old))
new_config_json = os.path.join(new, "config.json")
with open(new_config_json, "r") as f:
moved_config = json.loads(f.read())
self.assertEqual(moved_config["foo"], "bar")
self.assertIn("version", moved_config)
def test_wont_migrate_suffix(self):
old = os.path.join(CONFIG_PATH, "config")
new = os.path.join(CONFIG_PATH, "config.json")

@ -1,28 +1,28 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
import os
import unittest
from keymapper.paths import touch, mkdir, get_preset_path, get_config_path
from inputremapper.paths import touch, mkdir, get_preset_path, get_config_path
from tests.test import quick_cleanup, tmp

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
import os
@ -24,7 +24,7 @@ import unittest
import shutil
import time
from keymapper.presets import (
from inputremapper.presets import (
find_newest_preset,
rename_preset,
get_any_preset,
@ -32,8 +32,8 @@ from keymapper.presets import (
get_available_preset_name,
get_presets,
)
from keymapper.paths import CONFIG_PATH, get_preset_path, touch, mkdir
from keymapper.gui.custom_mapping import custom_mapping
from inputremapper.paths import CONFIG_PATH, get_preset_path, touch, mkdir
from inputremapper.gui.custom_mapping import custom_mapping
from tests.test import tmp

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
import unittest
@ -40,12 +40,12 @@ from evdev.ecodes import (
ABS_RZ,
)
from keymapper.gui.reader import reader, will_report_up
from keymapper.gui.custom_mapping import custom_mapping
from keymapper.config import BUTTONS, MOUSE
from keymapper.key import Key
from keymapper.gui.helper import RootHelper
from keymapper.groups import groups
from inputremapper.gui.reader import reader, will_report_up
from inputremapper.gui.custom_mapping import custom_mapping
from inputremapper.config import BUTTONS, MOUSE
from inputremapper.key import Key
from inputremapper.gui.helper import RootHelper
from inputremapper.groups import groups
from tests.test import (
new_event,
@ -458,13 +458,13 @@ class TestReader(unittest.TestCase):
self.assertEqual(reader.read(), None)
self.assertEqual(len(reader._unreleased), 0)
def test_keymapper_devices(self):
# Don't read from keymapper devices, their keycodes are not
def test_inputremapper_devices(self):
# Don't read from inputremapper devices, their keycodes are not
# representative for the original key. As long as this is not
# intentionally programmed it won't even do that. But it was at some
# point.
push_events(
"key-mapper Bar Device",
"input-remapper Bar Device",
[
new_event(EV_KEY, CODE_1, 1),
new_event(EV_KEY, CODE_2, 1),

@ -1,22 +1,22 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
import os
@ -27,9 +27,9 @@ import multiprocessing
import evdev
from evdev.ecodes import EV_ABS, EV_KEY
from keymapper.groups import groups
from keymapper.gui.reader import reader
from keymapper.gui.helper import RootHelper
from inputremapper.groups import groups
from inputremapper.gui.reader import reader
from inputremapper.gui.helper import RootHelper
from tests.test import (
InputDevice,

@ -1,29 +1,29 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# input-remapper - GUI for device specific keyboard mappings
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
#
# This file is part of key-mapper.
# This file is part of input-remapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# input-remapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# input-remapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
import os
import unittest
from unittest import mock
from keymapper.user import get_user, get_home
from inputremapper.user import get_user, get_home
from tests.test import quick_cleanup

Loading…
Cancel
Save