"Hammerspoon" Mac automation tool personal script sharing

"Hammerspoon" Mac automation tool personal script sharing

This project is a configuration extension of Hammerspoon

Installation configuration and upgrade:

Install hammerspoon

brew cask install hammerspoon

Clone the configuration file to the local root directory.

git clone https://github.com/Moking1997/hammerspoon ~/.hammerspoon

Reload the configuration file to take effect .

If prompted:. already exists and is not an empty directoryDelete the directory first

rm -rf ~/.hammerspoon


cd ~/.hammerspoon && git pull

Custom configuration

Copy private configuration file

cp ~/.hammerspoon/config-example.lua ~/.hammerspoon/private/config.lua

According to a private comment to edit the configuration file ~/.hammerspoon/private/config.luacan be.

Function realization:

Note: All modes Press escand qexit.

How to use:

The following quick keys can be key in private/config.luathe next configurable

FeaturesdescriptionShortcut key/example
Help panelDisplay the help panel to view shortcut keys for each modeshift+ option+/
Quick searchIt is \a quick search of the corresponding website by adding keywordsEnter test\gwill search test with Google
Quick text inputIs to \add keywords for quick text inputInput \t1will be entered automatically15057466****
Window managementEnter window management modeOption + R
display timeDisplay the current time and dateOption + T
Website opens quicklyOpen the website list and automatically open with the default browser after selectionOption + O
Fast application switchingDisplay window prompt, press the letter displayed by the corresponding application to quickly switchOption + tab
History clipboardHistory clipboard, select the corresponding input to the current input boxOption + C
Real-time internet speedReal-time display of internet speed at the topOn by default


Realization ideas:

The main idea is to use mac's built-in focused search, monitor/as a keyword (because it is rarely used after all) to implement script actions, such as

Enter the search content in the focused search \g,\bd,\hubto perform Google, Baidu, GitHub searches, and more search sites can be added

Text extension: input to \t1,/t2,\t3 achieve quick input of your own mailbox and mobile phone

Website open: Enter \o1,\o2,\o3to open station b, v2ex, nuggets, etc.

The main script operation in the focus search is to automatically trigger after listening to the specified keyword

Select all -> copy -> get text content => use text content for related operations

So use the search operation carefully in the code editor, it is best to do it in the focus search or chat input box