Skip to content

Commit

Permalink
Add browser shortcuts (and find-replace)
Browse files Browse the repository at this point in the history
  • Loading branch information
magicDGS committed Feb 2, 2025
1 parent feb587f commit 7c1df42
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 23 deletions.
36 changes: 20 additions & 16 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,26 @@ Nevertheless, some behaviors are not available on all OS, and will be marked in

The core definitions are provided by default by the intial setup (including the `init.h` header on the `.keymap` file), which can be used with `&kp` or any other behavior:

| Shortcut | Description | L | W | M |
| ------------ | ------------------------------ | --- | --- | --- |
| `_REDO` | Redo shortcut | ⭐ | ⭐ | ⭐ |
| `_UNDO` | Undo shortcut | ⭐ | ⭐ | ⭐ |
| `_COPY` | Copy shortcut | ⭐ | ⭐ | ⭐ |
| `_PASTE` | Paste shortcut | ⭐ | ⭐ | ⭐ |
| `_FIND` | Find shortcut | ⭐ | ⭐ | ⭐ |
| `_FIND_NEXT` | Find next shortcut | ⭐ | ⭐ | ⭐ |
| `_FIND_PREV` | Find previous shortcut | ⭐ | ⭐ | ⭐ |
| `_HOME` | Home key (shortcut in mac) | ⭐ | ⭐ | ⭐ |
| `_END` | End key (shortcut in mac) | ⭐ | ⭐ | ⭐ |
| `_POWER` | Power shortcut | ⭐ | ❌ | ⭐ |
| `_SLEEP` | Sleep shortcut | ⭐ | ❌ | ⭐ |
| `_LOCK` | Lock shortcut | ⭐ | ⭐ | ⭐ |
| `_MEH` | Meh key (Shift+Ctrl+Alt) | ⭐ | ⭐ | ⭐ |
| `_HYPER` | Hyper key (Shift+Ctrl+Alt+Gui) | ⭐ | ⭐ | ⭐ |
| Shortcut | Description | L | W | M |
| ---------------- | ------------------------------ | --- | --- | --- |
| `_REDO` | Redo shortcut | ⭐ | ⭐ | ⭐ |
| `_UNDO` | Undo shortcut | ⭐ | ⭐ | ⭐ |
| `_COPY` | Copy shortcut | ⭐ | ⭐ | ⭐ |
| `_PASTE` | Paste shortcut | ⭐ | ⭐ | ⭐ |
| `_FIND` | Find shortcut | ⭐ | ⭐ | ⭐ |
| `_FIND_NEXT` | Find next shortcut | ⭐ | ⭐ | ⭐ |
| `_FIND_PREV` | Find previous shortcut | ⭐ | ⭐ | ⭐ |
| `_FIND_REPLACE ` | Find and replace shortcut | ⭐ | ⭐ | ⭐ |
| `_HOME` | Home key (shortcut in mac) | ⭐ | ⭐ | ⭐ |
| `_END` | End key (shortcut in mac) | ⭐ | ⭐ | ⭐ |
| `_POWER` | Power shortcut | ⭐ | ❌ | ⭐ |
| `_SLEEP` | Sleep shortcut | ⭐ | ❌ | ⭐ |
| `_LOCK` | Lock shortcut | ⭐ | ⭐ | ⭐ |
| `_B_SEARCH_BAR` | Browser search bar | ⭐ | ⭐ | ⭐ |
| `_B_URL_BAR` | Browser URL bar | ⭐ | ⭐ | ⭐ |
| `_B_DOWNLOADS` | Browser download shortcut | ⭐ | ⭐ | ⭐ |
| `_MEH` | Meh key (Shift+Ctrl+Alt) | ⭐ | ⭐ | ⭐ |
| `_HYPER` | Hyper key (Shift+Ctrl+Alt+Gui) | ⭐ | ⭐ | ⭐ |

> [!CAUTION]
> The shortcuts might not work as expected if the `&caps_word` behavior is active.
Expand Down
20 changes: 13 additions & 7 deletions include/zmk-keymap-utils/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,19 @@
#elif OPERATING_SYSTEM == 'L'
#define _LOCK K_LOCK
#endif
#define _UNDO _C(Z)
#define _CUT _C(X)
#define _COPY _C(C)
#define _PASTE _C(V)
#define _FIND _C(F)
#define _FIND_NEXT _C(G)
#define _FIND_PREV _C(LS(G))
#define _UNDO _C(Z)
#define _CUT _C(X)
#define _COPY _C(C)
#define _PASTE _C(V)
#define _FIND _C(F)
#define _FIND_NEXT _C(G)
#define _FIND_PREV _C(LS(G))
#define _FIND_REPLACE _C(H)

// Browser shortcuts
#define _B_SEARCH_BAR _C(K)
#define _B_URL_BAR _C(L)
#define _B_DOWNLOADS _C(J)

// meh/hyper as keys and modifiers
// TODO: this might not be necessary after https://github.com/zmkfirmware/zmk/pull/2341
Expand Down

0 comments on commit 7c1df42

Please sign in to comment.