aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md44
-rw-r--r--examples/skhdrc26
2 files changed, 58 insertions, 12 deletions
diff --git a/README.md b/README.md
index 597fa18..9b8cc59 100644
--- a/README.md
+++ b/README.md
@@ -2,10 +2,6 @@
**skhd** is a simple hotkey daemon for macOS. It is a stripped version of [**khd**](https://github.com/koekeishiya/khd)
(although rewritten from scratch), that sacrifices the more advanced features in favour of increased responsiveness and performance.
-
-**skhd** uses a subset of the grammar that **khd** uses. In other words, **khd** is able to load and run **skhd** config files without having
-to make any changes to the file. This makes it very simple to migrate between **skhd** and **khd** on demand.
-
**skhd** is able to hotload its config file, meaning that hotkeys can be edited and updated live while **skhd** is running.
**skhd** has an improved parser that is able to accurately identify both the line and character position of any symbol that does not
@@ -17,11 +13,10 @@ feature comparison between **skhd** and **khd**
| feature | skhd | khd |
|:--------------------------:|:----:|:---:|
| hotload config file | [x] | [ ] |
-| store hotkey in hashmap | [x] | [ ] |
-| store hotkey in linked-list| [ ] | [x] |
+| store hotkeys in hashmap | [x] | [ ] |
| require unix domain socket | [ ] | [x] |
| hotkey passthrough | [x] | [x] |
-| modal hotkey-system | [ ] | [x] |
+| modal hotkey-system | [x] | [x] |
| application specific hotkey| [ ] | [x] |
| modifier only hotkey | [ ] | [x] |
| caps-lock as hotkey | [ ] | [x] |
@@ -76,12 +71,16 @@ A list of all built-in modifier and literal keywords can be found [here](https:/
A hotkey is written according to the following rules:
```
-hotkey = <keysym> ':' <command> |
- <keysym> '->' ':' <command>
+hotkey = <mode> '<' <action> | <action>
+
+mode = 'name of mode' | <mode> ',' <mode>
+
+action = <keysym> ':' <command> | <keysym> '->' ':' <command>
+ <keysym> ';' <mode> | <keysym> '->' ';' <mode>
keysym = <mod> '-' <key> | <key>
-mod = 'built-in mod keyword' | <mod> '+' <mod>
+mod = 'modifier keyword' | <mod> '+' <mod>
key = <literal> | <keycode>
@@ -102,3 +101,28 @@ command = command is executed through '$SHELL -c' and
an EOL character signifies the end of the bind.
```
+
+A mode can be defined in two different ways:
+```
+# define mode 'switcher' with an on_enter command
+:: switcher : chunkc border::color 0xff24ccaa
+
+# define modes without an on_enter command
+:: swap
+:: focus
+```
+
+Modal sample:
+```
+# defines a new mode named 'test'
+:: test
+
+# from 'default' mode, activate mode 'test'
+cmd - x ; test
+
+# from 'test' mode, activate mode 'default'
+test < cmd - x ; default
+
+# launch a new terminal instance when in either 'default' or 'test' mode
+default, test < cmd - return : open -na /Applications/Terminal.app
+```
diff --git a/examples/skhdrc b/examples/skhdrc
index e6864e7..f10eb81 100644
--- a/examples/skhdrc
+++ b/examples/skhdrc
@@ -3,8 +3,12 @@
#
# A hotkey is written according to the following rules:
#
-# hotkey = <keysym> ':' <command> |
-# <keysym> '->' ':' <command>
+# hotkey = <mode> '<' <action> | <action>
+#
+# mode = 'name of mode' | <mode> ',' <mode>
+#
+# action = <keysym> ':' <command> | <keysym> '->' ':' <command>
+# <keysym> ';' <mode> | <keysym> '->' ';' <mode>
#
# keysym = <mod> '-' <key> | <key>
#
@@ -28,6 +32,24 @@
# prepend '\' at the end of the previous line.
#
# an EOL character signifies the end of the bind.
+#
+#
+# NOTE(koekeishiya): Modal operations
+#
+# defines a new mode 'switcher' with an on_enter command
+# :: switcher : chunkc border::color 0xff24ccaa
+#
+# defines a new mode named 'test'
+# :: test
+#
+# from 'default' mode, activate mode 'test'
+# cmd - x ; test
+#
+# from 'test' mode, activate mode 'default'
+# test < cmd - x ; default
+#
+# launch a new terminal instance when in either 'default' or 'test' mode
+# default, test < cmd - return : open -na /Applications/Terminal.app
# open terminal, blazingly fast compared to iTerm/Hyper