rvaiya / keyd

A key remapping daemon for linux.
MIT License
2.77k stars 164 forks source link

Keyd Virtual Pointer disables KDE Plasma auto "Touch Mode" #827

Open Cal-Nine opened 2 weeks ago

Cal-Nine commented 2 weeks ago

KDE Plasma has a feature to automatically enable a "Touch Mode" where buttons are larger when 2-in-1 enters tablet mode, i.e. keyboard and mouse are not detected but touchscreen is. The Keyd virtual pointer is detected as a mouse, so while Keyd is enabled, Plasma will never consider the device in tablet mode.

  1. Enable Keyd on touch screen device
  2. Go to KDE Plasma "General Behavior" settings and set "Touch Mode" to "Automatically enable as needed"
  3. Switch device to tablet mode by disconnecting keyboard and mouse

I don't actually use the Keyd virtual pointer, so being able to disable this somehow would do the trick (unless there is a way and I haven't been able to find it).

Operating System: NixOS 24.11 KDE Plasma Version: 6.1.4 KDE Frameworks Version: 6.5.0 Qt Version: 6.7.2 Kernel Version: 6.8.9 (64-bit) Graphics Platform: Wayland Processors: 8 × Intel® Core™ i7-1065G7 CPU @ 1.30GHz Memory: 15.2 GiB of RAM Graphics Processor: Mesa Intel® Iris® Plus Graphics Manufacturer: Microsoft Corporation Product Name: Surface Pro 7

justinvdk commented 4 days ago

Can confirm. It indeed seems like there is not configurable way to disable this. I see you use nixos; for me I create the following .nix file and put it in my imports and set services.keyd.no-pointer = true;

If I can find the time I will look into making it configurable in keyd; but for now my immediate problem is resolved. Also, no promises on the repo staying up, so if you want to use this as well I recommend forking as well.

{ config, lib, pkgs, ... }:
{
  options.services.keyd = {
    no-pointer = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        Whether to prevent registering a virtual pointer device.
        Implemented by just using https://github.com/justinvdk/keyd; which just removed the relevant code.
      '';
    };
  };
  config = lib.mkIf config.services.keyd.enable {
    services.keyd = {
      keyboards.main.settings = {
        # Default config here.
      };
    };
    nixpkgs.overlays = lib.mkIf config.services.keyd.no-pointer [
      (final: prev: {
        keyd = prev.keyd.overrideAttrs (old: {
          src = pkgs.fetchFromGitHub {
            owner = "justinvdk";
            repo = "keyd";
            rev = "master";
            hash = "sha256-5Xnx1ChW4b9mGUxyiq+tw/9Mwxqor7qm/czNULJDAMM=";
          };
        });
      })
    ];
  };
}