This commit is contained in:
S4NKALP 2025-10-19 11:34:28 +05:45
commit af7eb4a5ea
No known key found for this signature in database
GPG key ID: 6FF2522A73894C88
3 changed files with 132 additions and 0 deletions

27
.SRCINFO Normal file
View file

@ -0,0 +1,27 @@
pkgbase = vbx-git
pkgdesc = C-based CLI that plays mechanical keyboard sounds on keystrokes
pkgver = 0.2.0
pkgrel = 1
url = https://github.com/S4NKALP/VBX
install = vbx.install
arch = x86_64
arch = aarch64
license = MIT
makedepends = git
makedepends = make
makedepends = gcc
makedepends = pkgconf
makedepends = systemd
depends = libpulse
depends = json-c
depends = libsndfile
depends = libinput
depends = libevdev
depends = systemd-libs
depends = acl
provides = vbx
conflicts = vbx
source = git+https://github.com/S4NKALP/VBX.git
sha256sums = SKIP
pkgname = vbx-git

63
PKGBUILD Normal file
View file

@ -0,0 +1,63 @@
# Maintainer: Sankalp <sankalptharu50028@gmail.com>
pkgname=vbx-git
pkgver=0.2.0.r$(git rev-list --count HEAD 2>/dev/null || echo 0).$(git rev-parse --short HEAD 2>/dev/null || echo unknown)
pkgrel=1
pkgdesc="C-based CLI that plays mechanical keyboard sounds on keystrokes"
arch=('x86_64' 'aarch64')
url="https://github.com/S4NKALP/vbx"
license=('MIT')
depends=(
'libpulse'
'json-c'
'libsndfile'
'libinput'
'libevdev'
'systemd-libs' # libudev
'acl' # for setfacl command in install script
)
makedepends=(
'git'
'make'
'gcc'
'pkgconf'
'systemd' # provides libudev.pc headers for compilation
)
provides=('vbx')
conflicts=('vbx')
install="${pkgname}.install"
source=("git+${url}.git")
sha256sums=('SKIP')
pkgver() {
cd "${srcdir}/vbx"
# Generate version dynamically for -git package
printf "0.2.0.r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
build() {
cd "${srcdir}/vbx"
make -j"$(nproc)"
}
package() {
cd "${srcdir}/vbx"
# Install binaries
install -Dm755 vbx "${pkgdir}/usr/bin/vbx"
install -Dm755 audio "${pkgdir}/usr/bin/vbx-audio"
install -Dm755 input "${pkgdir}/usr/bin/vbx-input"
# Install shared data (soundpacks)
install -d "${pkgdir}/usr/share/vbx"
cp -r soundpacks "${pkgdir}/usr/share/vbx/"
# udev rule for access to input devices (install to /etc/udev/rules.d/ like Makefile)
install -Dm644 /dev/stdin "${pkgdir}/etc/udev/rules.d/99-vbx-allow-keyboard.rules" << 'EOF'
# Allow non-root access to input event devices for active seat users and input group
SUBSYSTEM=="input", KERNEL=="event*", TAG+="uaccess", GROUP="input", MODE="0660"
EOF
# License
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

42
vbx.install Normal file
View file

@ -0,0 +1,42 @@
post_install() {
echo "==> Setting up VBX permissions..."
# Reload udev rules
echo "==> Reloading udev rules..."
udevadm control --reload-rules >/dev/null 2>&1 || true
udevadm trigger --subsystem-match=input --action=change >/dev/null 2>&1 || true
# Determine installing user
CURRENT_USER="${SUDO_USER:-$USER}"
if [ -n "$CURRENT_USER" ] && [ "$CURRENT_USER" != "root" ]; then
echo "==> Adding user '$CURRENT_USER' to 'input' group..."
if ! id -nG "$CURRENT_USER" | grep -qw input; then
usermod -a -G input "$CURRENT_USER" 2>/dev/null || true
fi
echo "==> Applying ACLs to existing input devices..."
for dev in /dev/input/event*; do
[ -e "$dev" ] && setfacl -m "u:${CURRENT_USER}:rw" "$dev" 2>/dev/null || true
done
echo ""
echo "==> VBX setup complete for user '$CURRENT_USER'"
echo " ACLs apply to current devices; future ones are handled by udev (TAG+=uaccess)."
echo " Run 'vbx' to test keyboard sounds."
else
echo "==> Could not determine install user."
echo " To enable VBX manually, run: sudo usermod -a -G input \$USER"
fi
}
post_upgrade() {
post_install
}
post_remove() {
echo "==> Removing VBX udev rules..."
udevadm control --reload-rules >/dev/null 2>&1 || true
udevadm trigger --subsystem-match=input --action=change >/dev/null 2>&1 || true
}