ch11ng / exwm

Emacs X Window Manager
2.85k stars 135 forks source link

Feature request: automation of x windows #553

Open QiangF opened 5 years ago

QiangF commented 5 years ago

Something like autohotkey: easy recording of macros that can simulate mouse click, key press and window selection. I am working on a solution of the mouse and keyboard part based on

https://github.com/boppreh/keyboard https://github.com/boppreh/mouse

Those are pure python package but need sudo right.

(defun sudo-shell-command (command)
(interactive "MShell command (root): ")
(with-temp-buffer
    (cd "/sudo::/")
    (async-shell-command-no-window command)))

; emacs 26: (setq async-shell-command-display-buffer nil)
(defun async-shell-command-no-window (command)
(interactive)
(let ((display-buffer-alist
        (list (cons "\\*Async Shell Command\\*.*"
        (cons #'display-buffer-no-window nil)))))
    (async-shell-command command)))

I believe a pure lisp solution would make the following possible:

  1. with window selection (focus or switching) ability
  2. can print prompt or message in the echo area
  3. record key respect my xmodmap ( I have capslock remapped to ctl)

Nice macro packages: https://github.com/Silex/elmacro https://github.com/jaalto/project-emacs--tinymacro

QiangF commented 5 years ago

I need experts help in make the python approach work. See my issue here https://github.com/manateelazycat/aweshell/issues/30 To record mouse and keyboard at the same time https://github.com/boppreh/mouse/issues/5

ch11ng commented 5 years ago

Something like autohotkey: easy recording of macros that can simulate mouse click, key press and window selection.

Recording and replaying keyboard events is already possible with Emacs's builtin keyboard macro (please report quirks if any). Currently this does not support mouse events but it should be possible. I'm not sure how window selection should be handled as in EXWM it may involve buffer/workspace switching; perhaps it should just be replaced by keyboard & mouse events?