Replies: 3 comments 3 replies
-
Virtual keys are necessary for on-release actions. You'll have to fix your script to generate unique key names. |
Beta Was this translation helpful? Give feedback.
-
In theory I like the idea of having an "event handlers" concept in kanata like |
Beta Was this translation helpful? Give feedback.
-
Since this discussion isn't closed yet, I have another related case I'm trying to display the current held layer name in my window manager's status bar, and after release, show another layer. Let's say the command to display the layer name to the bar is (defvirtualkeys
base (multi (layer-switch base) (cmd sh -c "echo base > ~/current-layer"))
nav (multi (layer-switch nav) (cmd sh -c "echo nav > ~/current-layer"))
)
(defsrc w a s d ent)
(deflayer base w a s d @ent)
(deflayer nav ▲ ◀ ▼ ▶ XX) (defalias
tap_action ent
held_action (multi (layer-switch nav)
(cmd sh -c "echo nav > ~/current-layer")
(on-release tap-vkey base))
ent (tap-hold 200 200 @tap_action @held_action)
)
it worked, but I don't want to wait 200ms to execute the command when holding, so I adjusted the syntax: (defalias
tap_action (multi ent (on-release tap-vkey base))
held_action (multi (layer-switch nav) (on-release tap-vkey base))
ent (multi (cmd sh -c "echo nav > ~/current-layer")
(tap-hold 200 200 @tap_action @held_action))
) But now, (defalias
tap_action ent
held_action (multi (layer-switch nav) (on-release tap-vkey base))
ent (multi (cmd sh -c "echo nav > ~/current-layer")
(tap-hold 200 200 @tap_action @held_action)
(on-release tap-vkey base))
) This worked, but I have cases where I need different actions for hold and tap. Am I missing something, or this might be a bug. Any thoughts? |
Beta Was this translation helpful? Give feedback.
-
Hey there! I’m trying to figure out how to release actions without using
on-release
anddefvirtualkeys
. The issue I’m running into with thedefvirtualkeys
action is that I have a script that generates the config automatically instead of typing it all out manually. When I usedefvirtualkeys
, it breaks my auto-generated config because it defines static virtual key actions.Here’s what I’ve got so far:
Any tips on how I can achieve that without using
defvirtualkeys
?Beta Was this translation helpful? Give feedback.
All reactions