cajhin / capsicain

Powerful low-level keyboard remapping tool for Windows
334 stars 18 forks source link

tapped #93

Closed somesysadm closed 5 months ago

somesysadm commented 1 year ago

hi

thank you for the great utility! I'm happily use it for several years.

i have a kind of conflict with AHK. capsicain: COMBO Grave Accent [..&.] > moddedKey( Tab + ..&& ) # Ctrl-Grave Accent sends Ctrl-Shift-Tab autohotkey: ~LControl Up:: if (A_PriorKey != "LControl") return if (A_TimeSincePriorHotkey > 300) return gosub APPwindows_switch ; switch between two last windows of currently active app return

when I press ctrl-Grave Accent capsicain generates the following sequence: SEQUENCE (8) {LCTRL^ #0} {LSHFv #1} {LCTRLv #2} {TABv #3} {TAB^ #2} {LSHF^ #1} {LCTRL^ #0} {LCTRLv #1} and it works fine but it also triggers my AHK lcontrol double tap at the same time

i have a question, is it possible to change the logic and generate just {LSHFv} {TABv} {TAB^} {LSHF^} as we have LCTRL already pushed down? it looks more logical to avoid extra LCTRL^ LCTRLv switching.

or may be mr.cajhin can add a new function to clear the keyboard queue after the shortcut finished? i believe it could be useful to eliminate such conflicts and make capsicain even better and more flexible

when I tried to configure tapped key: capsicain: combo lctrl [..T.] > combo(F14+``) autohotkey: F14 & Grave Accent:: gosub APPwindows_switch

it works, double lctrl does the job but deadkey does not have any timeout so next lctrl triggers the combination again.

is it possible to add a configurable timeout for tapped keys?

only this config solved my problem: capsicain: COMBO [..&.] > sequence (&LCTRL_&LSHF_TAB_^LCTRL_^LSHF_^) autohotkey: ~LControl Up:: if (A_PriorKey != "LControl") return if (A_TimeSincePriorHotkey > 300) return gosub APPwindows_switch ; switch between two last windows of currently active app return but it created another one very annoying problem during ctrl-tab/ ctrl-` navigation

so i hope the author will consider my propositions as interesting.

best regards and have great day!

P.S. i'm a newbie on github, and very surprised about random formatting and Grave Accent disappearing

cajhin commented 1 year ago

On the AHK conflict: try
COMBO accent [ ..&.] > combo(LShf+Tab)

One major difference between moddedKey() and combo() is that combo does NOT clear the modifiers that are currently down (in your case, LCtrl). That should avoid the "clear everything, press ctrl, release ctrl, restore ctrl".

I predict you will still not be happy, because the unique Alt-Tab combo requires that Alt stays down, but with your approach, you can only send "Alt-Tab, Alt-Tab" instead of "Alt-Tab-Tab".

About your formatting issues, see https://github.com/mattcone/markdown-guide/blob/master/_basic-syntax/escaping-characters.md
Basically, accent grave ` is a special character in markdown that results in code formatting, and the character needs to be escaped with backslash like \`

About your "double-tap modifier, then timeout to clear the tapped state", I'll keep this as an enhancement.

I wanted to have some kind of tapped state timeout myself, to avoid the case that you accidentally trigger a combo, because you tapped a modifier before lunch. I never had a solution that I'm really happy with.
In your case, the second tap should probably clear the tapped state. Or rather the combo() action should clear all tapped states(?)

somesysadm commented 1 year ago

hi!

thanks a lot for your quick reply and good & clear advice. combo(LShf+Tab) works like a charm!

I use Ctrl-` for tab back navigation in browsers ctrl-tab - switch tab forward ctrl-` - switch tab backward

> I never had a solution that I'm really happy with. perfection does not have limits ! :-)

in my case there is no need in combo lctrl [..T.] anymore, cause initially is was written in AHK

i have my own code to switch between apps and app windows based on 7TTlib (7+ taskbar tweaker) win-tab - APPs_switch alt-tab like for groupped/combined buttons on the taskbar win-` - APPwindows_switch is like macos cmd-'~' but for windows of one app instance so if i have two opened chrome instances with different profiles and several windows each, then win-` switches windows only inside one instance ~LAlt Up:: ; APPs_switch double press two most recent ... ~LControl Up:: ; APPwindows_switch ; double press two most recent .... i am going to share this code, cause I did not find anything like this in the whole internet. but the code should be polished first.

thanks again and may God bless you for the capsicain!