Created
June 2, 2016 06:07
-
-
Save ahungry/d8be8dca688aae05824ddee4122e90cd to your computer and use it in GitHub Desktop.
send in special unicode chars np
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defcommand wss (string) () | |
"Send a string of characters, including non-ascii ones (needs work for more than 1 char at a time)" | |
(map nil (lambda (ch) | |
(let* ((char-code (char-code ch)) | |
(keysym (+ char-code (if (>= char-code #x100) #x01000000 0)))) ;; Only applicable if code >= #x100 | |
(xlib:change-keyboard-mapping | |
*display* | |
(make-array '(1 1) :initial-element keysym) | |
;;#2A( | |
;;#(16778171) ;; λ in slot 8 | |
;;#(16777618) ;; ƒ in slot 9 | |
;; ) | |
:first-keycode 8) ;; todo - check for first free keycode that doesn't have a keysym vs assuming its #8 | |
(xtest:fake-key-event *display* 8 t :delay 0) | |
(xtest:fake-key-event *display* 8 nil :delay 1))) string)) | |
(defcommand xdo-lambda () () | |
(wss "λ")) | |
;;(run-shell-command "xdotool type λ")) | |
(defcommand xdo-fn () () | |
(wss "ƒ")) | |
;;(run-shell-command "xdotool type ƒ")) | |
(defcommand xdo-alpha () () | |
(wss "α")) | |
;;(run-shell-command "xdotool type α")) | |
(defcommand xdo-arrow () () | |
(wss "→")) | |
;;(run-shell-command "xdotool type →")) | |
(defcommand xdo-psi () () | |
(wss "ψ")) | |
;;(run-shell-command "xdotool type ψ")) | |
(defcommand xdo-plus-minus () () | |
(wss "±")) | |
;;(run-shell-command "xdotool type ±")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment