KURANADO2 / hammerspoon-kuranado

Hammerspoon config(Support custom shortcut keys, emoji search, application shortcut switching, real-time network speed, key echo, etc.)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

logo
icon icon icon

English | 简体中文 | 日本語



  • If you think the functions provided by this project are useful to you, please help to click a Star, it would be greatly appreciated, thank you!
  • If the README image cannot be displayed, please make sure that the ladder is hung and ||githubusercontent.com is configured in the PAC file, or directly use the global mode

How to install

All scripts in this project are based on Hammerspoon. Please download and install Hammerspoon, and then execute the following commands:

curl -fsSL https://raw.githubusercontent.com/KURANADO2/hammerspoon-kuranado/main/install.sh | sh

If the above curl command cannot download install.sh, please open the terminal agent and try again or manually download install.sh and execute it

Finally, click the Hammerspoon Reload Config button in the Menubar


Manual update

To install updates manually:

cd ~/.hammerspoon
git pull origin main

If a conflict is found, resolve the conflict and then execute git pull origin main


Auto update

In addition to manual update, this project also supports automatic update check and installation, and automatic update can be turned off in the function menu (not recommended)

The automatic update principle is as follows:

  • .config file (user configuration file) added to .gitignore file
  • Periodically execute git pull origin main
  • If a conflict is found, the console will print the information about the failure of automatic update. In this case, please install the update manually, refer to: Manual update
  • If it is found that the default configuration version number > the configuration version number of the user's local .config file, the new configuration will be merged into the user's local .config file on the basis of retaining the user's original configuration, and the configuration version number will be updated

This project provides functions

Function menu

Click the function item with the mouse to enable/disable the function item


Window move

Alternative to Magnet for window movement

Grid evenly divided (2, 4, 6, 9, 12, 16, etc.):

Swap left and right:


Application switch

Configure shortcut keys for applications, which is more efficient than and Alfred switching programs (it is recommended to assign shortcut keys only to some software that are frequently used)


Emoji search

Shortcut keys K to wake up the emoji search function, enter keywords, up and down keys are used to select and preview emoji packages; left and right keys are used to turn pages; Enter key Used to send emojis; Esc closes the search window

Note: I have implemented this function in Alfred Workflow: https://github.com/KURANADO2/emoji-alfredworkflow. But it has not been maintained for a long time, if you are interested in Alfred, you can also take a look


Real-time internet speed display

Replaces NetWorker Pro Display network speed in real time (refresh every two seconds)


Password paste

Solve the problem that some websites prohibit pasting passwords, and SSH login requires manual password input. First use C to copy the password, then in the password input box, press V to paste the password into the input box. The principle is to read the latest record of the clipboard, and simulate a key event for each character read.


Input method switch

The three most commonly used input methods for individuals:

  • The system comes with ABC
  • The system comes with Simplified Pinyin
  • The system commes with Japanese Input
Shortcut Function
J ABC
K Simplified Pinyin
L Japanese Input Method

Key echo

Alternative to KeyCastr

Note: At present, a simple key echo has been implemented, which is still far from KeyCastr in function, such as:

  • Multi-canvas is not supported
  • Canvas does not support drag and drop
  • lack of animation effects
  • ... Interested guys are welcome to propose implementation ideas, or directly contribute code (do not understand Objective-C very well, and the implementation source code of KeyCastr cannot be understood personally)

Wallpaper switch

Automatically switch a wallpaper every 10 minutes, wallpaper source: Bing


Shortcut list view

Press / in any interface to show/hide the shortcut key list


Reminder after get off work

Remind to get off work at 18:00 every day (modify the script according to the actual off-duty time), click the mouse to close the animation


Default shortcut list

To customize shortcut keys, please modify the shortcut.lua file. If the shortcut.lua file does not exist, execute the following command to create a copy

cp shortcut.lua.example shortcut.lua
Shortcut Function
Z Automatic grid layout of multiple Windows of the same application
X Automatic grid layout of all windows in the same Mission Control Space(What is Mission Control Space??)
A All windows of the same app are automatically divided horizontally or vertically
S All windows in the same Mission Control Space are automatically divided horizontally or vertically
Left half screen
Right half screen
Top half screen
Lower half screen
U Top left corner
I Top right corner
J Lower left
K Bottom right corner
1 1/9
2 2/9
3 3/9
4 4/9
5 5/9
6 6/9
7 7/9
8 8/9
9 9/9
C Center
D Left 1/3 (landscape) or top 1/3 (portrait)
F Medium 1/3
G Right 1/3 (landscape) or bottom 1/3 (portrait)
E Left 2/3 (landscape) or top 2/3 (portrait)
T Right 2/3 (landscape) or bottom 2/3 (portrait)
= Enlarge the window in equal proportion
- Reduce the window proportionally
↩︎ Maximize
Move the window to the upper screen
Move the window to the lower screen
Move the window to the left screen
Move the window to the right screen
` 在同一应用的多个窗口之间切换(此为 Mac 系统自带快捷键)
Q Open QQ
W Open WeChat
V Open Visual Studio Code
F Open Finder
C Open Chrome
J Open Intellij IDEA
N Open WizNote
D Open DataGrip
T Open iTerm2
M Open MailMaster
P Open Postman
O Open Word
E Open Excel
Y Open PyCharm
R Open Another Redis Desktop Manager
K Emoji search
V Paste the characters in the clipboard by simulating keystrokes (to solve the problem that some websites prohibit pasting passwords)
L Switch between Simplified Pinyin and Japanese input methods
/ Show/hide shortcut list

About

About app-bundle-id

In the above configuration, use shortcut keys to switch applications, you need to get the bundle id of the application (please note that the bundle id configured in hammerspoon needs to be case-sensitive, otherwise the console will report an error), which can be obtained as follows:

osascript -e 'id of app "Name of App"'

In addition, if you are using a relatively new Mac system, enter ls /Applications in the terminal, you may not see the application that comes with the system, as shown below, ll cannot see the mail application that comes with the Mac, but the Finder Open the /Applications directory to see the mail application

At this point, we can select the mail application in the Finder, right-click: show package content -> Contents -> open the info.plist file, find the CFBundleIdentifier configuration item, the value of this configuration item is the bundle id, of course, this method is also suitable for own installation. Applications


About the project directory structure

.hammerspoon
├── .config User local configuration file, which saves the enabled/disabled status of each functional module of the user
├── .emoji Emoji cache directory
├── .git
├── .gitignore
├── .wallpaper Wallpaper cache directory
├── LICENSE
├── README.md
├── images Pictures needed for function modules and README
├── init.lua Script entry
└── modules Each functional module
    ├── application.lua Application switch module
    ├── base.lua Encapsulates basic Lua tools
    ├── config.lua Menu default configuration, which records the default enabled/disabled status of each function
    ├── emoji.lua Emoji search module
    ├── hotkey.lua Shortcut list view module
    ├── input-method.lua Input method switch
    ├── keystroke-visualizer.lua Key echo module
    ├── menu.lua Menu module
    ├── network.lua Real-time internet speed module
    ├── password.lua Password paste module
    ├── reload.lua Reload the configuration module (when any .lua file in the ~/.hammerspoon directory changes, the Hammerspoon configuration is automatically reloaded)
    ├── remind.lua Off-duty reminder module
    ├── shortcut.lua Used for user-defined shortcut keys, this file has been added to .gitignore, if there is no such file, execute the command cp shortcut.lua.example shortcut.lua to create a copy
    ├── shortcut.lua.example Example of shortcut key configuration file, users should not modify this file
    ├── update.lua Automatically update modules
    ├── wallpaper.lua Wallpaper switch module
    └── window.lua Window management module

Thanks


Refer

About

Hammerspoon config(Support custom shortcut keys, emoji search, application shortcut switching, real-time network speed, key echo, etc.)

License:MIT License


Languages

Language:Lua 99.0%Language:Shell 1.0%