improve map-touch-display

This commit is contained in:
LordMZTE 2023-02-13 18:54:41 +01:00
parent 0a1d7f5dac
commit 44d060c036
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6

View file

@ -2,16 +2,12 @@
#lang racket
;; This script is used to map the xinput device(s) of my external touch
;; display to the correspondung X screen.
;; display to the corresponding X screen.
(define screen
(vector-ref (current-command-line-arguments) 0))
(define screen (command-line #:args (screen) screen))
(define output
(with-output-to-string
(λ () (system* (find-executable-path "xinput") "--list"))))
(define cmd-outp (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)))
(for ([line (string-split cmd-outp "\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))