Skip to content

Commit

Permalink
Add config option for mac modifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
englmaxi committed Jun 17, 2024
1 parent 2c245ea commit 5735b26
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 46 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
91 changes: 47 additions & 44 deletions boards/shields/dongle_display/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -1,45 +1,48 @@
# Copyright (c) 2024 The ZMK Contributors
# SPDX-License-Identifier: MIT

if SHIELD_DONGLE_DISPLAY

choice ZMK_DISPLAY_STATUS_SCREEN
default ZMK_DISPLAY_STATUS_SCREEN_CUSTOM
endchoice

config ZMK_DISPLAY_STATUS_SCREEN_CUSTOM
select LV_USE_LABEL
select LV_USE_IMG
select LV_USE_CANVAS
select LV_USE_ANIMIMG
select LV_USE_ANIMATION
select LV_USE_LINE
select LV_FONT_UNSCII_8
select ZMK_WPM
imply ZMK_HID_INDICATORS

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)

choice ZMK_DISPLAY_WORK_QUEUE
default ZMK_DISPLAY_WORK_QUEUE_DEDICATED
endchoice

config LV_Z_MEM_POOL_SIZE
default 8192

config LV_Z_VDB_SIZE
default 64

config LV_DPI_DEF
default 148

config LV_Z_BITS_PER_PIXEL
default 1

choice LV_COLOR_DEPTH
default LV_COLOR_DEPTH_1
endchoice

# Copyright (c) 2024 The ZMK Contributors
# SPDX-License-Identifier: MIT

if SHIELD_DONGLE_DISPLAY

choice ZMK_DISPLAY_STATUS_SCREEN
default ZMK_DISPLAY_STATUS_SCREEN_CUSTOM
endchoice

config ZMK_DISPLAY_STATUS_SCREEN_CUSTOM
select LV_USE_LABEL
select LV_USE_IMG
select LV_USE_CANVAS
select LV_USE_ANIMIMG
select LV_USE_ANIMATION
select LV_USE_LINE
select LV_FONT_UNSCII_8
select ZMK_WPM
imply ZMK_HID_INDICATORS

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

config LV_Z_MEM_POOL_SIZE
default 8192

config LV_Z_VDB_SIZE
default 64

config LV_DPI_DEF
default 148

config LV_Z_BITS_PER_PIXEL
default 1

choice LV_COLOR_DEPTH
default LV_COLOR_DEPTH_1
endchoice

endif
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 5735b26

Please sign in to comment.