Attempt to udev better

main
Dan Buch 2 years ago
parent 4c5e73305f
commit ebb5b6db13
Signed by: meatballhat
GPG Key ID: A12F782281063434

@ -1,3 +1,5 @@
SUDO ?= sudo
TOP_SOURCES := $(shell git ls-files | grep -vE 'README|Makefile|^config|^\.git|^\.travis' | grep -v /)
CONFIG_SOURCES := $(shell git ls-files config)
LOCAL_BIN_SOURCES := $(shell git ls-files local/bin)
@ -5,7 +7,9 @@ TARGETS := \
$(patsubst %,$(HOME)/.%,$(TOP_SOURCES)) \
$(patsubst %,$(HOME)/.%,$(CONFIG_SOURCES)) \
$(patsubst %,$(HOME)/.%,$(LOCAL_BIN_SOURCES)) \
$(HOME)/.config/i3/config
$(HOME)/.config/i3/config \
/etc/udev/rules.d/90-trackman-marble.rules \
/usr/local/bin/handle-trackman-marble
$(HOME)/.%: %
$(RM) '$@' && mkdir -p $(dir $@) && ln -svf '$(PWD)/$^' '$@'
@ -19,6 +23,12 @@ $(HOME)/.config:
$(HOME)/.local/bin:
mkdir -p $@
/etc/udev/rules.d/90-trackman-marble.rules: udev/rules.d/90-trackman-marble.rules
$(SUDO) install -m 0644 -v udev/rules.d/90-trackman-marble.rules $@
/usr/local/bin/handle-trackman-marble: udev/handle-trackman-marble
$(SUDO) install -m 0644 -v udev/handle-trackman-marble $@
.PHONY: echo
echo:
@echo TOP_SOURCES=$(TOP_SOURCES)

@ -1,14 +1,17 @@
#!/usr/bin/env bash
set -o errexit
set -o pipefail
main() {
export RUNNING_AS="${RUNNING_AS:-me}"
export RUNNING_AS_ID="$(id -u "${RUNNING_AS}")"
export XINPUT_EXE="${XINPUT_EXE:=xinput}"
export RUNNING_AS="${RUNNING_AS:-dan}"
RUNNING_AS_ID="$(id -u "${RUNNING_AS}")"
export RUNNING_AS_ID
export XAUTHORITY="/home/${RUNNING_AS}/.Xauthority"
export XINPUT_EXE="${XINPUT_EXE:=xinput}"
export XAUTHORITY="/run/user/${RUNNING_AS_ID}/gdm/Xauthority"
export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/${RUNNING_AS_ID}/bus"
export DISPLAY=:0
: "${DISPLAY:=0}"
export DISPLAY
export HOME="/home/${RUNNING_AS}"
@ -25,8 +28,14 @@ main() {
__get_prop_id "${device_id}" 'Scroll Method Enabled'
)"
local scrollbutton
scrollbutton="$(
__get_prop_id "${device_id}" 'Button Scrolling Button'
)"
__run_xinput_as set-prop "${device_id}" "${natscroll_enabled}" 1
__run_xinput_as set-prop "${device_id}" "${scrollmeth_enabled}" 0 0 1
__run_xinput_as set-prop "${device_id}" "${scrollbutton}" 8
}
__get_device_id() {

@ -1 +1 @@
ACTION=="bind", SUBSYSTEM=="usb", ENV{ID_VENDOR}=="Logitech", ENV{ID_SERIAL}=="Logitech_USB_Trackball", RUN:="/usr/local/bin/handle-trackman-marble"
ACTION=="bind", SUBSYSTEM=="usb", ENV{NAME}=="Logitech USB Trackball", MODE="0660", TAG+="uaccess", RUN:="/usr/local/bin/handle-trackman-marble"

Loading…
Cancel
Save