add map-touch-display script

This commit is contained in:
LordMZTE 2023-02-12 23:03:29 +01:00
parent b6f17e2dc6
commit 67f1b269e7
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
2 changed files with 18 additions and 1 deletions

View file

@ -15,7 +15,7 @@ zls-git
install-scripts target=(`echo $HOME` + "/.local"):
ln -sf \
`pwd`/scripts/{start-joshuto,withjava,startriver} \
`pwd`/scripts/{map-touch-display,start-joshuto,withjava,startriver} \
{{target}}/bin
cd scripts/randomwallpaper && zig build -Doptimize=ReleaseFast -p {{target}}

17
scripts/map-touch-display Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env racket
#lang racket
;; This script is used to map the xinput device(s) of my external touch
;; display to the correspondung X screen.
(define screen
(vector-ref (current-command-line-arguments) 0))
(define output
(with-output-to-string
(λ () (system* (find-executable-path "xinput") "--list"))))
(for ([line (string-split output "\n")])
(when (string-contains? line "TSTP MTouch")
(match-define (list _ id) (regexp-match #px"id=(\\d+)" line))
(system* (find-executable-path "xinput") "map-to-output" id screen)))