Skip to content

Instantly share code, notes, and snippets.

@lktslionel
Forked from rstacruz/miryoku.md
Created March 4, 2025 16:40
Show Gist options
  • Save lktslionel/17fe052ebd3df62507b03bdf7217624f to your computer and use it in GitHub Desktop.
Save lktslionel/17fe052ebd3df62507b03bdf7217624f to your computer and use it in GitHub Desktop.
Miyoku diagram

Miryoku layout diagram

An ASCII diagram of the Miryoku layout based on this image.

miryoku

base       ┌────┬────┬────┬────┬────┐   ┌────┬────┬────┬────┬────┐
           │ q  │ w  │ f  │ p  │ b  │   │ j  │ l  │ u  │ y  │ '  │
           ├────┼────┼────┼────┼────┤   ├────┼────┼────┼────┼────┤
           │ a ⌥│ r ⌘│ s ^│ t ⇧│ g  │   │ m  │ n ⇧│ e ^│ i ⌘│ o ⌥│
           ├────┼────┼────┼────┼────┤   ├────┼────┼────┼────┼────┤
           │ z  │ x  │ c  │ d  │ v  │   │ k  │ h  │ ,  │ .  │ /  │
           └────┴────┴────┴────┴────┘   └────┴────┴────┴────┴────┘
                     │esc │ ┄┄ │tab │   │ent │bks │del │
                     └────┴────┴────┘   └────┴────┴────┘
                     media nav  mous     sym  num  fun

sym        ┌────┬────┬────┬────┬────┐   ┌────┬────┬────┬────┬────┐
           │ {  │ &  │ *  │ (  │ }  │   │    │    │    │    │    │
           ├────┼────┼────┼────┼────┤   ├────┼────┼────┼────┼────┤
           │ :  │ $  │ %  │ ^  │ +  │   │    │    │    │    │    │
           ├────┼────┼────┼────┼────┤   ├────┼────┼────┼────┼────┤
           │ ~  │ !  │ @  │ #  │ |  │   │    │    │    │    │    │
           └────┴────┴────┴────┴────┘   └────┴────┴────┴────┴────┘
                     │ (  │ )  │ _  │   │ ▀▀ │    │    │
                     └────┴────┴────┘   └────┴────┴────┘
num        ┌────┬────┬────┬────┬────┐   ┌────┬────┬────┬────┬────┐
           │ [  │ 7  │ 8  │ 9  │ ]  │   │    │    │    │    │    │
           ├────┼────┼────┼────┼────┤   ├────┼────┼────┼────┼────┤
           │ ;  │ 4  │ 5  │ 6  │ =  │   │    │    │    │    │    │
           ├────┼────┼────┼────┼────┤   ├────┼────┼────┼────┼────┤
           │ `  │ 1  │ 2  │ 3  │ \  │   │    │    │    │    │    │
           └────┴────┴────┴────┴────┘   └────┴────┴────┴────┴────┘
                     │ .  │ 0  │ -  │   │    │ ▀▀ │    │
                     └────┴────┴────┘   └────┴────┴────┘
fun        ┌────┬────┬────┬────┬────┐   ┌────┬────┬────┬────┬────┐
           │f12 │ f7 │ f8 │ f9 │prnt│   │    │    │    │    │    │
           ├────┼────┼────┼────┼────┤   ├────┼────┼────┼────┼────┤
           │f11 │ f4 │ f5 │ f6 │scrl│   │    │    │    │    │    │
           ├────┼────┼────┼────┼────┤   ├────┼────┼────┼────┼────┤
           │f10 │ f1 │ f2 │ f3 │paus│   │    │    │    │    │    │
           └────┴────┴────┴────┴────┘   └────┴────┴────┴────┴────┘
                     │menu│    │    │   │    │    │ ▀▀ │
                     └────┴────┴────┘   └────┴────┴────┘
nav        ┌────┬────┬────┬────┬────┐   ┌────┬────┬────┬────┬────┐
           │    │    │    │    │    │   │ ^y │ ^v │ ^c │ ^x │ ^z │
           ├────┼────┼────┼────┼────┤   ├────┼────┼────┼────┼────┤
           │    │    │    │    │    │   │.   │ ◁  │ ▽  │ △  │ ▷  │
           ├────┼────┼────┼────┼────┤   ├────┼────┼────┼────┼────┤
           │    │    │    │    │    │   │ins │hom │pg↓ │pg↑ │end │
           └────┴────┴────┴────┴────┘   └────┴────┴────┴────┴────┘
                     │    │ ▀▀ │    │   │    │    │    │
                     └────┴────┴────┘   └────┴────┴────┘
mous       ┌────┬────┬────┬────┬────┐   ┌────┬────┬────┬────┬────┐
           │    │    │    │    │    │   │ ^y │ ^v │ ^c │ ^x │ ^z │
           ├────┼────┼────┼────┼────┤   ├────┼────┼────┼────┼────┤
           │    │    │    │    │    │   │    │ ◁  │ ▽  │ △  │ ▷  │
           ├────┼────┼────┼────┼────┤   ├────┼────┼────┼────┼────┤
           │    │    │    │    │    │   │    │mw◁ │mw▽ │mw△ │mw▷ │
           └────┴────┴────┴────┴────┘   └────┴────┴────┴────┴────┘
                     │    │    │ ▀▀ │   │ m¹ │ m² │ m³ │
                     └────┴────┴────┘   └────┴────┴────┘
@lktslionel
Copy link
Author

iturn0image0turn0image1turn0image3turn0image5Understood! Let's create a comprehensive package for the Miryoku Layout tailored for your Piantor keyboard using Kanata. This package will include:

  1. Visual Cheat Sheet: A graphical representation of all layers specific to your Piantor keyboard.
  2. Modular Configuration Files: Kanata configuration files organized for easy customization.
  3. Hammerspoon Scripts: macOS automation scripts to enhance productivity.
  4. Additional Productivity Enhancements: Tools and configurations to further boost your workflow.

1. Visual Cheat Sheet of All Layers

A visual cheat sheet serves as a quick reference for your keyboard layout, helping you memorize key placements and layer functionalities. Below is a graphical representation of the layers for your Piantor keyboard:

Base Layer (U_BASE):

[Esc] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 0 ] [ - ] [ = ]
[ Tab ] [ Q ] [ W ] [ E ] [ R ] [ T ] [ Y ] [ U ] [ I ] [ O ] [ P ] [ [ ] [ ] ]
[ Caps ] [ A ] [ S ] [ D ] [ F ] [ G ] [ H ] [ J ] [ K ] [ L ] [ ; ] [ ' ] [ \ ]
[ Shift ] [ Z ] [ X ] [ C ] [ V ] [ B ] [ N ] [ M ] [ , ] [ . ] [ / ] [ Shift ]
[ Ctrl ] [ Alt ] [ Cmd ] [ Space ] [ Cmd ] [ Alt ] [ Ctrl ]

Navigation Layer (U_NAV):

[ F1 ] [ F2 ] [ F3 ] [ F4 ] [ F5 ] [ F6 ] [ F7 ] [ F8 ] [ F9 ] [ F10 ] [ F11 ] [ F12 ]
[ PrtSc ] [ ScrLk ] [ Pause ] [ Insert ] [ Home ] [ PgUp ] [ Delete ] [ End ] [ PgDn ]
[ Left ] [ Down ] [ Up ] [ Right ]

Symbols Layer (U_SYM):

[ ~ ] [ ! ] [ @ ] [ # ] [ $ ] [ % ] [ ^ ] [ & ] [ * ] [ ( ] [ ) ] [ _ ]
[ ` ] [ - ] [ = ] [ [ ] [ ] ] [ ; ] [ ' ] [ , ] [ . ] [ / ]
[ < ] [ > ] [ ? ] [ : ] [ " ] [ { ] [ | ] [ } ] [ ~ ]

Note: The above layouts are illustrative. Adjust them based on your specific Miryoku configuration.

2. Modular Configuration Files for Kanata

Organizing your Kanata configuration into modular files enhances maintainability and customization. Below is a suggested structure:

kanata/
├── keymap.kbd          # Main keymap file
├── layers/            # Directory for layer configurations
│   ├── base.kbd       # Base layer (alphabets and numbers)
│   ├── nav.kbd       # Navigation layer (arrows, page up/down)
│   ├── symbols.kbd   # Symbols layer (punctuation, special characters)
│   └── function.kbd  # Function layer (F-keys, media controls)
├── macros.kbd         # File for defining macros
└── config.kbd         # General configuration settings

Main Keymap File (keymap.kbd):

# Main keymap file
(include "config.kbd")
(include "layers/base.kbd")
(include "layers/nav.kbd")
(include "layers/symbols.kbd")
(include "layers/function.kbd")
(include "macros.kbd")

Base Layer Configuration (layers/base.kbd):

# Base layer configuration
(deflayer U_BASE
  (defsrc
    esc 1 2 3 4 5 6 7 8 9 0 - =
    tab Q W E R T Y U I O P [ ]
    caps A S D F G H J K L ; '
    shift Z X C V B N M , . /
    ctrl alt cmd space cmd alt ctrl
  )
)

Repeat similar structures for nav.kbd, symbols.kbd, and function.kbd, defining the respective layers.

Macros File (macros.kbd):

# Define macros
(defmacro open_terminal
  "Open the Terminal application"
  (hyper t)
  (exec "open -a Terminal")
)

(defmacro screenshot
  "Take a screenshot and save to desktop"
  (hyper 4)
  (exec "screencapture -i ~/Desktop/screenshot.png")
)

General Configuration (config.kbd):

# General configuration settings
(defcfg
  process-unmapped-keys yes
  # Add other global settings as needed
)

3. Hammerspoon Scripts for Quick Automation

Hammerspoon is a powerful automation tool for macOS that allows you to write Lua scripts to control various aspects of your system. Below are some example scripts to enhance your productivity:

Window Management:

-- Resize and position windows
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "Left", function()
  local win = hs.window.focusedWindow()
  win:moveToUnit("left50")
end)

hs.hotkey.bind({"cmd", "alt", "ctrl"}, "Right", function()
  local win = hs.window.focusedWindow()
  win:moveToUnit("right50")
end)

Application Launchers:

-- Launch applications
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "T", function()
  hs.application.launchOrFocus("Terminal")
end)

hs.hotkey.bind({"cmd", "alt", "ctrl"}, "S", function()
  hs.application.launchOrFocus("Safari")
end)

Clipboard Manager:

-- Clipboard history
local clipboardHistory = {}
hs.pasteboard.setContents("")
hs.timer.doEvery(1, function()
  local content = hs.pasteboard.getContents()
  if content and content ~= "" and content ~= clipboardHistory[1] then
    table.insert(clipboardHistory, 1, content)
    if #clipboardHistory > 10 then
      table.remove(clipboardHistory, 11)
    end
  end
end)

For more Hammerspoon scripts and ideas, refer to [this article](https://micahkepe.com/blog/workflow-automation/).

4. Additional Productivity Enhancements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment