Skip to content

Commit

Permalink
Add config option to use mac modifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
englmaxi committed Jun 17, 2024
1 parent 3e1cd72 commit 3ec7910
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ manifest:
import: app/west.yml
- name: zmk-dongle-display
remote: englmaxi
revision: win # Windows modifier symbols
# revision: mac # MacOS modifier symbols
revision: main
self:
path: config
```
Expand Down Expand Up @@ -56,6 +55,12 @@ To also display the battery level of the dongle/central device, use the followin
CONFIG_ZMK_DONGLE_DISPLAY_DONGLE_BATTERY=y
```

If you want to use MacOS modifier symbols instead of the Windows modifier symbols, use the following configuration property:

```ini
CONFIG_ZMK_DONGLE_DISPLAY_MAC_MODIFIERS=y
```

## Demo
![output](https://github.com/englmaxi/zmk-config/assets/43675074/8d268f23-1a4f-44c3-817e-c36dc96a1f8b)
![mods](https://github.com/englmaxi/zmk-config/assets/43675074/af9ec3f5-8f61-4629-abed-14ba0047f0bd)
Expand Down
3 changes: 3 additions & 0 deletions boards/shields/dongle_display/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ config ZMK_DONGLE_DISPLAY_DONGLE_BATTERY
bool "Show also the battery level of the dongle"
depends on BT && (!ZMK_SPLIT_BLE || ZMK_SPLIT_ROLE_CENTRAL)

config ZMK_DONGLE_DISPLAY_MAC_MODIFIERS
bool "Use MacOS modifier symbols instead of the Windows symbols"

choice ZMK_DISPLAY_WORK_QUEUE
default ZMK_DISPLAY_WORK_QUEUE_DEDICATED
endchoice
Expand Down
22 changes: 22 additions & 0 deletions boards/shields/dongle_display/widgets/modifiers.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,27 @@ struct modifier_symbol ms_shift = {
.symbol_dsc = &shift_icon,
};

#if IS_ENABLED(CONFIG_ZMK_DONGLE_DISPLAY_MAC_MODIFIERS)
LV_IMG_DECLARE(opt_icon);
struct modifier_symbol ms_opt = {
.modifier = MOD_LALT | MOD_RALT,
.symbol_dsc = &opt_icon,
};

LV_IMG_DECLARE(cmd_icon);
struct modifier_symbol ms_cmd = {
.modifier = MOD_LGUI | MOD_RGUI,
.symbol_dsc = &cmd_icon,
};

struct modifier_symbol *modifier_symbols[] = {
// this order determines the order of the symbols
&ms_control,
&ms_opt,
&ms_cmd,
&ms_shift
};
#else
LV_IMG_DECLARE(alt_icon);
struct modifier_symbol ms_alt = {
.modifier = MOD_LALT | MOD_RALT,
Expand All @@ -61,6 +82,7 @@ struct modifier_symbol *modifier_symbols[] = {
&ms_control,
&ms_shift
};
#endif

#define NUM_SYMBOLS (sizeof(modifier_symbols) / sizeof(struct modifier_symbol *))

Expand Down

0 comments on commit 3ec7910

Please sign in to comment.