The next step is asking for multiple extension modes!
I've been fiddling a lot with my 'extend' setup and I think it's fairly stable now. I'm really pleased with the awesome possibilities this opens up and it alone is a reason to be running PKL 24/7 and not only a normal Windows layout!
So, let me show you what I've got. First, mappings for the [layout] section of the layout .ini file (I think they should've been somewhere else, as mentioned!) to make it work:
Code:
; *** Using 'CapsLock' as 'extend_key' works best if it is mapped but otherwise disabled
CapsLock = OEM_CAPITAL 0 -- -- -- -- -- ; CapsLock
; *** To make a key work with the 'extend_key' modifier, it needs to be virtual-mapped as below.
; *** When VirtualKey-mapping the BACKSPACE/ENTER keys, use their enumerations BACK/RETURN.
; *** Remapping the TAB key is problematic: Alt-Tab becomes 'sticky', needing Esc to get out.
SC001 = ESCAPE VirtualKey
SC00e = BACK VirtualKey
;SC00f = TAB VirtualKey
SC01c = RETURN VirtualKey
SC039 = SPACE VirtualKey
SC03b = F1 VirtualKey
SC03c = F2 VirtualKey
SC03d = F3 VirtualKey
SC03e = F4 VirtualKey
SC03f = F5 VirtualKey
SC040 = F6 VirtualKey
SC041 = F7 VirtualKey
SC042 = F8 VirtualKey
SC043 = F9 VirtualKey
SC044 = F10 VirtualKey
SC057 = F11 VirtualKey
SC058 = F12 VirtualKey
Now, for the [extend] mappings and more. You'll see that since I use Comfort layouts with and without registry remapping on different computers, I got into a bit of a pickle and had to use trickery; hopefully these things can be separated out in a later PKL edition so the problem becomes moot!
Code:
[extend]
; These keys are modified/transposed by holding down the 'extend key' (CapsLock by default):
;+------+------+------+------+------+------+------+------+------+------+------+------+------+
;|Esc + |F1 <> |F2 << |F3 >> |F4 <> |F5 <> |F6 << |F7 >> |F8 <> |F9 <> |F10<> |F11<> |F12<> |
;| Caps | Play | Prev | Next | Stop | Mute | Vol- | Vol+ | Media| BrHom| Mail | App1 | App2 |
;+======+======+======+======+======+======+======+======+======+======+======+======+======+
;|` ¤¤¤ |1 |2 |3 |4 |5 |6 |7 |8 |9 |0 |- |= |
;| Del | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 |
;+------+------+------+------+------+------+------+------+------+------+------+------+------+
;|Tab |Q ¤¤¤ |W *** |F <<> |P <>> |G *** |J ### |L ### |U ### |Y ### |; ¤¤¤ |[ ¤¤¤ |] ¤¤¤ |
;| | Esc | *WhUp| BrBck| BrFwd| *Btn1| PgUp | Home | Up | End | Del | Esc | Ins |
;+------+------+------+------+------+------+------+------+------+------+------+------+------+
;|Caps+ |A +++ |R *** |S +++ |T +++ |D *** |H ### |N ### |E ### |I ### |O ¤¤¤ |' ¤¤¤ |\ ><> |
;| ++++ | Alt | *WhDn| Shift| Ctrl | *Up17| PgDn | Left | Down | Right| Back | Apps | BrFav|
;+------+------+------+------+------+------+------+------+------+------+------+------+------+
;|Z ¤¤¤ |X === |C === |V === |B *** |_ *** |K *** |M *** |, *** |. *** |/ *** |Spc ¤ |Entr¤ |
;| Undo | Cut | Copy | Paste| *Le17| *Dn17| *Ri17| *Btn3| *WhLe| *WhRi| *Btn2| Enter| Break|
;+------+------+------+------+------+------+------+------+------+------+------+-------------+
;Legend: # Movement; + Modifiers; = GUI edit; * Mouse; <> MultiMedia; ¤ Various commands.
; NOTES:
; - This map shows a 'comfort' Colemak with VK_102 in the middle (the '_' key). See below.
; * The actual remaps are by scan codes though, so the positions are layout independent!
; - Multiple extended mappings would've been nice; this setup is a general/basic one.
; * For instance, accelerated nav/mousing, NumPad/maths, mirroring, coder's toolbox...
; - If your layout doesn't define the key, 'extend' won't work with it!
; * Solution: Put, e.g., 'SC039 = SPACE VirtualKey' etc in your layout .ini file.
; * You'll need Escape/Space/Return/Back and F1-F12 for full functionality.
; - The Tab key is currently a poor candidate for remapping because of problems with AltTab.
; * It might be useable as another extensor/modifier though? (Probably best left alone.)
; - My WARS = modifier block idea didn't work because R cannot map a modifier! A bug?!
; * R can map non-modifiers, so I settled for another solution for now: The mouse wheel.
; * My preferred way would have browsing/modifiers more ergonomically/logically placed:
;+------+------+------+------+------+------+------+------+------+------+------+------+------+
;|Tab |Q ¤¤¤ |W <<> |F <>> |P *** |G *** |J ### |L ### |U ### |Y ### |; ¤¤¤ |[ ¤¤¤ |] ¤¤¤ |
;| | Esc | BrBck| BrFwd| *WhUp| *Btn1| PgUp | Home | Up | End | Del | Esc | Ins |
;+------+------+------+------+------+------+------+------+------+------+------+------+------+
;|Caps+ |A +++ |R +++ |S +++ |T *** |D *** |H ### |N ### |E ### |I ### |O ¤¤¤ |' ¤¤¤ |\ ><> |
;| ++++ | Alt | Ctrl | Shift| *WhDn| *Up17| PgDn | Left | Down | Right| Back | Apps | BrFav|
;+------+------+------+------+------+------+------+------+------+------+------+------+------+
; - A Win key wouldn't be very useful here since nearly all Win hotkeys use letters/nums.
; * It might be put in because of Win-F1/F3, Win-Break and the Start menu.
; * Tip: T+Q (Ctrl-Esc) shows the Start menu too. Win-Help/Win-Search are on that menu.
; - Tech note: The mappings are on the form Send {%YourMappingHere%} (see the AHK Help).
; * Thus, if you want, say, a modified keypress you can use, e.g., '}^{Left}{' or '}#r{'.
; - There isn't a sendable Undo key per se, oddly enough. (Ctrl+Z isn't a hard reach though.)
; * However, A+O (Alt-Back) = Undo (http://www.geocities.com/ian_springer/winkey.html).
; - Mapping something to the Sleep key doesn't seem to do a lot on many computers.
; - The Pause and CtrlBreak are usually both on the same physical key, which is a bit weird.
; * Using Pause, Win+Enter is System Properties.
; * Actually, both Pause/Break and SysRq/PrntScrn send their codes strangely.
; * Hence, I didn't remap any of them to avoid trouble.
; - The AppsKey and Btn2 may seem to do the same, but the menu appears in different places.
; - Mapping Del or Back (or something else?) to the ` key was a bit of a toss-up.
; * For instance, use S+` (Shift-Del) to delete a file bypassing the Recycle Bin.
; * The Back key is handy when navigating - but that's 2-handed work anyway.
; TIPS:
; - These mappings enable you to do many things without leaving the typing home position.
; * Mappings are based on ease of reach vs. usefulness, and some left-hand-only use.
; - This could take some getting used to for the left pinky, but it gets really cool!!!
; - The Caps key plus Esc turns the CapsLock state on and off now.
; - It's handy to control your browser back/forward with the left hand only while browsing.
; - Similarly, the wheel up/down keys are favorites.
; - Space for Enter is also nice; can be worked with left-hand-only as well.
; * To press dialogue buttons for instance, use Tab to move and Space/Q to select/abort.
; * A+Space (=Alt+Enter) when a file/disk is selected, brings up the object's Properties.
; - Use the Apps (or *Btn2) for context menus; arrows, 'mousing' or shortcuts select items.
; - Esc mapped to '[' (Telnet/Vim/etc compliant) is okay, but a left-hand one is even better.
; - The left-hand Del key is also convenient; the right-hand one is best when editing.
; - Cut/Copy/Paste are Windows 'multimedia board' versions - should work mostly anywhere.
; - Using S/T (Shift/cTrl) with the UNEI/LY/O' keys you can jump words, jump/select, etc.
; - The number keys are mapped to function keys. They are reachable with the left hand!
; * A4 closes apps; Win+3 GUI-searches; try 1(Help)/2(Rename)/3(Find)/5(Refresh) too.
; - The function keys are mapped to multimedia keys like the ones on multimedia keyboards.
; * Browser_Stop/Refresh/Search are usually covered by hotkeys (e.g., Esc/F5/^F).
; * Browser_Favorites usually needs a menu choice, so that's included (near the arrows).
; - The App1/2 keys are defined in the registry, in ShellExecute (REG_SZ) values:
; * HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AppKey\17
; * HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AppKey\18
; * Usually though, I find that the defaults of Explorer (App1) and Calc (App2) are fine.
; - Wheel Up/Dn are nice for scrolling window bars; Wheel Left/Right for horizontal scroll.
; * Horizontal scrolling doesn't always work though, at least not before Windows Vista.
; - The 'virtual mousing' is rudimentary; a 'last resort' when arrows/Tab aren't enough.
; * The 'mousing cross' is placed similarly to the 'mouse stick' on some boards.
; * A mousing resolution of 17 pixels roughly fits *most* context and similiar menus.
; * A full mouse layout could have multi-resolution, diagonals, Btn4/Btn5 and sticky Btn1.
; * The keyboard's auto-repeat makes virtual mousing odd/'laggy' when a key is held down.
; * In particular, beware of holding down the *Btn key(s) for a 'rapid-click' effect.
; *** 'ESC'/'SPACE'
SC001 = CapsLock
SC039 = Enter
; *** 'F1'-'F12': Multimedia keys, Logitech/Mac-style (F1-F4 are easiest to reach)
SC03b = Media_Play_Pause
SC03c = Media_Prev
SC03d = Media_Next
SC03e = Media_Stop
SC03f = Volume_Mute
SC040 = Volume_Down
SC041 = Volume_Up
SC042 = Launch_Media
SC043 = Browser_Home
SC044 = Launch_Mail
SC057 = Launch_App1
SC058 = Launch_App2
; *** Row 1 (numbers/symbols)
SC029 = Del
SC002 = F1
SC003 = F2
SC004 = F3
SC005 = F4
SC006 = F5
SC007 = F6
SC008 = F7
SC009 = F8
SC00a = F9
SC00b = F10
SC00c = F11
SC00d = F12
;SC00e = Sleep
SC00e = ScrollLock
; *** Row 2 (upper letter row)
SC00f = Tab
SC010 = Esc
SC011 = WheelUp
SC012 = Browser_Back
SC013 = Browser_Forward
SC014 = LButton
SC015 = PgUp
SC016 = Home
SC017 = Up
SC018 = End
SC019 = Del
SC01a = Esc
SC01b = Ins
; *** Row 3 (home row)
;SC03a = CapsLock
SC01e = Alt
SC01f = WheelDown
SC020 = Shift
SC021 = Ctrl
SC022 = Click Rel 0,-17,0
SC023 = PgDn
SC024 = Left
SC025 = Down
SC026 = Right
SC027 = BackSpace
SC028 = AppsKey
SC02b = Browser_Favorites
SC01c = CtrlBreak
; *** Row 4 (lower letter row)
;SC02a = LShift
; ***** SEE THE [EXTRA] SECTION FOR OPTIONAL 'COMFORT' REGISTRY REMAPPING *****
; Non-registry-mapped 'comfort' layout - VK_102 in the lower left corner is used as 'Z'.
SC056 = }!{Backspace}{
SC02c = Cut
SC02d = Copy
SC02e = Paste
SC02f = Click Rel -17,0,0
SC030 = Click Rel 0,17,0
SC031 = Click Rel 17,0,0
SC032 = MButton
; ***** END OF 'COMFORT'/'NON-COMFORT' PART (PASTE BETWEEN THESE LINES) *******
SC033 = WheelLeft
SC034 = WheelRight
SC035 = RButton
;SC036 = RShift
[extra]
; This section is not read by the program, but contains snippets for other sections.
; Mappings for scan code mapped versus unmapped 'comfort' layout (ZXCVB+VK_102 keys)
; (These keys may already be mapped on a lower level than PKL, by registry)
; Copy the appropriate set into your pkl.ini -> [extend] section, row 4.
; Non-registry-mapped 'comfort' layout - VK_102 in the lower left corner is used as 'Z'.
SC056 = }!{Backspace}{
SC02c = Cut
SC02d = Copy
SC02e = Paste
SC02f = Click Rel -17,0,0
SC030 = Click Rel 0,17,0
SC031 = Click Rel 17,0,0
SC032 = MButton
; Non-registry-mapped 'non-comfort' layout - if you have no VK_102 key (or WANT pain?!).
SC02c = }!{Backspace}{
SC02d = Cut
SC02e = Copy
SC02f = Paste
SC030 = Click Rel 0,17,0
SC031 = Click Rel -17,0,0
SC032 = Click Rel 17,0,0
; Instead of a mouse 'cross', there's now up/down and left/right pairs.
; If you need the middle button, you may replace, e.g., the left-hand Esc (but I wouldn't).
; Scancode/registry mapped 'comfort' layout - VK_102 now sits in the old 'B' position.
SC02c = }!{Backspace}{
SC02d = Cut
SC02e = Copy
SC02f = Paste
SC030 = Click Rel -17,0,0
SC056 = Click Rel 0,17,0
SC031 = Click Rel 17,0,0
SC032 = MButton
I'm totally loving this - did I mention that?

As you can see, this contains a bit of 'everything' and is a General/Default extended mapping. It has navigation/editing (even a dirty mousing solution for when you need to move the cursor just a little and don't want to grab the mouse!), multimedia and other fancy keys without buying new hardware, ergonomic ways of hitting F keys and Enter/Esc/etc (I use these a lot, such as A+4 for Quit Program or Spc/Q with Tab (unmapped) to move around in dialogs) and pretty much the kitchen sink too.
Now I'd like a mapping that gives me the NumPad. And an accelrated navigation/mousing mapping to get around faster (for instance, the UNEI should go 5 or 10 steps per key press), mirrored keyboard mappings for one-handed typing, a hotstring mapping...
For this, even using multiple 'extend' keys wouldn't be enough as don't think doubling up commonly used keys as extended modifiers is a good idea. Yes, I think the program should allow more than one extended modifier but also another solution! I think this might be solved by implementing multi-clicking extenders. Let's say I hit CapsLock for my usual mappings, but if I tap-and-hold (like a double click) instead I'd get an alternate layout with F13-24, accelerated arrows/mousing etc. If I tap-tap-hold maybe the NumPad++ layout? More than that would be a bit insane I think, but it'd make one extender into three! The example of the NumPad is a good one I hope, since I'll usually keep using numeric entry for a while once I've started; hence, triple-clicking a modifier to activate it wouldn't be so harsh.
I'm thinking that a handicapped person could get a foot pedal, set it up to produce, say, a F20 scan code and use that as a modifier for mirrored typing to use his or her only working hand! And if the hand isn't very movable, how nice to have the other extensions too so that you have to move less.
Maybe it'd be nice to invent a clear way to specify several remaps? For my ScanSposer program I thought up something like this, but didn't finish it (in part because I started just using PKL instead!):
Code:
; New style mapping template - Colemak (Comfort) annotated
[Mapname]
; +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
; |` |1 |2 |3 |4 |5 |6 |7 |8 |9 |0 |- |= |
R1="sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|"
; +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
; |Tab |Q |W |F |P |G |J |L |U |Y |; |[ |] |
R2="sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|"
; +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
; |Caps |A |R |S |T |D |H |N |E |I |O |' |\ |
R3="sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|"
; +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
; |Z |X |C |V |B |102 |K |M |, |. |/ |Spc |Enter|
R4="sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|"
; +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
ExtMod="SC###"
ModRel=""
The idea is to make it almost like the help figure I made in the pkl.ini file. The blank fields in the R# rows could be filled with either SC### values, key names, ASC codes or anything else the Send command will allow if the setup is flexible enough. SC### are the most compact but they're also less intuitive. Reading the '|'-delimited lines should ignore leading/trailing white space so the entries can be aligned in the file; my mousing mappings were the longest and they took 17-18 characters but 'Browser_Favorites' is long too.
- I first tried ARS (Colemak) for the modifiers Alt-CtRl-Shift as that would be ergonomic and easy to remember, but the R key can't be mapped to a modifier successfully for some really odd reason! Any thoughts on that; could it be a subtle bug in PKL somewhere?
- The mousing pad is nice for quick-and-dirty use, but one thing that bothers it is key repeat. I'd like it to repeat, but then when I release the key the buffer should've been cleared but instead there's a lot of further movement stored up so the cursor keeps sailing past where it should be. Not sure whether anything could be easily done about that. Maybe the release of the 'extend' key could trigger a buffer flush?