|
|
@ -1,14 +1,30 @@
|
|
|
|
|
|
|
|
;; fennel-ls doesn't support arbitrary allowed globals, so
|
|
|
|
|
|
|
|
;; unwrap `hs` here to localize it to just one place
|
|
|
|
|
|
|
|
(local {: application
|
|
|
|
|
|
|
|
: dialog
|
|
|
|
|
|
|
|
: eventtap
|
|
|
|
|
|
|
|
: execute
|
|
|
|
|
|
|
|
: fs
|
|
|
|
|
|
|
|
: hotkey
|
|
|
|
|
|
|
|
:loadSpoon load_spoon
|
|
|
|
|
|
|
|
: logger
|
|
|
|
|
|
|
|
: notify
|
|
|
|
|
|
|
|
: pasteboard
|
|
|
|
|
|
|
|
: uielement
|
|
|
|
|
|
|
|
: window} hs)
|
|
|
|
|
|
|
|
|
|
|
|
(local {: mash : smash : modal-bind} (require :hotkey))
|
|
|
|
(local {: mash : smash : modal-bind} (require :hotkey))
|
|
|
|
|
|
|
|
|
|
|
|
(local log (hs.logger.new :log :info))
|
|
|
|
(local log (logger.new :log :info))
|
|
|
|
(set hs.logger.defaultLogLevel :info)
|
|
|
|
(set logger.defaultLogLevel :info)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(set window.animationDuration 0.0)
|
|
|
|
|
|
|
|
|
|
|
|
(set hs.window.animationDuration 0.0)
|
|
|
|
(load_spoon :MiroWindowsManager)
|
|
|
|
(hs.loadSpoon :MiroWindowsManager)
|
|
|
|
|
|
|
|
;; (set spoon.MiroWindowsManager.fullScreenSizes [1 (/ 4 3) 2]) ; only fullscreen
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; fnlfmt: skip
|
|
|
|
;; fnlfmt: skip
|
|
|
|
(spoon.MiroWindowsManager:bindHotkeys {:up [mash :k]
|
|
|
|
(let [{:MiroWindowsManager wm} spoon]
|
|
|
|
|
|
|
|
(wm:bindHotkeys {:up [mash :k]
|
|
|
|
:left [mash :h]
|
|
|
|
:left [mash :h]
|
|
|
|
:down [mash :j]
|
|
|
|
:down [mash :j]
|
|
|
|
:right [mash :l]
|
|
|
|
:right [mash :l]
|
|
|
@ -17,65 +33,85 @@
|
|
|
|
;; :move [smash "m"]
|
|
|
|
;; :move [smash "m"]
|
|
|
|
;; :resize [mash "d"]
|
|
|
|
;; :resize [mash "d"]
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
;; (set wm.fullScreenSizes [1 (/ 4 3) 2]) ; only fullscreen
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
;; debugging
|
|
|
|
;; debugging
|
|
|
|
;; (hs.hotkey.bind mash "d" (fn [] (hs.dialog.blockAlert "message" "text" "one" "two")))
|
|
|
|
; (hotkey.bind mash "d" #(dialog.blockAlert "message" "text" "one" "two"))
|
|
|
|
;; (hs.hotkey.bind mash "d" (fn [] (hs.dialog.alert 100 100 (fn [] ) "message" "text" "one" "two")))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; defeat paste blocking
|
|
|
|
;; defeat paste blocking
|
|
|
|
(hs.hotkey.bind [:cmd :alt] :v
|
|
|
|
(hotkey.bind [:cmd :alt] :v #(eventtap.keyStrokes (pasteboard.getContents)))
|
|
|
|
#(hs.eventtap.keyStrokes (hs.pasteboard.getContents)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(hs.hotkey.bind mash :e
|
|
|
|
(fn run [...]
|
|
|
|
#(let [app (hs.application.frontmostApplication)
|
|
|
|
(accumulate [last nil _ cmd (ipairs [...])]
|
|
|
|
prev-pasteboard (hs.pasteboard.getContents)
|
|
|
|
(execute cmd)))
|
|
|
|
e (hs.uielement.focusedElement)
|
|
|
|
|
|
|
|
text (if e (e:selectedText)
|
|
|
|
(fn with-selection [cb]
|
|
|
|
(do
|
|
|
|
(let [app (application.frontmostApplication)
|
|
|
|
(hs.eventtap.keyStroke [:cmd] :c)
|
|
|
|
prev-pasteboard (pasteboard.getContents)
|
|
|
|
(hs.pasteboard.getContents)))
|
|
|
|
e (uielement.focusedElement)
|
|
|
|
date (hs.execute "date -Iseconds -u | tr -d '\n'")
|
|
|
|
|
|
|
|
file (.. "~/.quickcursor." date)]
|
|
|
|
|
|
|
|
(hs.pasteboard.setContents text)
|
|
|
|
|
|
|
|
(hs.execute (.. "pbpaste > " file))
|
|
|
|
|
|
|
|
(hs.execute (.. "/opt/homebrew/bin/neovide --nofork " file))
|
|
|
|
|
|
|
|
(hs.execute (.. "pbcopy < " file))
|
|
|
|
|
|
|
|
(app:setFrontmost)
|
|
|
|
|
|
|
|
(hs.eventtap.keyStroke [:cmd] :v)
|
|
|
|
|
|
|
|
(hs.execute (.. "rm " file))
|
|
|
|
|
|
|
|
(hs.pasteboard.setContents prev-pasteboard)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(fn linkify []
|
|
|
|
|
|
|
|
(let [app (hs.application.frontmostApplication)
|
|
|
|
|
|
|
|
prev-pasteboard (hs.pasteboard.getContents)
|
|
|
|
|
|
|
|
e (hs.uielement.focusedElement)
|
|
|
|
|
|
|
|
text (if e (e:selectedText)
|
|
|
|
text (if e (e:selectedText)
|
|
|
|
(do
|
|
|
|
(do
|
|
|
|
(hs.eventtap.keyStroke [:cmd] :c)
|
|
|
|
(eventtap.keyStroke [:cmd] :c)
|
|
|
|
(hs.pasteboard.getContents)))
|
|
|
|
(pasteboard.getContents)))
|
|
|
|
link (.. "[" text "]" "(" prev-pasteboard ")")]
|
|
|
|
content (cb text prev-pasteboard)]
|
|
|
|
(hs.pasteboard.setContents link)
|
|
|
|
(pasteboard.setContents content)
|
|
|
|
(app:setFrontmost)
|
|
|
|
(app:setFrontmost)
|
|
|
|
(hs.eventtap.keyStroke [:cmd] :v)
|
|
|
|
(eventtap.keyStroke [:cmd] :v)
|
|
|
|
(hs.pasteboard.setContents prev-pasteboard)))
|
|
|
|
(pasteboard.setContents prev-pasteboard)))
|
|
|
|
|
|
|
|
|
|
|
|
(modal-bind mash "," nil [[mash :l nil linkify]])
|
|
|
|
(fn chomp [s]
|
|
|
|
|
|
|
|
(if (= (s:sub -1) "\n")
|
|
|
|
|
|
|
|
(s:sub 1 -2)
|
|
|
|
|
|
|
|
s))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(hotkey.bind mash :e
|
|
|
|
|
|
|
|
#(with-selection (fn [text]
|
|
|
|
|
|
|
|
(let [home (os.getenv :HOME)
|
|
|
|
|
|
|
|
date (chomp (run "date -Iseconds -u"))
|
|
|
|
|
|
|
|
file (.. home :/.quickcursor. date)]
|
|
|
|
|
|
|
|
(pasteboard.setContents text)
|
|
|
|
|
|
|
|
(run (.. "pbpaste > " file)
|
|
|
|
|
|
|
|
(.. "/opt/homebrew/bin/neovide --nofork "
|
|
|
|
|
|
|
|
file)
|
|
|
|
|
|
|
|
(.. "pbcopy < " file) (.. "rm " file))
|
|
|
|
|
|
|
|
(pasteboard.getContents)))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(hotkey.bind mash :t #(execute :/opt/homebrew/bin/alacritty))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(modal-bind mash "," nil
|
|
|
|
|
|
|
|
[[mash
|
|
|
|
|
|
|
|
:l
|
|
|
|
|
|
|
|
nil
|
|
|
|
|
|
|
|
(fn []
|
|
|
|
|
|
|
|
(with-selection #(.. "[" $1 "]" "(" $2 ")")))]])
|
|
|
|
|
|
|
|
|
|
|
|
;;; Elgato Key Light Air
|
|
|
|
;;; Elgato Key Light Air
|
|
|
|
|
|
|
|
|
|
|
|
; package.loaded["key-light-air"]["find-hostname"]()
|
|
|
|
;; Run `package.loaded["key-light-air"]["find-hostname"]()`
|
|
|
|
; package.loaded["key-light-air"]["update"](false)
|
|
|
|
;; to find the hostname of the Key Light Air
|
|
|
|
(require :key-light-air)
|
|
|
|
(require :key-light-air)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Quitter
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(let [{: start} (require :quitter-fnl)]
|
|
|
|
|
|
|
|
(start {:Calendar 30
|
|
|
|
|
|
|
|
:Discord 300
|
|
|
|
|
|
|
|
:MailMate 600
|
|
|
|
|
|
|
|
:Messages 300
|
|
|
|
|
|
|
|
:Reeder 600
|
|
|
|
|
|
|
|
:Slack 300
|
|
|
|
|
|
|
|
:Telegram 300}))
|
|
|
|
|
|
|
|
|
|
|
|
;;; Spoons
|
|
|
|
;;; Spoons
|
|
|
|
|
|
|
|
|
|
|
|
(: (hs.loadSpoon :ReloadConfiguration) :start)
|
|
|
|
(: (load_spoon :ReloadConfiguration) :start)
|
|
|
|
|
|
|
|
|
|
|
|
;; Local overrides
|
|
|
|
;; Local overrides
|
|
|
|
(when (hs.fs.attributes :local.fnl)
|
|
|
|
(when (fs.attributes :local.fnl)
|
|
|
|
(require :local))
|
|
|
|
(require :local))
|
|
|
|
|
|
|
|
|
|
|
|
(: (hs.notify.new {:title :Hammerspoon
|
|
|
|
(: (notify.new {:title :Hammerspoon
|
|
|
|
:informativeText "Config loaded"
|
|
|
|
:informativeText "Config loaded"
|
|
|
|
:withdrawAfter 2}) :send)
|
|
|
|
:withdrawAfter 2}) :send)
|
|
|
|
|
|
|
|
|
|
|
|