asus-linux-drivers / asus-numberpad-driver

Maintained feature-rich linux driver for NumberPad(2.0) on Asus laptops. NumberPad(2.0) is illuminated numeric keypad integrated to touchpad which appears when is done tap on top right corner of touchpad for atleast 1s by default (configurable) or slide gesture from top right/left corner to the center, the left shows calc app aswell (configurable).
GNU General Public License v2.0
268 stars 21 forks source link

Solve #202, NixOS support. #208

Closed scientiac closed 2 weeks ago

scientiac commented 1 month ago

This pull request adds the ability to use the drivers in NixOS via flakes. By adding the following files

flake.nix flake.lock nix/default.nix nix/module.nix nix/shell.nix

ldrahnik commented 3 weeks ago

@scientiac Toggling + fix libxkbcommon to specific version <1.1 and it is ready to merge from my side :)

YuanYuYuan commented 3 weeks ago

Hi @scientiac and @ldrahnik, I've tested this PR and encountered some issue, so I made a PR for it here https://github.com/scientiac/asus-numberpad-driver/pull/1

ldrahnik commented 3 weeks ago

@YuanYuYuan Thank you for joining the NixOS party @scientiac @YuanYuYuan these environment values (as my systemd servises already have = I would keep x11 support even for NixOS) have to be definitely propagated from terminal when is this module installed. It can not be hardcoded. @YuanYuYuan any idea how implement toggling on NixOS? What is equivalent of gsettings / dconf? I mean associating the script for default calc app be toggled by key CALC_KEY. Now one finger movement to the center from the top left icon always opens new instance of calculator.

scientiac commented 3 weeks ago

Hi @scientiac and @ldrahnik, I've tested this PR and encountered some issue, so I made a PR for it here scientiac#1

Thanks for that. What about the swipe gesture to toggle calculator? Does that work?

On Hyprland try setting the keybind of XF86Calculator to

sh -c 'if pidof gnome-calculator > /dev/null; then kill $(pidof gnome-calculator); else gnome-calculator; fi

Tell me if it works.

replace your calculator app there

scientiac commented 3 weeks ago

@YuanYuYuan Thank you for joining the NixOS party @scientiac @YuanYuYuan these environment values (as my systemd servises already have = I would keep x11 support even for NixOS) have to be definitely propagated from terminal when is this module installed. It can not be hardcoded. @YuanYuYuan any idea how implement toggling on NixOS? What is equivalent of gsettings / dconf? I mean associating the script for default calc app be toggled by key CALC_KEY. Now one finger movement to the center from the top left icon always opens new instance of calculator.

Here is the home manager config that sets up toggling the calculator using dconf.

{
# assuming gnome-calculator is installed 

  # Configure custom keybinding for calculator
  dconf.settings = {
    "org/gnome/settings-daemon/plugins/media-keys" = {
      # Set up custom keybinding
      custom-keybindings = [
        "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/"
      ];
    };

    # Configure the custom keybinding
    "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = {
      name = "Calculator";
      binding = "XF86Calculator";
      command = "sh -c 'if pidof gnome-calculator > /dev/null; then kill $(pidof gnome-calculator); else gnome-calculator; fi'";
    };
  };

}