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 5fe7e01 commit 2c3f788
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 111 deletions.
139 changes: 72 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,69 +1,74 @@
# Dongle Display

This module repository provides a ZMK shield that replaces the built-in status screen with a custom screen designed for 128x64-pixel OLED displays.

## Usage

To use this module, first add it to your `config/west.yml` by adding a new entry to `remotes` and `projects`:

```yaml west.yml
manifest:
remotes:
- name: zmkfirmware
url-base: https://github.com/zmkfirmware
- name: englmaxi
url-base: https://github.com/englmaxi
projects:
- name: zmk
remote: zmkfirmware
revision: main
import: app/west.yml
- name: zmk-dongle-display
remote: englmaxi
revision: win # Windows modifier symbols
# revision: mac # MacOS modifier symbols
self:
path: config
```
Next, replace the built-in status screen by adding `dongle_display` to your `build.yaml`:

```yaml build.yaml
---
include:
- board: seeeduino_xiao_ble
shield: sweep_central_dongle dongle_display
```

This shield assumes that the dongle is already set up and functioning with the built-in status screen.
For setup examples, refer to the shields in my [`zmk-config`](https://github.com/englmaxi/zmk-config/tree/master/boards/shields).
- If you are using the larger 1.3" OLED, replace `solomon,ssd1306fb` with `sinowealth,sh1106` and set `segment-offset = <2>`.
- If you are using a nice!nano, replace `xiao_i2c ` with `pro_micro_i2c `.

## Widgets
- active hid indicators (CLCK, NLCK, SLCK)
- active modifiers
- bongo cat
- highest layer name
- output status
- peripheral battery levels

## Configuration

To also display the battery level of the dongle/central device, use the following configuration property:

```ini
CONFIG_ZMK_DONGLE_DISPLAY_DONGLE_BATTERY=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)

## Dongle Designs
- [case1](/cases)
- [case2](/cases)
- [PCB with OLED and reset button breakouts](https://github.com/spe2/zmk_dongle_hardware)
- [Macintosh](https://makerworld.com/en/models/403660)
# Dongle Display

This module repository provides a ZMK shield that replaces the built-in status screen with a custom screen designed for 128x64-pixel OLED displays.

## Usage

To use this module, first add it to your `config/west.yml` by adding a new entry to `remotes` and `projects`:

```yaml west.yml
manifest:
remotes:
- name: zmkfirmware
url-base: https://github.com/zmkfirmware
- name: englmaxi
url-base: https://github.com/englmaxi
projects:
- name: zmk
remote: zmkfirmware
revision: main
import: app/west.yml
- name: zmk-dongle-display
remote: englmaxi
revision: main
self:
path: config
```
Next, replace the built-in status screen by adding `dongle_display` to your `build.yaml`:

```yaml build.yaml
---
include:
- board: seeeduino_xiao_ble
shield: sweep_central_dongle dongle_display
```

This shield assumes that the dongle is already set up and functioning with the built-in status screen.
For setup examples, refer to the shields in my [`zmk-config`](https://github.com/englmaxi/zmk-config/tree/master/boards/shields).
- If you are using the larger 1.3" OLED, replace `solomon,ssd1306fb` with `sinowealth,sh1106` and set `segment-offset = <2>`.
- If you are using a nice!nano, replace `xiao_i2c ` with `pro_micro_i2c `.

## Widgets
- active hid indicators (CLCK, NLCK, SLCK)
- active modifiers
- bongo cat
- highest layer name
- output status
- peripheral battery levels

## Configuration

To also display the battery level of the dongle/central device, use the following configuration property:

```ini
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)

## Dongle Designs
- [case1](/cases)
- [case2](/cases)
- [PCB with OLED and reset button breakouts](https://github.com/spe2/zmk_dongle_hardware)
- [Macintosh](https://makerworld.com/en/models/403660)
- [Redox](https://makerworld.com/en/models/242951)
- [ZMK Display Dongle](https://makerworld.com/en/models/496738)
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 2c3f788

Please sign in to comment.