/hammerspoon

desktop manager and app launcher for macOS

Primary LanguageLuaMIT LicenseMIT

Cloned and then modified from Awesome-hammerspoon. It is very personal and may not suit your needs.

Intro

My collection of lua scripts for [Hammerspoon](http://www.hammerspoon.org/). It has highly modal-based, vim-styled key bindings, provides some functionality like desktop widgets, window management, application launcher, dictionary translation, cheatsheets... etc.
Add private dir for personal use Model hotkeys mapping and AppLaunchers. 

Plugins and Widgets

caffeinator  -- Prevent computer fall asleep, controlled by bar icon.
AppLauncher -- custom launcher
AClock -- custom transparent green Digital Clock show on top left of every space.
Cheatsheet -- showavailableHotkey (you don't need to remember lots of keybindings, just call cheatsheet.)
CountDownNumber -- custom plugin to display countdown number, complete alert sound, with a chooser
Window Resize -- using keys to control window size
SpoonInstall -- thirdparty Plugin manager
WindowGrid -- thirdparty window manager plugin
Emojis -- thirdparty Emoji plugin 
DeepLTranslate -- thirdparty translate plugin
Cherry -- thirdparty pomodoro plugin, just change some picture/time
Reload Plugins-- thirdparty reload plugin
Custom commands -- send 'exit' hotkey; hide desktop hotkey; show desktop hotkey
Clipboard -- show clipboard content
Mouse control key -- move mouse through keyboard

Get started

  1. Install Hammerspoon first.
  2. git clone https://github.com/zzuse/hammerspoon.git ~/.hammerspoon
  3. Reload the configutation.

and you're set.

Keep update

cd ~/.hammerspoon && git pull

Details

1. Main entry point init.lua.

init.lua ==> private config (awesomeconfig.lua) ==> modalmgr(call basicmode.lua) ==> loadSpoon plugins

2. The modalmgr controls entering appMode, clipboardMode, cheatsheetMode, resizeMode, viewMode, a sign on the bottom right will show mode.

Key bindings Movement
+ M Mode on/off
+ A Enter app mode
+ C Enter clipboard mode
+ R Enter resize mode
+ S Enter cheatsheet mode
+ T Count down number
+ P Count down number pause
+ V Enter view mode
+ I Windows Hint
+ Z Toggle Hammerspoon console
+ G Plugin Window grid
+ E Plugin Emojis
⇧ ^ + E send EXIT to terminal
⇧ ^ + H hide desktop file
⌘ ⇧ ^ + H show desktop file
^ ⌥ ⌘ + C spoon.ReloadConfigure
^ ⌥ ⌘ + D DeepL Translate
^ ⌥ ⌘ + S pomodoro timer tart
^ ⌥ ⌘ + P pomodoro timer pause
^ ⌥ ⌘ + R pomodoro timer resume
^ ⌥ ⌘ + T toggle current time

3. App Mode, it is straightforward, just launch APPs.

4. If you enter viewMODE(ALT+V), you can using your H/I/J/K to scroll your mouse.

Key bindings Movement
H Scroll Leftward
L Scroll Rightward
J Scroll Downward
K Scroll Upward
^ + H Move Mouse Leftward by 50px
^ + L Move Mouse Rightward by 50px
^ + J Move Mouse Downward by 50px
^ + K Move Mouse Upward by 50px
+ H Move Mouse Leftward by 10px
+ L Move Mouse Rightward by 10px
+ K Move Mouse Upward by 10px
+ J Move Mouse Downward by 10px
^ ⇧ + H Move Mouse Leftward by 1px
^ ⇧ + L Move Mouse Rightward by 1px
^ ⇧ + K Move Mouse Upward by 1px
^ ⇧ + J Move Mouse Downward by 1px
, Left Mouse Click
. Right Mouse Click
Q EXIT

5. If you enter resizeMODE, you can using your Y/O/I/M/... to stretch your window.

Key bindings Movement
+ Y 'Shrink Leftward'
+ O 'Stretch Rightward'
+ M 'Stretch Downward'
+ I 'Shrink Upward'
F 'Fullscreen'
C 'Center Window'
+ C 'Resize & Center'
H 'Lefthalf of Screen'
J 'Downhalf of Screen'
K 'Uphalf of Screen'
L 'Righthalf of Screen'
Y 'NorthWest Corner'
N 'SouthWest Corner'
M 'SouthEast Corner',
O 'NorthEast Corner',
= 'Stretch Outward',
- 'Shrink Inward',
+ H 'Move Leftward',
+ L 'Move Rightward',
+ J 'Move Downward',
+ K 'Move Upward',
[ 'Focus Westward',
] 'Focus Eastward',
up 'Move to monitor above'
down 'Move to monitor below'
right 'Move to monitor right'
left 'Move to monitor left',
space 'Move to next monitor'
Q EXIT

6. Custom Countdown Number Plugin

1. A countdown number from chooser dialog

chooser1

2. Result can be obtained from input box if no valid option

chooser2

3. Start a countdown

countdown

4. At last there will be a completion sound alert.

Below is the original author's description, not my personal use.

What's modal-based key bindings?

1. Desktop Widgets

More details

As you may have noticed, there are two clean, nice-looking desktop widgets, analogclock and calendar. Usually we don't interact with them, but I do hope you like them.

UPDATE: Add new widget hcalendar and make it default module. The design comes from here.

hcal

...

Thanks to

More details

http://www.hammerspoon.org/

https://github.com/zzamboni/oh-my-hammerspoon

https://github.com/scottcs/dot_hammerspoon

https://github.com/dharmapoudel/hammerspoon-config

http://tracesof.net/uebersicht/

sample-configurations

Welcome to

Share your scripts and thoughts.

: )