jtroo / kanata

Improve keyboard comfort and usability with advanced customization
GNU Lesser General Public License v3.0
3.23k stars 131 forks source link

Feature request: Can we have a more flexible unmod? #1102

Closed kls1991 closed 5 months ago

kls1991 commented 5 months ago

Is your feature request related to a problem? Please describe.

In https://github.com/jtroo/kanata/blob/main/docs/config.adoc#multi, when d/f is pressed on alted-with-exceptions layer, the alt modifier is released but never restored

Describe the solution you'd like.

A new selective unmod, like: unmodex (list-of-modifiers-to-unmod) action-to-execute So we have better control in the "only change a few keys behavior when mod keys held" scenario

Describe alternatives you've considered.

Didn't come up with one.

Additional context

Hi I'm new to kanata. I'm trying to make bash-like A-b/f/d global, basiclly map them to C-left/rght/del, while keep other keys untouched.

I tried the multi showcase at first, like:

;; word-wise back
(defalias wwb (multi (release-key alt) C-left)

But I found the alt key released after @wwb activated, I didn't find a way to re-enable alt unless phyical release it. I'm now using a ugly work around:

(defcfg)

(defsrc
  `    1    2    3    4    5    6    7    8    9    0    -    =    ⌫
  ⭾    q    w    e    r    t    y    u    i    o    p    [    ]    \
  ⇪    a    s    d    f    g    h    j    k    l    ;    '    ⏎
  ‹⇧   z    x    c    v    b    n    m    ,    .    /    ⇧›
  ‹⌃   ‹⌘   ‹⌥             ␣              ⌥›   ⌘›   ⌃›
)

(deflayer base
  _    _    _    _    _    _    _    _    _    _    _    _    _    _
  _    _    _    _    _    _    _    _    _    _    _    _    _    _
  ‹⌘   _    _    _    _    _    _    _    _    _    _    _    _
  _    _    _    _    _    _    _    _    _    _    _    _
  ∅    @C   @A             _              @A   @C   ∅
)

;; Ctrl tap-dance: single-tap as ctrl, double tap as ctrl-shift
(defalias C (multi ctl (tap-dance 200 (∅ shft))))

(deflayer alt
  A-`  A-1  A-2  A-3  A-4  A-5  A-6  A-7  A-8  A-9  A-0  A--  A-=  A-⌫
  A-⭾  A-q  A-w  A-e  A-r  A-t  A-y  A-u  A-i  A-o  A-p  A-[  A-]  A-\
  ∅    A-a  A-s  C-⌫  C-▶  A-g  A-h  A-j  A-k  A-l  A-;  A-'  A-⏎
  ∅    A-z  A-x  A-c  A-v  C-◀  A-n  A-m  A-,  A-.  A-/  ∅
  ∅    @C   ‹⌥             A-␣            ⌥›   @C   ∅
)

(defalias A (tap-dance 200 ((layer-while-held alt) (multi alt shft))))

It's tedious and not able to do normal alt-tab. Sorry for my bad English!

jtroo commented 5 months ago

Seems like for your use case at least, all that is required is unalt, similar to unshift. In which case the unshift PR is a good starting point.