houmain / keymapper

A cross-platform context-aware key remapper.
GNU General Public License v3.0
257 stars 21 forks source link

Running keymapper exits if `keymapper --check` is executed [SOLVED] #130

Closed ristomatti closed 2 months ago

ristomatti commented 2 months ago

While doing some pretty experimental remapping using parameterized aliases I ended up with an invalid config. I missed the notification so I didn't know what to undo, so I ran keymapper --check to see what the issue is. Luckily now with the tray icon, I noticed pretty quickly that the originally running keymapper process has died.

Steps to reproduce:

  1. Start keymapper -u
  2. Run keymapper --check

Edit: keymapper --version also exits the running process.

houmain commented 2 months ago

I cannot reproduce that and it does not make any sense to me. Beside some basically empty constructors only this gets called:

int main(int argc, char* argv[]) {
  if (!interpret_commandline(g_settings, argc, argv)) {
    print_help_message();
    return 1;
  }

Maybe something strange is going on on your machine? Can you tell whether the running instance is crashing?

ristomatti commented 2 months ago

image

ristomatti commented 2 months ago

It's not a big deal though as I'm now running it as a user service, so it'll restart automatically.

$ cat .config/systemd/user/keymapper.service
[Unit]
Description=keymapper service

[Service]
Type=simple
Restart=always
RestartSec=3
ExecStart=/usr/bin/keymapper -u

[Install]
WantedBy=default.target
houmain commented 2 months ago

I just looked for a way to get some information about why a process terminated and found this. Could you please check the result code of the process and see if anything is written in the kernel log? Maybe there is something on your machine, which guarantees that only a single instance of keymapper is running at a time?

ristomatti commented 2 months ago

I tried now and I can't reproduce it.

Maybe there is something on your machine, which guarantees that only a single instance of keymapper is running at a time?

Now that you say this, I previously had a wrapper script ~/.local/bin/keymapper that I used to reset modifier indicators after config file edit etc. It also had a snippet that did exactly this. I've since moved the stuff into a systemd user script that handles this more cleanly and only monitors the keymapper service I've created.

Anyhow, just today I realized I forgot to delete the old wrapper and with luck, fixed this as well :facepalm:.