A Clojure library designed to simplify using java.awt for handling desktop manipulation commands.
For example, I use robot to change theme in apps:
(require '[robot.core :as r])
;; simulate pressing a single key
(r/type! :shift)
;; simulate pressing hot keys
(r/hot-keys! [:cmd :space])
;; type whole text
(r/type-text! "typing this letters")
;; move cursor to position
(r/mouse-move! 280 1200)
;; getting mouse position
(r/mouse-pos) ;; => [280 1200]
;; simulate mouse click
(r/mouse-click!)
;; simulate mouse wheel
(r/scroll! 10)
;; get pixel color at position
(pixel-color 280 1200)
;; put into clipboard
(r/clipboard-put! "text to put in clipboard")
;; get from clipboard
(r/clipboard-get-string) ;; => text that was in the clipboard
;; you can delay, which will use thread/sleep under the hood
(r/sleep 50)
;; you can also pass delays inside typing functions
(r/type! :k 50) ;; passing millis between press and release
;; same with mouse
(r/mouse-click! 100)
(import java.awt.event.KeyEvent)
(r/type! KeyEvent/VK_A)
(r/hot-keys! [KeyEvent/VK_ALT KeyEvent/VK_SPACE])
There is a function that returns a map with key-codes to key-names:
(r/get-my-keyboard)
;; =>
{3 "⎋", 8 "⌫", 9 "⇥", 10 "⏎", 12 "⌧", 16 "⇧", 17 "⌃", 18 "⌥" ... }
There is also a function to get the name of the particular key-code:
(r/get-key-name 61440)
;; => "F13"
Script to notify developer about standup in Slack
Script to change theme (vim, emacs, chrome, slack, osx, telegram)
Copyright © 2020 Artur Dumchev
This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version, with the GNU Classpath Exception which is available at https://www.gnu.org/software/classpath/license.html.