tap-hold-double-tap functionality figured out
#1865
Replies: 5 comments
-
|
What specifically did you try? Put a minimal example in the simulator: |
Beta Was this translation helpful? Give feedback.
-
|
heres a minimal config i had to troubleshoot all the errors just trying to get this to work i lost track of the different ;; Variables
(defvar
tt 180 ;; tap-time
ht 300 ;; hold-time
ct 60 ;; chord-time
)
(defsrc
esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e r t y u i o p [ ] \
caps a s d f g h j k l ; ' ret
lsft z x c v b n m , . / up rsft
fn lctl lalt lmet spc rmet ralt left down rght
)
(deflayer main
@msymb brdn brup f3 f4 f5 f6 prev pp next mute vold volu
_ _ _ _ _ _ _ _ _ _ _ _ _ _
@tabSG _ _ @mhome _ _ _ _ _ _ _ _ _ _
@mehsc _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ @shdl
_ _ _ _ _ _ _ _ _ _
)
(deflayer symb
esc XX XX XX XX XX XX XX XX XX XX XX XX
grv S-1 S-2 S-3 S-4 S-5 S-6 S-7 S-8 S-9 S-0 S-[ S-] del
tab XX XX XX XX XX XX XX XX XX XX XX XX XX ;; THIS ROW WOULD HAVE HAD
XX XX XX XX XX XX XX XX XX XX XX XX ret ;; the commented RAYCAST deplinks
lsft XX XX XX XX XX XX XX XX XX XX ▲ rsft ;; but even with the dangerous-cmd enable
fn lctl lalt lmet bspc rmet ralt ◀ ▼ ▶ ;; in defcfg tho simulator the sim wouldn't allow it
)
(defalias
;; hyper<->scam
scam6 S-C-A-M-6 ;; homerow
;; Other layers tap-hold-press
msymb (tap-hold $tt $ht esc (layer-toggle symb))
;; aliases for raycast
;; rtran (cmd open "raycast://extensions/raycast/translator/translate")
;; rspot (cmd open "raycast://extensions/mattisssa/spotify-player/search")
;; rvid/ (cmd open "raycast://extensions/tonka3000/youtube/search-videos?arguments=%7B%22query%22%3A%22%22%7D")
;; rayai (cmd open "raycast://extensions/raycast/raycast-ai/ai-chat")
;; rcent (cmd open "raycast://extensions/GastroGeek/recents/recents")
;; Double actions/ TAP-HOLD
mhome (tap-hold $tt 240 e @scam6)
mehsc (tap-hold-press $tt $ht esc (multi lsft lctl lalt))
sHYP (tap-hold-press $tt $ht @scam6 (multi lsft lctl lalt lmet))
tabSG (tap-hold-press $tt $ht tab (multi lsft lmet))
shdl (tap-hold-press $tt $ht del rsft)
) |
Beta Was this translation helpful? Give feedback.
-
|
This is not a minimal configuration. Just put one/a few key(s) in defsrc, mapping just what what you need to represent what you're trying to accomplish. It also doesn't have any tap-dance anywhere, so not sure what you've tried and why it didn't work. Regardless I made an edit and seems to work fine to me. Link to simulatorSimulator configSimulator inputSimulator output |
Beta Was this translation helpful? Give feedback.
-
|
so now i recall what i had tried (and kept getting errors) mhome (tap-dance 200 (tap-hold $tt 240 e @scam6) layer-switch symb) ;; BAD SYNTAXyou're right it does now work. but it stays locked in what i want is double tap now that i know the right syntax, and have my head wrapped around config a little better, i realized i needed ;;----------------------------------------------------
;; Kanata Configuration for macOS v4
;; Built from official documentation and error log diagnostics.
;;----------------------------------------------------
(defcfg
process-unmapped-keys yes
concurrent-tap-hold yes
danger-enable-cmd yes
)
(include chords.kbd)
(include aliases.kbd)
;; Variables
(defvar
tt 180 ;; tap-time
ht 300 ;; hold-time
ct 60 ;; chord-time
)
;; --- Key Definitions (77-key MacBook Layout) ---
(defsrc
esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e r t y u i o p [ ] \
caps a s d f g h j k l ; ' ret
lsft z x c v b n m , . / up rsft
fn lctl lalt lmet spc rmet ralt left down rght
)
;; --- MAIN KEYMAP LAYER (77 keys) ---
(deflayer main
@msymb brdn brup f3 f4 f5 f6 prev pp next mute vold volu ;; Top Row (F-Keys)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ ;; Number Row
@tabSG @mray _ @mhome _ _ _ _ @copmd _ _ _ _ _ ;; QWERTY Row
@mehsc @mlctl _ @mlalt @mlmet _ _ @mrmet @mralt _ @mrctl _ _ ;; Home Row
_ _ _ _ _ _ _ _ _ _ _ _ @shdl ;; Bottom Row
_ _ _ @mnavi @mappr @lHYP @rtaplt _ _ _ ;; Modifier/Arrow Row
)
(deflayer apps
_ XX XX XX XX XX XX XX XX XX XX XX XX ;; Top Row
grv 1 2 3 4 5 6 7 8 9 0 XX XX del ;; Number Row
_ _ _ _ @apre _ @afnd @apag @atls @anot XX @asys XX XX ;; QWERTY Row
XX _ XX _ _ _ @adis _ @asoc _ @asaf _ @awez ;; Home Row
lsft _ _ _ _ _ _ @amld _ @advs @azom ▲ rsft ;; Bottom Row
fn lctl lalt lmet spc rmet ralt ◀ ▼ ▶ ;; Mod/Arrow Row
)
(deflayer navi
;; a s d f g h j k l ; '
esc XX XX XX XX XX XX XX XX XX XX XX XX ;; Top Row
grv 1 2 3 4 5 6 7 8 9 0 XX XX del ;; Number Row
@scamt @scam0 XX @mhome XX XX S-A-◀ S-A-▼ S-A-▲ S-A-▶ XX XX XX XX ;; QWERTY Row
XX @scam= @scam9 M-[ M-] XX ◀ ▼ ▲ ▶ XX XX XX ;; Home Row
lsft XX XX XX XX XX XX XX XX XX XX ▲ rsft ;; Bottom Row
fn lctl lalt lmet _ rmet ralt ◀ ▼ ▶ ;; Mod/Arrow Row
)
(deflayer symb
esc XX XX XX XX XX XX XX XX XX XX XX XX ;; Top Row
grv S-1 S-2 S-3 S-4 S-5 S-6 S-7 S-8 S-9 S-0 S-[ S-] del ;; Number Row
tab XX XX XX XX XX XX XX XX @rcent XX XX XX XX ;; QWERTY Row
@mmain @rayai XX XX XX XX XX XX @rtran XX @rspot XX ret ;; Home Row
lsft XX XX XX XX XX XX XX XX XX @rvid/ ▲ rsft ;; Bottom Row
fn lctl lalt lmet bspc rmet ralt ◀ ▼ ▶ ;; Mod/Arrow Row
)
(deflayer raycast
_ _ _ _ _ _ _ _ _ _ _ _ _ ;; Top Row
_ _ _ _ _ _ _ _ _ _ _ _ _ _ ;; Number Row
_ _ _ _ _ _ _ _ _ @rcent _ _ _ _ ;; QWERTY Row
_ @rayai _ _ _ _ _ _ _ @rtran _ @rspot _ ;; Home Row
_ _ _ _ _ _ _ _ _ _ _ @rvid/ _ ;; Bottom Row
_ _ _ _ _ _ _ _ _ _ ;; Mod/Arrow Row
)
(defalias
;; aliases for raycast
rtran (cmd open "raycast://extensions/raycast/translator/translate")
rspot (cmd open "raycast://extensions/mattisssa/spotify-player/search")
rvid/ (cmd open "raycast://extensions/tonka3000/youtube/search-videos?arguments=%7B%22query%22%3A%22%22%7D")
ratn (cmd open "raycast://extensions/raycast/apple-notes/add-text") ;; APPLE NOTES add text to (existing note)
rayai (cmd open "raycast://extensions/raycast/raycast-ai/ai-chat")
rcent (cmd open "raycast://extensions/GastroGeek/recents/recents")
;; hyper<->scam
scam6 S-C-A-M-6 ;; homerow
scam0 S-C-A-M-0 ;; cleanshot capture area
scam9 S-C-A-M-9 ;; cleanshot capture previous area
scamt S-C-A-M-tab ;; cleanshot capture history
scam= S-C-A-M-= ;; cleanshot capture history
;; aliases for applications
amld (cmd open -a "meld studio")
azom (cmd open -a zoom)
advs (cmd open -a "Davinci Resolve Studio")
adis (cmd open -a discord)
afnd (cmd open -a finder)
anot (cmd open -a notes)
asaf (cmd open -a safari)
apag (cmd open -a pages)
apre (cmd open -a preview)
asoc (cmd open -a socialstream)
aspo (cmd open -a spotify)
asys (cmd open -a "System Settings")
awez (cmd open -a wezterm)
atls (cmd open -a "chatgpt atlas")
abtt (cmd open -a BetterTouchTool)
acld (cmd open -a claude)
aobs (cmd open -a obsidian)
;; Modifier keys HOME ROW MODS
mlctl (tap-hold $tt $ht a rctl)
mlalt (tap-hold $tt $ht d lalt)
mlmet (tap-hold $tt $ht f lmet)
mrmet (tap-hold $tt $ht j rmet)
mralt (tap-hold $tt $ht k ralt)
mrctl (tap-hold $tt $ht ; lctl)
;; Double actions,.
mhome (tap-dance 200 ((tap-hold $tt 240 e @scam6) (one-shot-press 1500 (layer-while-held symb)))) ;; when i first read LAYER-WHILE-HELD I understood it as my dumb ass has to hold down the defining key. now i realize kanata will virtually "hold" the layer for the timeout_time
mehsc (tap-hold-press $tt $ht esc (multi lsft lctl lalt))
lHYP (tap-hold-press $tt $ht f18 (multi lsft lctl lalt lmet)) ;; (macro S-C-A-M-6)
tabSG (tap-hold-press $tt $ht tab (multi lsft lmet)) ;; makes screenshot shortcuts easier
shdl (tap-hold-press $tt $ht del rsft)
;; --- Advanced Modifier Remaps ---
rtaplt (tap-dance 200 ( ;; The action list for tap-dance is a single list of actions, not a list of lists.
(multi rmet ralt) ;; Action 1 is a multi-key action, so it needs parens
C-A-M-m ;; Action 2 is a simple chord, so it does not need parens
))
copmd (tap-dance $tt (
i
(macro C-; 50 i )
))
;; Other layers tap-hold-press
mappr (tap-hold-press $tt $ht spc (layer-toggle apps))
mmain (tap-hold-press $tt $ht esc (layer-toggle main))
msymb (tap-hold $tt $ht esc (layer-toggle symb))
mnavi (tap-hold-press $tt $ht lmet (layer-toggle navi))
mray (tap-hold $tt $ht q (layer-toggle raycast ))
) |
Beta Was this translation helpful? Give feedback.
-
|
so now i recall what i had tried (and kept getting errors) mhome (tap-dance 200 (tap-hold $tt 240 e @scam6) layer-switch symb) ;; BAD SYNTAXyou're right it does now work. but it stays locked in what i want is double tap now that i know the right syntax, and have my head wrapped around config a little better, i realized i needed ;;----------------------------------------------------
;; Kanata Configuration for macOS v4
;; Built from official documentation and error log diagnostics.
;;----------------------------------------------------
(defcfg
process-unmapped-keys yes
concurrent-tap-hold yes
danger-enable-cmd yes
)
(include chords.kbd)
(include aliases.kbd)
;; Variables
(defvar
tt 180 ;; tap-time
ht 300 ;; hold-time
ct 60 ;; chord-time
)
;; --- Key Definitions (77-key MacBook Layout) ---
(defsrc
esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e r t y u i o p [ ] \
caps a s d f g h j k l ; ' ret
lsft z x c v b n m , . / up rsft
fn lctl lalt lmet spc rmet ralt left down rght
)
;; --- MAIN KEYMAP LAYER (77 keys) ---
(deflayer main
@msymb brdn brup f3 f4 f5 f6 prev pp next mute vold volu ;; Top Row (F-Keys)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ ;; Number Row
@tabSG @mray _ @mhome _ _ _ _ @copmd _ _ _ _ _ ;; QWERTY Row
@mehsc @mlctl _ @mlalt @mlmet _ _ @mrmet @mralt _ @mrctl _ _ ;; Home Row
_ _ _ _ _ _ _ _ _ _ _ _ @shdl ;; Bottom Row
_ _ _ @mnavi @mappr @lHYP @rtaplt _ _ _ ;; Modifier/Arrow Row
)
(deflayer apps
_ XX XX XX XX XX XX XX XX XX XX XX XX ;; Top Row
grv 1 2 3 4 5 6 7 8 9 0 XX XX del ;; Number Row
_ _ _ _ @apre _ @afnd @apag @atls @anot XX @asys XX XX ;; QWERTY Row
XX _ XX _ _ _ @adis _ @asoc _ @asaf _ @awez ;; Home Row
lsft _ _ _ _ _ _ @amld _ @advs @azom ▲ rsft ;; Bottom Row
fn lctl lalt lmet spc rmet ralt ◀ ▼ ▶ ;; Mod/Arrow Row
)
(deflayer navi
;; a s d f g h j k l ; '
esc XX XX XX XX XX XX XX XX XX XX XX XX ;; Top Row
grv 1 2 3 4 5 6 7 8 9 0 XX XX del ;; Number Row
@scamt @scam0 XX @mhome XX XX S-A-◀ S-A-▼ S-A-▲ S-A-▶ XX XX XX XX ;; QWERTY Row
XX @scam= @scam9 M-[ M-] XX ◀ ▼ ▲ ▶ XX XX XX ;; Home Row
lsft XX XX XX XX XX XX XX XX XX XX ▲ rsft ;; Bottom Row
fn lctl lalt lmet _ rmet ralt ◀ ▼ ▶ ;; Mod/Arrow Row
)
(deflayer symb
esc XX XX XX XX XX XX XX XX XX XX XX XX ;; Top Row
grv S-1 S-2 S-3 S-4 S-5 S-6 S-7 S-8 S-9 S-0 S-[ S-] del ;; Number Row
tab XX XX XX XX XX XX XX XX @rcent XX XX XX XX ;; QWERTY Row
@mmain @rayai XX XX XX XX XX XX @rtran XX @rspot XX ret ;; Home Row
lsft XX XX XX XX XX XX XX XX XX @rvid/ ▲ rsft ;; Bottom Row
fn lctl lalt lmet bspc rmet ralt ◀ ▼ ▶ ;; Mod/Arrow Row
)
(deflayer raycast
_ _ _ _ _ _ _ _ _ _ _ _ _ ;; Top Row
_ _ _ _ _ _ _ _ _ _ _ _ _ _ ;; Number Row
_ _ _ _ _ _ _ _ _ @rcent _ _ _ _ ;; QWERTY Row
_ @rayai _ _ _ _ _ _ _ @rtran _ @rspot _ ;; Home Row
_ _ _ _ _ _ _ _ _ _ _ @rvid/ _ ;; Bottom Row
_ _ _ _ _ _ _ _ _ _ ;; Mod/Arrow Row
)
(defalias
;; aliases for raycast
rtran (cmd open "raycast://extensions/raycast/translator/translate")
rspot (cmd open "raycast://extensions/mattisssa/spotify-player/search")
rvid/ (cmd open "raycast://extensions/tonka3000/youtube/search-videos?arguments=%7B%22query%22%3A%22%22%7D")
ratn (cmd open "raycast://extensions/raycast/apple-notes/add-text") ;; APPLE NOTES add text to (existing note)
rayai (cmd open "raycast://extensions/raycast/raycast-ai/ai-chat")
rcent (cmd open "raycast://extensions/GastroGeek/recents/recents")
;; hyper<->scam
scam6 S-C-A-M-6 ;; homerow
scam0 S-C-A-M-0 ;; cleanshot capture area
scam9 S-C-A-M-9 ;; cleanshot capture previous area
scamt S-C-A-M-tab ;; cleanshot capture history
scam= S-C-A-M-= ;; cleanshot capture history
;; aliases for applications
amld (cmd open -a "meld studio")
azom (cmd open -a zoom)
advs (cmd open -a "Davinci Resolve Studio")
adis (cmd open -a discord)
afnd (cmd open -a finder)
anot (cmd open -a notes)
asaf (cmd open -a safari)
apag (cmd open -a pages)
apre (cmd open -a preview)
asoc (cmd open -a socialstream)
aspo (cmd open -a spotify)
asys (cmd open -a "System Settings")
awez (cmd open -a wezterm)
atls (cmd open -a "chatgpt atlas")
abtt (cmd open -a BetterTouchTool)
acld (cmd open -a claude)
aobs (cmd open -a obsidian)
;; Modifier keys HOME ROW MODS
mlctl (tap-hold $tt $ht a rctl)
mlalt (tap-hold $tt $ht d lalt)
mlmet (tap-hold $tt $ht f lmet)
mrmet (tap-hold $tt $ht j rmet)
mralt (tap-hold $tt $ht k ralt)
mrctl (tap-hold $tt $ht ; lctl)
;; Double actions,.
mhome (tap-dance 200 ((tap-hold $tt 240 e @scam6) (one-shot-press 1500 (layer-while-held symb)))) ;; when i first read LAYER-WHILE-HELD I understood it as my dumb ass has to hold down the defining key. now i realize kanata will virtually "hold" the layer for the timeout_time
mehsc (tap-hold-press $tt $ht esc (multi lsft lctl lalt))
lHYP (tap-hold-press $tt $ht f18 (multi lsft lctl lalt lmet)) ;; (macro S-C-A-M-6)
tabSG (tap-hold-press $tt $ht tab (multi lsft lmet)) ;; makes screenshot shortcuts easier
shdl (tap-hold-press $tt $ht del rsft)
;; --- Advanced Modifier Remaps ---
rtaplt (tap-dance 200 ( ;; The action list for tap-dance is a single list of actions, not a list of lists.
(multi rmet ralt) ;; Action 1 is a multi-key action, so it needs parens
C-A-M-m ;; Action 2 is a simple chord, so it does not need parens
))
copmd (tap-dance $tt (
i
(macro C-; 50 i )
))
;; Other layers tap-hold-press
mappr (tap-hold-press $tt $ht spc (layer-toggle apps))
mmain (tap-hold-press $tt $ht esc (layer-toggle main))
msymb (tap-hold $tt $ht esc (layer-toggle symb))
mnavi (tap-hold-press $tt $ht lmet (layer-toggle navi))
mray (tap-hold $tt $ht q (layer-toggle raycast ))
) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
so i'd like to (on a Dvorak layout) use
.to trigger:.on tapS-M-4on double tap (MacOS screenshot)@layerone shot trigger / sub layer activation on double tap. so next keypress would run an alias, or escape the layer if the key is unassigned.the goal is to be able to activate a layer without having to hold down a key.
I've tried to add
tap-dancetotap-hold-pressdefinition but it doesn't seem to work. don't know what else to try to get it to work.solution is figured out at the bottom, nesting
layer-while-heldin atap-holdin atap-dancemhome (tap-dance 200 ((tap-hold $tt 240 e @scam6) (one-shot-press 1500 (layer-while-held symb))))Beta Was this translation helpful? Give feedback.
All reactions