From 0f30f5ae78e42fa95dc75fd3c8f708a3d30a6b0e Mon Sep 17 00:00:00 2001 From: sezanzeb Date: Fri, 25 Dec 2020 15:00:57 +0100 Subject: [PATCH] systemd optional in postinst --- DEBIAN/postinst | 8 +++++--- keymapper/state.py | 2 +- readme/usage.md | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/DEBIAN/postinst b/DEBIAN/postinst index 682b808e..f6adcb99 100755 --- a/DEBIAN/postinst +++ b/DEBIAN/postinst @@ -1,4 +1,6 @@ #!/bin/bash -systemctl enable key-mapper -systemctl stop key-mapper -systemctl start key-mapper +if [ -d "/run/systemd/system/" ]; then + systemctl enable key-mapper + systemctl stop key-mapper + systemctl start key-mapper +fi diff --git a/keymapper/state.py b/keymapper/state.py index 50938d93..f6f2a3c4 100644 --- a/keymapper/state.py +++ b/keymapper/state.py @@ -82,7 +82,7 @@ class SystemMapping: if USER != 'root': # write this stuff into the key-mapper config directory, because - # the systemd service needs to know the xmodmap list on boot. + # the systemd service won't know the user sessions xmodmap path = get_config_path(XMODMAP_FILENAME) touch(path) with open(path, 'w') as file: diff --git a/readme/usage.md b/readme/usage.md index e0652b6e..b809072f 100644 --- a/readme/usage.md +++ b/readme/usage.md @@ -91,7 +91,7 @@ an example autoload entry: ``` `preset name` refers to `~/.config/key-mapper/presets/device name/preset name.json`. -The device name can be found with `evtest`. +The device name can be found with `sudo key-mapper-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: @@ -130,7 +130,7 @@ running (or without sudo if your user has the appropriate permissions). ```bash key-mapper-control --command autoload -key-mapper-control --list-devices +sudo key-mapper-control --list-devices key-mapper-control --command stop --device "Razer Razer Naga Trinity" key-mapper-control --command start --device "Razer Razer Naga Trinity" --preset "~/.config/key-mapper/presets/gamepad/a.json" ```