Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

input-remapper - ERROR: Request to autoload ... before a user told the service about their session using set_config_dir #304006

Closed
TimoVerbrugghe opened this issue Apr 14, 2024 · 3 comments

Comments

@TimoVerbrugghe
Copy link

TimoVerbrugghe commented Apr 14, 2024

Describe the bug

I'm using input-remapper to remap a key combination on my xbox controller (L3 + R3) to ALT-F4 in order to more easily close applications on my HTPC.

Defined input-remapper in my nixos configuration:

  # Enable input-remapper
  services.input-remapper = {
    enable = true;

    ## Enable built-in udev rules for when Xbox Controller is plugged in/connected through sunshine
    enableUdevRules = true;
  };

And set up the rules through the input-remapper-gtk graphical UI. This was working.

However, when rebooting the machine, the rules do not load in and systemctl status input-remapper says that it cannot autoload the rules:

[root@gamer:/home/gamer]# systemctl status input-remapper
● input-remapper.service - Service to inject keycodes without the GUI application
     Loaded: loaded (/etc/systemd/system/input-remapper.service; enabled; preset: enabled)
    Drop-In: /nix/store/nw5zirqqw9kiq03djnkfgdkkxx3i97jx-system-units/input-remapper.service.d
             └─overrides.conf
     Active: active (running) since Sun 2024-04-14 13:05:29 CEST; 38s ago
   Main PID: 1110 (.input-remapper)
         IP: 0B in, 0B out
         IO: 2.5M read, 0B written
      Tasks: 5 (limit: 38257)
     Memory: 31.8M (peak: 32.3M)
        CPU: 215ms
     CGroup: /system.slice/input-remapper.service
             ├─1110 /nix/store/gd3shnza1i50zn8zs04fa729ribr88m9-python3-3.11.8/bin/python3 /nix/store/lfkk1vqblrg36saaa6chivl0w4j7709c-input-remapper-2.0.1/bin/.input-remapper-service-wrapped
             └─1277 /nix/store/gd3shnza1i50zn8zs04fa729ribr88m9-python3-3.11.8/bin/python3 /nix/store/lfkk1vqblrg36saaa6chivl0w4j7709c-input-remapper-2.0.1/bin/.input-remapper-service-wrapped
 
Apr 14 13:05:29 gamer input-remapper-service[1110]: python-evdev 1.7.0
Apr 14 13:05:29 gamer systemd[1]: Started Service to inject keycodes without the GUI application.
Apr 14 13:05:32 gamer input-remapper-service[1110]: Request to autoload for "Mouse passthrough"
Apr 14 13:05:32 gamer input-remapper-service[1110]: ERROR: Request to autoload "Mouse passthrough" before a user told the service about their session using set_config_dir
Apr 14 13:05:32 gamer input-remapper-service[1110]: Request to autoload for "Mouse passthrough"
Apr 14 13:05:32 gamer input-remapper-service[1110]: ERROR: Request to autoload "Mouse passthrough" before a user told the service about their session using set_config_dir
Apr 14 13:05:32 gamer input-remapper-service[1110]: Request to autoload for "Logitech Wireless Mouse PID:4038"
Apr 14 13:05:32 gamer input-remapper-service[1110]: ERROR: Request to autoload "Logitech Wireless Mouse PID:4038" before a user told the service about their session using set_config_dir
Apr 14 13:05:54 gamer input-remapper-service[1110]: Request to autoload for "Microsoft X-Box 360 pad"
Apr 14 13:05:54 gamer input-remapper-service[1110]: ERROR: Request to autoload "Microsoft X-Box 360 pad" before a user told the service about their session using set_config_dir

If I try to stop and start the input-remapper service, it still gives me the same error. HOWEVER, when I stop the input-remapper service (systemctl stop input-remapper.service) and then start the program manually (with input-remapper-service) then the rules do load in when I connect my controller

[root@gamer:/home/gamer]# input-remapper-service
input-remapper-service 2.0.1 2.0.1 https://github.com/sezanzeb/input-remapper
python-evdev 1.7.0
Loaded config from "/home/gamer/.config/input-remapper-2/config.json"
Request to autoload for "Microsoft X-Box 360 pad"
Found "Sleep Button", "Microsoft Microsoft® Nano Transceiver v2.0", "ASRock LED Controller", "Logitech Wireless Mouse PID:4038", "Mouse passthrough", "Microsoft X-Box 360 pad"
Autoloading for "Microsoft X-Box 360 pad"
Request to start injecting for "Microsoft X-Box 360 pad"
Loading preset from "/home/gamer/.config/input-remapper-2/presets/Microsoft X-Box 360 pad/Quit Application.json"
Starting injecting the preset for "Microsoft X-Box 360 pad"

I am autologging into my gamer account (using services.autologin.user = "gamer"), don't know if that could be the cause of this? However, I find it strange that stopping and starting the service after I've logged in doesn't work, but manually starting the program does...

Steps To Reproduce

Steps to reproduce the behavior:

  1. Set up user autologin with option services.autologin.user = ""; (don't know if this is required to trigger the error)
  2. Set up input-remapper service with services.input-remapper.enable = true; and use udevrules with enableUdevRules = true;
  3. Set up a rule through input-remapper-gtk
  4. Reboot the machine

Expected behavior

I would expect the systemd service to autoload the rules just as it does when I manually start input-remapper-service from the command line

Screenshots

If applicable, add screenshots to help explain your problem.

Notify maintainers

@LunNova

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[root@gamer:/home/gamer]# nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.8.5, NixOS, 24.05 (Uakari), 24.05.20240410.1042fd8`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.2`
 - nixpkgs: `/nix/store/r1g09wfd968168f6drdl7agfaf3msik4-source`

Add a 👍 reaction to issues you find important.

@LunNova
Copy link
Member

LunNova commented Apr 14, 2024

The input-remapper remapper service that's part of the system doesn't know which config to use until a user logs in and sets a config folder to use. As far as I can tell this is an intentional design decision for input-remapper, it wants to be multi-user and when you log out and log in as a different user a different config can be loaded.

If you use home-manager something like this works to automate launching the user part of input-remapper on login, assuming your desktop environment supports xdg autostart. An autostart desktop file is the upstream supported way to set it up.

  xdg.configFile."autostart/input-mapper-autoload.desktop" = lib.mkIf nixosConfig.services.input-remapper.enable {
    source = "${nixosConfig.services.input-remapper.package}/share/applications/input-remapper-autoload.desktop";
  };

Otherwise, launching the input remapper GUI or adding a systemd user service that loads the user config when you log in should also work.

@TimoVerbrugghe
Copy link
Author

Thanks @LunNova for the quick response! I've used home-manager in order to run the input-remapper-autoload.desktop file to solve my issue.

I also tried to create an user systemd service that would load the config but there I encountered the same issue as mentioned in my first post, maybe it had to do with autologin... But anyway: doing it through home manager worked.

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/input-remapper-not-working-as-expected/44459/2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants