dotfiles/scripts/map-touch-display.rkt

14 lines
531 B
Racket
Raw Normal View History

2023-02-12 23:03:29 +01:00
#!/usr/bin/env racket
#lang racket
;; This script is used to map the xinput device(s) of my external touch
2023-02-13 18:54:41 +01:00
;; display to the corresponding X screen.
2023-02-12 23:03:29 +01:00
2023-02-13 18:54:41 +01:00
(define screen (command-line #:args (screen) screen))
2023-02-12 23:03:29 +01:00
2023-02-13 18:54:41 +01:00
(define cmd-outp (with-output-to-string (λ () (system* (find-executable-path "xinput") "--list"))))
2023-02-12 23:03:29 +01:00
2023-02-13 18:54:41 +01:00
(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))