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

dual-function-keys: init at 1.1.0 #94097

Merged
merged 3 commits into from Jan 19, 2021

Conversation

svend
Copy link
Contributor

@svend svend commented Jul 28, 2020

Motivation for this change

Add dual-function-keys interception-tools plugin. This allows for modifier keys like: hold for ctrl, tap for delete.

See https://gitlab.com/interception/linux/plugins/dual-function-keys

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

"$(pkg-config --cflags libevdev | cut -c 3-)"
'';

installPhase = ''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about installFlags = [ "DESTDIR=$(out)" ];?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I've made this change.

@svend svend marked this pull request as draft July 31, 2020 22:38
@svend
Copy link
Contributor Author

svend commented Jul 31, 2020

The directory layout is not correct. I need to look into this.

$ tree /nix/store/fx6mr1q0791aq8ws4jw33hcxmxiji7q5-dual-function-keys-1.1.0
/nix/store/fx6mr1q0791aq8ws4jw33hcxmxiji7q5-dual-function-keys-1.1.0
└── usr
    └── local
        ├── bin
        │   └── dual-function-keys
        └── man
            └── man1
                └── dual-function-keys.1

@svend
Copy link
Contributor Author

svend commented Sep 19, 2020

Layout looks correct now.

$ tree $(nix-build -A interception-tools-plugins.dual-function-keys)
/nix/store/bzmyiyb6a4l9l9mbd4bpg30v29pw8ig4-dual-function-keys-1.1.0
├── bin
│   └── dual-function-keys
└── share
    └── man
        └── man1
            └── dual-function-keys.1.gz

@svend svend marked this pull request as ready for review September 19, 2020 20:58
@svend
Copy link
Contributor Author

svend commented Sep 19, 2020

@vyp Could you take a look at this PR?

How do I test this PR? The NixOS configuration will look something like this:

  services.interception-tools = {
    enable = true;
    plugins = [ pkgs.interception-tools-plugins.dual-function-keys ];
    udevmonConfig = ''
        - JOB: "intercept -g $DEVNODE | dual-function-keys -c /home/svend/.dual-function-keys.yaml | uinput -d $DEVNODE"
          DEVICE:
            NAME: AT Translated Set 2 keyboard
      '';
  };


But I'm not sure how to get my NixOS to build off a local configuration.

@svend
Copy link
Contributor Author

svend commented Sep 19, 2020

@svend
Copy link
Contributor Author

svend commented Sep 19, 2020

Found instructions here: https://discourse.nixos.org/t/how-to-test-changes-to-a-nixos-module/2650

I got space to work as a control key with the following configuration:

/etc/nixos/configuration.nix

...
  services.interception-tools = {
    enable = true;
    plugins = [ pkgs.interception-tools-plugins.dual-function-keys ];
    udevmonConfig = ''
        - JOB: "intercept -g $DEVNODE | dual-function-keys -c /home/svend/.dual-function-keys.yaml | uinput -d $DEVNODE"
          DEVICE:
            NAME: AT Translated Set 2 keyboard
      '';
...
  };

/home/svend/.dual-function-keys.yaml

TIMING:
  TAP_MILLISEC: 200
  DOUBLE_TAP_MILLISEC: 150

MAPPINGS:
  # Space as control key
  - KEY: KEY_SPACE
    TAP: KEY_SPACE
    HOLD: KEY_RIGHTCTRL

@svend svend requested a review from sikmir September 20, 2020 23:35
@vyp
Copy link
Member

vyp commented Sep 23, 2020

@svend sorry for the delay, I just wanted to let you know for now I will have time to look at this on the weekend (or earlier).

Copy link
Member

@vyp vyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you already figured it out :)
Btw I think you could have also used a nixos overlay where you point to dual-function-keys.nix in it.

@svend
Copy link
Contributor Author

svend commented Sep 24, 2020

Thanks for the review!

Looks like you already figured it out :)
Btw I think you could have also used a nixos overlay where you point to dual-function-keys.nix in it.

Do you have an example on how to use overlays with a nixos configuration?

@vyp
Copy link
Member

vyp commented Sep 25, 2020

Say you have a overlay.nix:

self: super:
{
  interception-tools-plugins = {
    dual-function-keys = super.callPackage /path/to/dual-function-keys.nix { };
  };
}

In your nixos configuration.nix:

{
  nixpkgs.overlays = [
    (import /path/to/overlay.nix)
  ];
  services.interception-tools = {
    enable = true;
    plugins = [ pkgs.interception-tools-plugins.dual-function-keys ];
    udevmonConfig = "...";
  }
}

@svend
Copy link
Contributor Author

svend commented Sep 26, 2020

Thanks for all the help with this. Could this get merged?

@svend
Copy link
Contributor Author

svend commented Oct 5, 2020

@vyp Would you be able to merge this PR? I don't have commit access.

@vlaci
Copy link
Contributor

vlaci commented Oct 28, 2020

I have also tested the the package from this PR and it worked fine for me too.

Copy link
Member

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please squash the commits related to the package together.

@SuperSandro2000
Copy link
Member

Result of nixpkgs-review pr 94097 run on x86_64-linux 1

@SuperSandro2000
Copy link
Member

@svend Please resolve the merge conflict.

@svend
Copy link
Contributor Author

svend commented Dec 29, 2020

@SuperSandro2000 I've rebased my changes and fixed the conflict.

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants