Skip to content

Instantly share code, notes, and snippets.

@ahungry
Created June 2, 2016 06:07
Show Gist options
  • Select an option

  • Save ahungry/d8be8dca688aae05824ddee4122e90cd to your computer and use it in GitHub Desktop.

Select an option

Save ahungry/d8be8dca688aae05824ddee4122e90cd to your computer and use it in GitHub Desktop.

Revisions

  1. ahungry created this gist Jun 2, 2016.
    34 changes: 34 additions & 0 deletions stumpwmrc.lisp
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    (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 ±"))