### this file is sourced not run
PKGVER=2.5.0.2025.09 # pull date, last release was a year ago
PKGBUILD=1
PKGARCH=x86_64

# source: james
TARBALL=keyd-$PKGVER.tar.gz
MD5SUM=6d8e59fabff3ca25460ec881355dea2b
SRC_URL=https://github.com/rvaiya/keyd/archive/39bddd1c38e2ccefcd7840500fd6cedf804d2449.tar.gz
BUNDLE=

SLACKREQ=
SLACKDESC="keyd: keyd $PKGVER (keymapping daemon)
keyd: 
keyd: keyd is a system-wide daemon that remaps keys using kernel level 
keyd: input primitives (evdev, uinput). It works oa all levels (CLI and 
keyd: GUI). This is similar, but more powerful, than kbbind or evmapd.
keyd:
keyd: Please load uinput kernel module before using.
keyd: 
keyd: https://github.com/rvaiya/keyd/
keyd: 
keyd:
"
SLACKINSTALL="addgroup keyd"

### default pkg_download
### default pkg_prepare
### default pkg_package
### build
pkg_build() {
	cd /tmp/keyd*

	make PREFIX=/usr &&
	make PREFIX=/usr install &&
	install -Dm644 ../pkg/36-keyd /etc/init.d &&
	
	pkg_build_slackdesc &&
	cat > /usr/share/doc/keyd/libinput.txt << "EOF"
Why is my trackpad interfering with input after enabling keyd?

libinput, a higher level input component used by most wayland and X11
setups, includes a feature called 'disable-while-typing' that disables
the trackpad when typing.

In order to achieve this, it needs to distinguish between internal and
external keyboards, which it does by hard coding rules for specific
hardware ('quirks'). Since keyd creates a virtual device which subsumes
both external and integrated keyboards, you will need to instruct
libinput to regard the keyd virtual device as internal.

This can be achieved by adding the following to
/etc/libinput/local-overrides.quirks (which may need to be created):

[Serial Keyboards]

MatchUdevType=keyboard
MatchName=keyd*keyboard
AttrKeyboardIntegration=internal

Credit to @mark-herbert42 and @canadaduane for the original solution.
EOF
}
