keycomfort 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/keycomfort.js +348 -225
- package/package.json +6 -3
package/dist/keycomfort.js
CHANGED
|
@@ -14337,7 +14337,7 @@ function requireKarabinerge () {
|
|
|
14337
14337
|
karabinerge.unless_var = unless_var;
|
|
14338
14338
|
return karabinerge;
|
|
14339
14339
|
}var name = "keycomfort";
|
|
14340
|
-
var version = "0.
|
|
14340
|
+
var version = "0.7.0";
|
|
14341
14341
|
var description = "Comfortable keyboard remaps for Karabiner/AutoHotKey";
|
|
14342
14342
|
var require$$9 = {
|
|
14343
14343
|
name: name,
|
|
@@ -14358,6 +14358,7 @@ function requireRules () {
|
|
|
14358
14358
|
} = requireKarabinerge();
|
|
14359
14359
|
|
|
14360
14360
|
const modding = if_var('keycomfort_layer', 1);
|
|
14361
|
+
const mouse_mode = 'keycomfort_mode_mouse';
|
|
14361
14362
|
const any = {optional: 'any'};
|
|
14362
14363
|
const rules = {
|
|
14363
14364
|
|
|
@@ -14433,64 +14434,68 @@ function requireRules () {
|
|
|
14433
14434
|
},
|
|
14434
14435
|
|
|
14435
14436
|
'prev/next word': {
|
|
14436
|
-
|
|
14437
|
-
r
|
|
14438
|
-
|
|
14439
|
-
|
|
14440
|
-
|
|
14441
|
-
|
|
14442
|
-
|
|
14443
|
-
|
|
14444
|
-
|
|
14445
|
-
|
|
14437
|
+
apps: {
|
|
14438
|
+
sonicpi(c, r) {
|
|
14439
|
+
r.cond(modding)
|
|
14440
|
+
.remap({
|
|
14441
|
+
from: key(c.prev),
|
|
14442
|
+
to: key('b', 'command')
|
|
14443
|
+
})
|
|
14444
|
+
.remap({
|
|
14445
|
+
from: key(c.next),
|
|
14446
|
+
to: key('f', 'command')
|
|
14447
|
+
});
|
|
14448
|
+
},
|
|
14449
|
+
others(c, r) {
|
|
14450
|
+
r.cond(modding)
|
|
14451
|
+
.remap({
|
|
14452
|
+
from: key(c.prev),
|
|
14453
|
+
to: key('left_arrow', 'option')
|
|
14454
|
+
})
|
|
14455
|
+
.remap({
|
|
14456
|
+
from: key(c.next),
|
|
14457
|
+
to: key('right_arrow', 'option')
|
|
14458
|
+
});
|
|
14459
|
+
},
|
|
14446
14460
|
},
|
|
14447
|
-
others(c, r) {
|
|
14448
|
-
r.cond(modding)
|
|
14449
|
-
.remap({
|
|
14450
|
-
from: key(c.prev),
|
|
14451
|
-
to: key('left_arrow', 'option')
|
|
14452
|
-
})
|
|
14453
|
-
.remap({
|
|
14454
|
-
from: key(c.next),
|
|
14455
|
-
to: key('right_arrow', 'option')
|
|
14456
|
-
});
|
|
14457
|
-
}
|
|
14458
14461
|
},
|
|
14459
14462
|
|
|
14460
14463
|
'line start/end': {
|
|
14461
|
-
|
|
14462
|
-
r
|
|
14463
|
-
|
|
14464
|
-
|
|
14465
|
-
|
|
14466
|
-
|
|
14467
|
-
|
|
14468
|
-
|
|
14469
|
-
|
|
14470
|
-
|
|
14471
|
-
|
|
14472
|
-
|
|
14473
|
-
r
|
|
14474
|
-
|
|
14475
|
-
|
|
14476
|
-
|
|
14477
|
-
|
|
14478
|
-
|
|
14479
|
-
|
|
14480
|
-
|
|
14481
|
-
|
|
14464
|
+
apps: {
|
|
14465
|
+
terminal(c, r) {
|
|
14466
|
+
r.cond(modding)
|
|
14467
|
+
.remap({
|
|
14468
|
+
from: key(c.start),
|
|
14469
|
+
to: key('home')
|
|
14470
|
+
})
|
|
14471
|
+
.remap({
|
|
14472
|
+
from: key(c.end),
|
|
14473
|
+
to: key('end')
|
|
14474
|
+
});
|
|
14475
|
+
},
|
|
14476
|
+
sonicpi(c, r) {
|
|
14477
|
+
r.cond(modding)
|
|
14478
|
+
.remap({
|
|
14479
|
+
from: key(c.start),
|
|
14480
|
+
to: key('a', 'control')
|
|
14481
|
+
})
|
|
14482
|
+
.remap({
|
|
14483
|
+
from: key(c.end),
|
|
14484
|
+
to: key('e', 'control')
|
|
14485
|
+
});
|
|
14486
|
+
},
|
|
14487
|
+
others(c, r) {
|
|
14488
|
+
r.cond(modding)
|
|
14489
|
+
.remap({
|
|
14490
|
+
from: key(c.start),
|
|
14491
|
+
to: key('left_arrow', 'command')
|
|
14492
|
+
})
|
|
14493
|
+
.remap({
|
|
14494
|
+
from: key(c.end),
|
|
14495
|
+
to: key('right_arrow', 'command')
|
|
14496
|
+
});
|
|
14497
|
+
},
|
|
14482
14498
|
},
|
|
14483
|
-
others(c, r) {
|
|
14484
|
-
r.cond(modding)
|
|
14485
|
-
.remap({
|
|
14486
|
-
from: key(c.start),
|
|
14487
|
-
to: key('left_arrow', 'command')
|
|
14488
|
-
})
|
|
14489
|
-
.remap({
|
|
14490
|
-
from: key(c.end),
|
|
14491
|
-
to: key('right_arrow', 'command')
|
|
14492
|
-
});
|
|
14493
|
-
}
|
|
14494
14499
|
},
|
|
14495
14500
|
|
|
14496
14501
|
'select'(c, r) {
|
|
@@ -14566,133 +14571,141 @@ function requireRules () {
|
|
|
14566
14571
|
},
|
|
14567
14572
|
|
|
14568
14573
|
'delete line': {
|
|
14569
|
-
|
|
14570
|
-
r
|
|
14571
|
-
|
|
14572
|
-
|
|
14573
|
-
|
|
14574
|
-
|
|
14575
|
-
|
|
14576
|
-
|
|
14577
|
-
r
|
|
14578
|
-
|
|
14579
|
-
|
|
14580
|
-
|
|
14581
|
-
|
|
14582
|
-
|
|
14583
|
-
|
|
14584
|
-
r
|
|
14585
|
-
|
|
14586
|
-
|
|
14587
|
-
|
|
14588
|
-
|
|
14574
|
+
apps: {
|
|
14575
|
+
atom(c, r) {
|
|
14576
|
+
r.cond(modding)
|
|
14577
|
+
.remap({
|
|
14578
|
+
from: key(c.key),
|
|
14579
|
+
to: key('k', ['control', 'shift'])
|
|
14580
|
+
});
|
|
14581
|
+
},
|
|
14582
|
+
vscode(c, r) {
|
|
14583
|
+
r.cond(modding)
|
|
14584
|
+
.remap({
|
|
14585
|
+
from: key(c.key),
|
|
14586
|
+
to: key('k', ['command', 'shift'])
|
|
14587
|
+
});
|
|
14588
|
+
},
|
|
14589
|
+
eclipse(c, r) {
|
|
14590
|
+
r.cond(modding)
|
|
14591
|
+
.remap({
|
|
14592
|
+
from: key(c.key),
|
|
14593
|
+
to: key('d', 'command')
|
|
14594
|
+
});
|
|
14595
|
+
},
|
|
14589
14596
|
},
|
|
14590
14597
|
},
|
|
14591
14598
|
|
|
14592
14599
|
'insert line': {
|
|
14593
|
-
|
|
14594
|
-
r
|
|
14595
|
-
|
|
14596
|
-
|
|
14597
|
-
|
|
14598
|
-
|
|
14599
|
-
|
|
14600
|
-
|
|
14601
|
-
r
|
|
14602
|
-
|
|
14603
|
-
|
|
14604
|
-
|
|
14605
|
-
|
|
14606
|
-
|
|
14607
|
-
|
|
14608
|
-
r
|
|
14609
|
-
|
|
14610
|
-
|
|
14611
|
-
|
|
14612
|
-
|
|
14600
|
+
apps: {
|
|
14601
|
+
atom(c, r) {
|
|
14602
|
+
r.cond(modding)
|
|
14603
|
+
.remap({
|
|
14604
|
+
from: key(c.key),
|
|
14605
|
+
to: key('return_or_enter', 'command')
|
|
14606
|
+
});
|
|
14607
|
+
},
|
|
14608
|
+
vscode(c, r) {
|
|
14609
|
+
r.cond(modding)
|
|
14610
|
+
.remap({
|
|
14611
|
+
from: key(c.key),
|
|
14612
|
+
to: key('return_or_enter', 'command')
|
|
14613
|
+
});
|
|
14614
|
+
},
|
|
14615
|
+
eclipse(c, r) {
|
|
14616
|
+
r.cond(modding)
|
|
14617
|
+
.remap({
|
|
14618
|
+
from: key(c.key),
|
|
14619
|
+
to: key('return_or_enter', 'shift')
|
|
14620
|
+
});
|
|
14621
|
+
},
|
|
14613
14622
|
},
|
|
14614
14623
|
},
|
|
14615
14624
|
|
|
14616
14625
|
'move line': {
|
|
14617
|
-
|
|
14618
|
-
r
|
|
14619
|
-
|
|
14620
|
-
|
|
14621
|
-
|
|
14622
|
-
|
|
14623
|
-
|
|
14624
|
-
|
|
14625
|
-
|
|
14626
|
-
|
|
14627
|
-
|
|
14628
|
-
|
|
14629
|
-
r
|
|
14630
|
-
|
|
14631
|
-
|
|
14632
|
-
|
|
14633
|
-
|
|
14634
|
-
|
|
14635
|
-
|
|
14636
|
-
|
|
14637
|
-
|
|
14638
|
-
|
|
14639
|
-
|
|
14640
|
-
r
|
|
14641
|
-
|
|
14642
|
-
|
|
14643
|
-
|
|
14644
|
-
|
|
14645
|
-
|
|
14646
|
-
|
|
14647
|
-
|
|
14648
|
-
|
|
14649
|
-
|
|
14650
|
-
|
|
14651
|
-
r
|
|
14652
|
-
|
|
14653
|
-
|
|
14654
|
-
|
|
14655
|
-
|
|
14656
|
-
|
|
14657
|
-
|
|
14658
|
-
|
|
14659
|
-
|
|
14626
|
+
apps: {
|
|
14627
|
+
atom(c, r) {
|
|
14628
|
+
r.cond(modding)
|
|
14629
|
+
.remap({
|
|
14630
|
+
from: key(c.up),
|
|
14631
|
+
to: key('up_arrow', ['command', 'control'])
|
|
14632
|
+
})
|
|
14633
|
+
.remap({
|
|
14634
|
+
from: key(c.down),
|
|
14635
|
+
to: key('down_arrow', ['command', 'control'])
|
|
14636
|
+
});
|
|
14637
|
+
},
|
|
14638
|
+
vscode(c, r) {
|
|
14639
|
+
r.cond(modding)
|
|
14640
|
+
.remap({
|
|
14641
|
+
from: key(c.up),
|
|
14642
|
+
to: key('up_arrow', 'option')
|
|
14643
|
+
})
|
|
14644
|
+
.remap({
|
|
14645
|
+
from: key(c.down),
|
|
14646
|
+
to: key('down_arrow', 'option')
|
|
14647
|
+
});
|
|
14648
|
+
},
|
|
14649
|
+
eclipse(c, r) {
|
|
14650
|
+
r.cond(modding)
|
|
14651
|
+
.remap({
|
|
14652
|
+
from: key(c.up),
|
|
14653
|
+
to: key('up_arrow', 'option')
|
|
14654
|
+
})
|
|
14655
|
+
.remap({
|
|
14656
|
+
from: key(c.down),
|
|
14657
|
+
to: key('down_arrow', 'option')
|
|
14658
|
+
});
|
|
14659
|
+
},
|
|
14660
|
+
sonicpi(c, r) {
|
|
14661
|
+
r.cond(modding)
|
|
14662
|
+
.remap({
|
|
14663
|
+
from: key(c.up),
|
|
14664
|
+
to: key('p', ['command', 'control'])
|
|
14665
|
+
})
|
|
14666
|
+
.remap({
|
|
14667
|
+
from: key(c.down),
|
|
14668
|
+
to: key('n', ['command', 'control'])
|
|
14669
|
+
});
|
|
14670
|
+
},
|
|
14660
14671
|
},
|
|
14661
14672
|
},
|
|
14662
14673
|
|
|
14663
14674
|
'left/right tab': {
|
|
14664
|
-
|
|
14665
|
-
r
|
|
14666
|
-
|
|
14667
|
-
|
|
14668
|
-
|
|
14669
|
-
|
|
14670
|
-
|
|
14671
|
-
|
|
14672
|
-
|
|
14673
|
-
|
|
14674
|
-
|
|
14675
|
-
|
|
14676
|
-
r
|
|
14677
|
-
|
|
14678
|
-
|
|
14679
|
-
|
|
14680
|
-
|
|
14681
|
-
|
|
14682
|
-
|
|
14683
|
-
|
|
14684
|
-
|
|
14685
|
-
|
|
14686
|
-
|
|
14687
|
-
r
|
|
14688
|
-
|
|
14689
|
-
|
|
14690
|
-
|
|
14691
|
-
|
|
14692
|
-
|
|
14693
|
-
|
|
14694
|
-
|
|
14695
|
-
|
|
14675
|
+
apps: {
|
|
14676
|
+
vscode(c, r) {
|
|
14677
|
+
r.cond(modding)
|
|
14678
|
+
.remap({
|
|
14679
|
+
from: key(c.left),
|
|
14680
|
+
to: key('left_arrow', ['command', 'option'])
|
|
14681
|
+
})
|
|
14682
|
+
.remap({
|
|
14683
|
+
from: key(c.right),
|
|
14684
|
+
to: key('right_arrow', ['command', 'option'])
|
|
14685
|
+
});
|
|
14686
|
+
},
|
|
14687
|
+
eclipse(c, r) {
|
|
14688
|
+
r.cond(modding)
|
|
14689
|
+
.remap({
|
|
14690
|
+
from: key(c.left),
|
|
14691
|
+
to: key('page_up', 'control')
|
|
14692
|
+
})
|
|
14693
|
+
.remap({
|
|
14694
|
+
from: key(c.right),
|
|
14695
|
+
to: key('page_down', 'control')
|
|
14696
|
+
});
|
|
14697
|
+
},
|
|
14698
|
+
others(c, r) {
|
|
14699
|
+
r.cond(modding)
|
|
14700
|
+
.remap({
|
|
14701
|
+
from: key(c.left),
|
|
14702
|
+
to: key('tab', ['control', 'shift'])
|
|
14703
|
+
})
|
|
14704
|
+
.remap({
|
|
14705
|
+
from: key(c.right),
|
|
14706
|
+
to: key('tab', 'control')
|
|
14707
|
+
});
|
|
14708
|
+
},
|
|
14696
14709
|
},
|
|
14697
14710
|
},
|
|
14698
14711
|
|
|
@@ -14917,32 +14930,132 @@ function requireRules () {
|
|
|
14917
14930
|
});
|
|
14918
14931
|
},
|
|
14919
14932
|
|
|
14920
|
-
'
|
|
14921
|
-
r
|
|
14922
|
-
|
|
14923
|
-
|
|
14924
|
-
|
|
14925
|
-
|
|
14933
|
+
'mouse mode': {
|
|
14934
|
+
'on'(c, r) {
|
|
14935
|
+
r.cond(modding)
|
|
14936
|
+
.cond(if_var(mouse_mode, 0))
|
|
14937
|
+
.remap({
|
|
14938
|
+
from: key(c.on),
|
|
14939
|
+
to: set_var(mouse_mode, 1)
|
|
14940
|
+
});
|
|
14941
|
+
},
|
|
14942
|
+
'off'(c, r) {
|
|
14943
|
+
r.cond(modding)
|
|
14944
|
+
.cond(if_var(mouse_mode, 1))
|
|
14945
|
+
.remap({
|
|
14946
|
+
from: key(c.off),
|
|
14947
|
+
to: set_var(mouse_mode, 0)
|
|
14948
|
+
});
|
|
14949
|
+
},
|
|
14926
14950
|
},
|
|
14927
14951
|
|
|
14928
|
-
'
|
|
14929
|
-
r.cond(
|
|
14930
|
-
.
|
|
14931
|
-
|
|
14932
|
-
to: {pointing_button: c.to}
|
|
14933
|
-
});
|
|
14952
|
+
'mouse move'(c, r) {
|
|
14953
|
+
r.cond(if_var(mouse_mode, 1))
|
|
14954
|
+
.cond(if_touched(0));
|
|
14955
|
+
mouse_move(c, r);
|
|
14934
14956
|
},
|
|
14935
14957
|
|
|
14936
|
-
'
|
|
14937
|
-
r.cond(
|
|
14938
|
-
.
|
|
14939
|
-
|
|
14940
|
-
|
|
14941
|
-
|
|
14958
|
+
'mouse buttons'(c, r) {
|
|
14959
|
+
r.cond(if_var(mouse_mode, 1))
|
|
14960
|
+
.cond(if_touched(0));
|
|
14961
|
+
mouse_buttons(c, r);
|
|
14962
|
+
},
|
|
14963
|
+
|
|
14964
|
+
'mouse wheel up/down'(c, r) {
|
|
14965
|
+
r.cond(if_var(mouse_mode, 1))
|
|
14966
|
+
.cond(if_touched(0));
|
|
14967
|
+
mouse_wheel_v(c, r);
|
|
14968
|
+
},
|
|
14969
|
+
|
|
14970
|
+
'mouse wheel left/right'(c, r) {
|
|
14971
|
+
r.cond(if_var(mouse_mode, 1))
|
|
14972
|
+
.cond(if_touched(0));
|
|
14973
|
+
mouse_wheel_h(c, r);
|
|
14974
|
+
},
|
|
14975
|
+
|
|
14976
|
+
'touch to mouse move'(c, r) {
|
|
14977
|
+
r.cond(if_touched(1));
|
|
14978
|
+
mouse_move(c, r);
|
|
14979
|
+
},
|
|
14980
|
+
|
|
14981
|
+
'touch to mouse buttons'(c, r) {
|
|
14982
|
+
r.cond(if_touched(1));
|
|
14983
|
+
mouse_buttons(c, r);
|
|
14984
|
+
},
|
|
14985
|
+
|
|
14986
|
+
'touch to mouse wheel up/down'(c, r) {
|
|
14987
|
+
r.cond(if_touched(1));
|
|
14988
|
+
mouse_wheel_v(c, r);
|
|
14989
|
+
},
|
|
14990
|
+
|
|
14991
|
+
'touch to mouse wheel left/right'(c, r) {
|
|
14992
|
+
r.cond(if_touched(1));
|
|
14993
|
+
mouse_wheel_h(c, r);
|
|
14942
14994
|
},
|
|
14943
14995
|
|
|
14944
14996
|
};
|
|
14945
14997
|
|
|
14998
|
+
function mouse_move(c, r) {
|
|
14999
|
+
let speed = Math.round(1536 * c.speed);
|
|
15000
|
+
r.remap({
|
|
15001
|
+
from: key(c.up, any),
|
|
15002
|
+
to: {mouse_key: {y: -speed}}
|
|
15003
|
+
})
|
|
15004
|
+
.remap({
|
|
15005
|
+
from: key(c.right, any),
|
|
15006
|
+
to: {mouse_key: {x: speed}}
|
|
15007
|
+
})
|
|
15008
|
+
.remap({
|
|
15009
|
+
from: key(c.down, any),
|
|
15010
|
+
to: {mouse_key: {y: speed}}
|
|
15011
|
+
})
|
|
15012
|
+
.remap({
|
|
15013
|
+
from: key(c.left, any),
|
|
15014
|
+
to: {mouse_key: {x: -speed}}
|
|
15015
|
+
});
|
|
15016
|
+
}
|
|
15017
|
+
|
|
15018
|
+
function mouse_buttons(c, r) {
|
|
15019
|
+
r.remap({
|
|
15020
|
+
from: key(c.left, any),
|
|
15021
|
+
to: {pointing_button: 'button1'}
|
|
15022
|
+
})
|
|
15023
|
+
.remap({
|
|
15024
|
+
from: key(c.right, any),
|
|
15025
|
+
to: {pointing_button: 'button2'}
|
|
15026
|
+
});
|
|
15027
|
+
r.remap({
|
|
15028
|
+
from: key(c.middle, any),
|
|
15029
|
+
to: {pointing_button: 'button3'}
|
|
15030
|
+
});
|
|
15031
|
+
}
|
|
15032
|
+
|
|
15033
|
+
function mouse_wheel_v(c, r) {
|
|
15034
|
+
let speed = Math.round(32 * c.speed);
|
|
15035
|
+
let flip = c.reverse ? -1 : 1;
|
|
15036
|
+
r.remap({
|
|
15037
|
+
from: key(c.up, any),
|
|
15038
|
+
to: {mouse_key: {vertical_wheel: -speed * flip}}
|
|
15039
|
+
})
|
|
15040
|
+
.remap({
|
|
15041
|
+
from: key(c.down, any),
|
|
15042
|
+
to: {mouse_key: {vertical_wheel: speed * flip}}
|
|
15043
|
+
});
|
|
15044
|
+
}
|
|
15045
|
+
|
|
15046
|
+
function mouse_wheel_h(c, r) {
|
|
15047
|
+
let speed = Math.round(32 * c.speed);
|
|
15048
|
+
let flip = c.reverse ? -1 : 1;
|
|
15049
|
+
r.remap({
|
|
15050
|
+
from: key(c.left, any),
|
|
15051
|
+
to: {mouse_key: {horizontal_wheel: speed * flip}}
|
|
15052
|
+
})
|
|
15053
|
+
.remap({
|
|
15054
|
+
from: key(c.right, any),
|
|
15055
|
+
to: {mouse_key: {horizontal_wheel: -speed * flip}}
|
|
15056
|
+
});
|
|
15057
|
+
}
|
|
15058
|
+
|
|
14946
15059
|
rules_1 = rules;
|
|
14947
15060
|
return rules_1;
|
|
14948
15061
|
}var hasRequiredMain;
|
|
@@ -14995,7 +15108,7 @@ function requireMain () {
|
|
|
14995
15108
|
|
|
14996
15109
|
const pkg = require$$9;
|
|
14997
15110
|
const rules = requireRules();
|
|
14998
|
-
const defaultsYML = "# === KEYCOMFORT CONFIG ===\n# NOTE:\n# 0 means \"No\"\n# 1 means \"Yes\"\n\npaths:\n karabiner:\n save_as: ~/.config/karabiner/assets/complex_modifications/keycomfort.json\n apply_to: ~/.config/karabiner/karabiner.json\n ahk:\n save_as: ~/Desktop/keycomfort.ahk\n apply_to:\n\nvim_like: 0 # prefer vim-like mappings?\n\nrules: # mapping rules\n\n modifier:\n desc: Use [key] as a special modifier key (Required)\n enable: 1\n key: spacebar\n alone: spacebar\n\n cancel modifier:\n desc: Cancel modifier (<modifier>) with [key]\n enable: 1\n key: left_shift\n\n disable modifier:\n desc: Disable modifier (<modifier>) with <modifier> + [key]\n enable: 1\n key: right_shift + escape\n\n enable modifier:\n desc: Enable modifier (<modifier>) with [key]\n enable: 1\n key: right_shift + escape\n\n arrows:\n desc: <modifier> + { [up] / [right] / [down] / [left] } = Up / Right / Down / Left\n enable: 1\n up: e\n right: f\n down: d\n left: s\n\n page up/down:\n desc: <modifier> + { [up] / [down] } = Page Up / Down\n enable: 1\n up: w\n down: r\n\n prev/next word:\n desc: <modifier> + { [prev] / [next] } = Prev / Next Word\n enable: 1\n prev: a\n next: g\n apps:\n sonicpi: 1\n others: 1\n\n line start/end:\n desc: <modifier> + { [start] / [end] } = Line Start / End\n enable: 1\n start: q\n end: t\n apps:\n terminal: 1\n sonicpi: 1\n others: 1\n\n select:\n desc: <modifier> + { [up] / [right] / [down] / [left] } = Select Up / Right / Down / Left\n enable: 1\n up: i\n right: l\n down: k\n left: j\n vim:\n left: h\n down: j\n up: k\n right: l\n\n indent/outdent:\n desc: <modifier> + { [indent] / [outdent] } = Indent / Outdent\n enable: 1\n indent: o\n outdent: u\n\n backspace/delete:\n desc: <modifier> + { [backspace] / [delete] } = Backspace / Delete\n enable: 1\n backspace: n\n delete: m\n\n delete word:\n desc: <modifier> + [key] = Delete Word\n enable: 1\n key: b\n\n edit:\n desc: <modifier> + { [undo] / [cut] / [copy] / [paste] } = Undo / Cut / Copy / Paste\n enable: 1\n undo: z\n cut: x\n copy: c\n paste: v\n\n delete line:\n desc: <modifier> + [key] = Delete Line\n enable: 1\n key: shift + m\n apps:\n atom: 1\n vscode: 1\n eclipse: 1\n\n insert line:\n desc: <modifier> + [key] = New Line Below\n enable: 1\n key: return_or_enter\n apps:\n atom: 1\n vscode: 1\n eclipse: 1\n\n move line:\n desc: <modifier> + { [up] / [down] } = Move Line Up / Down\n enable: 1\n up: shift + i\n down: shift + k\n vim:\n up: shift + k\n down: shift + j\n apps:\n atom: 1\n vscode: 1\n eclipse: 1\n sonicpi: 1\n\n left/right tab:\n desc: <modifier> + { [left] / [right] } = Left / Right Tab\n enable: 1\n left: 2\n right: 3\n apps:\n vscode: 1\n eclipse: 1\n others: 1\n\n close/open tab:\n desc: <modifier> + { [close] / [open] } = Close / Open Tab\n enable: 1\n close: 1\n open: 4\n\n numpad:\n desc: <modifier> + [trigger] = Numpad Mode ([num1]=1, [num5]=5, [num9]=9)\n enable: 1\n trigger: left_control\n\n num0: b\n num1: n\n num2: m\n num3: comma\n\n num4: j\n num5: k\n num6: l\n\n num7: u\n num8: i\n num9: o\n\n slash: 8\n asterisk: 9\n hyphen: 0\n plus: p\n\n enter: slash\n delete: semicolon\n backspace: h\n\n plus/minus:\n desc: <modifier> + { [plus] / [minus] } = Plus / Minus\n enable: 1\n plus: p\n minus: shift + p\n to:\n plus: shift + equal_sign\n minus: hyphen\n\n backslash:\n desc: <modifier> + [from] = Backslash\n enable: 1\n from: slash\n to: backslash\n\n backtick:\n desc: <modifier> + [from] = Backtick\n enable: 1\n from: quote\n to: grave_accent_and_tilde\n\n tilde:\n desc: <modifier> + [from] = Tilde\n enable: 1\n from: hyphen\n to: shift + grave_accent_and_tilde\n\n pipe:\n desc: <modifier> + [from] = Pipe\n enable: 1\n from: 7\n to: shift + backslash\n\n equal:\n desc: <modifier> + [from] = Equal Sign\n enable: 1\n from: semicolon\n to: equal_sign\n\n enter:\n desc: <modifier> + [from] = Enter\n enable: 1\n from: tab\n to: return_or_enter\n\n underscore:\n desc: <modifier> + [from] = Underscore\n enable: 1\n from: period\n to: shift + hyphen\n\n custom:\n desc: <modifier> + Custom Keys\n enable: 1\n rules:\n # Examples\n # - from: p\n # to: shift + equal_sign\n\n remap capslock:\n desc: Caps Lock = [to] / [alone]\n enable: 1\n to: left_control\n alone: escape\n\n remap l-control:\n desc: Left Control = [to] / [alone]\n enable: 1\n to: left_control\n alone: escape\n\n remap r-control:\n desc: Right Control = [to] / [alone]\n enable: 0\n to: right_control\n alone: escape\n\n remap l-command:\n desc: Left Command = [to] / [alone]\n enable: 0\n to: left_command\n alone: left_command\n\n remap r-command:\n desc: Right Command = [to] / [alone]\n enable: 0\n to: right_command\n alone: right_command\n\n remap l-shift:\n desc: Left Shift = [to] / [alone]\n enable: 0\n to: left_shift\n alone: left_shift\n\n remap r-shift:\n desc: Right Shift = [to] / [alone]\n enable: 0\n to: right_shift\n alone: right_shift\n\n
|
|
15111
|
+
const defaultsYML = "# === KEYCOMFORT CONFIG ===\n# NOTE:\n# 0 means \"No\"\n# 1 means \"Yes\"\n\npaths:\n karabiner:\n save_as: ~/.config/karabiner/assets/complex_modifications/keycomfort.json\n apply_to: ~/.config/karabiner/karabiner.json\n ahk:\n save_as: ~/Desktop/keycomfort.ahk\n apply_to:\n\nvim_like: 0 # prefer vim-like mappings?\n\nrules: # mapping rules\n\n modifier:\n desc: Use [key] as a special modifier key (Required)\n enable: 1\n key: spacebar\n alone: spacebar\n\n cancel modifier:\n desc: Cancel modifier (<modifier>) with [key]\n enable: 1\n key: left_shift\n\n disable modifier:\n desc: Disable modifier (<modifier>) with <modifier> + [key]\n enable: 1\n key: right_shift + escape\n\n enable modifier:\n desc: Enable modifier (<modifier>) with [key]\n enable: 1\n key: right_shift + escape\n\n arrows:\n desc: <modifier> + { [up] / [right] / [down] / [left] } = Up / Right / Down / Left\n enable: 1\n up: e\n right: f\n down: d\n left: s\n\n page up/down:\n desc: <modifier> + { [up] / [down] } = Page Up / Down\n enable: 1\n up: w\n down: r\n\n prev/next word:\n desc: <modifier> + { [prev] / [next] } = Prev / Next Word\n enable: 1\n prev: a\n next: g\n apps:\n sonicpi: 1\n others: 1\n\n line start/end:\n desc: <modifier> + { [start] / [end] } = Line Start / End\n enable: 1\n start: q\n end: t\n apps:\n terminal: 1\n sonicpi: 1\n others: 1\n\n select:\n desc: <modifier> + { [up] / [right] / [down] / [left] } = Select Up / Right / Down / Left\n enable: 1\n up: i\n right: l\n down: k\n left: j\n vim:\n left: h\n down: j\n up: k\n right: l\n\n indent/outdent:\n desc: <modifier> + { [indent] / [outdent] } = Indent / Outdent\n enable: 1\n indent: o\n outdent: u\n\n backspace/delete:\n desc: <modifier> + { [backspace] / [delete] } = Backspace / Delete\n enable: 1\n backspace: n\n delete: m\n\n delete word:\n desc: <modifier> + [key] = Delete Word\n enable: 1\n key: b\n\n edit:\n desc: <modifier> + { [undo] / [cut] / [copy] / [paste] } = Undo / Cut / Copy / Paste\n enable: 1\n undo: z\n cut: x\n copy: c\n paste: v\n\n delete line:\n desc: <modifier> + [key] = Delete Line\n enable: 1\n key: shift + m\n apps:\n atom: 1\n vscode: 1\n eclipse: 1\n\n insert line:\n desc: <modifier> + [key] = New Line Below\n enable: 1\n key: return_or_enter\n apps:\n atom: 1\n vscode: 1\n eclipse: 1\n\n move line:\n desc: <modifier> + { [up] / [down] } = Move Line Up / Down\n enable: 1\n up: shift + i\n down: shift + k\n vim:\n up: shift + k\n down: shift + j\n apps:\n atom: 1\n vscode: 1\n eclipse: 1\n sonicpi: 1\n\n left/right tab:\n desc: <modifier> + { [left] / [right] } = Left / Right Tab\n enable: 1\n left: 2\n right: 3\n apps:\n vscode: 1\n eclipse: 1\n others: 1\n\n close/open tab:\n desc: <modifier> + { [close] / [open] } = Close / Open Tab\n enable: 1\n close: 1\n open: 4\n\n numpad:\n desc: <modifier> + [trigger] = Numpad Mode ([num1]=1, [num5]=5, [num9]=9)\n enable: 1\n trigger: left_control\n\n num0: b\n num1: n\n num2: m\n num3: comma\n\n num4: j\n num5: k\n num6: l\n\n num7: u\n num8: i\n num9: o\n\n slash: 8\n asterisk: 9\n hyphen: 0\n plus: p\n\n enter: slash\n delete: semicolon\n backspace: h\n\n plus/minus:\n desc: <modifier> + { [plus] / [minus] } = Plus / Minus\n enable: 1\n plus: p\n minus: shift + p\n to:\n plus: shift + equal_sign\n minus: hyphen\n\n backslash:\n desc: <modifier> + [from] = Backslash\n enable: 1\n from: slash\n to: backslash\n\n backtick:\n desc: <modifier> + [from] = Backtick\n enable: 1\n from: quote\n to: grave_accent_and_tilde\n\n tilde:\n desc: <modifier> + [from] = Tilde\n enable: 1\n from: hyphen\n to: shift + grave_accent_and_tilde\n\n pipe:\n desc: <modifier> + [from] = Pipe\n enable: 1\n from: 7\n to: shift + backslash\n\n equal:\n desc: <modifier> + [from] = Equal Sign\n enable: 1\n from: semicolon\n to: equal_sign\n\n enter:\n desc: <modifier> + [from] = Enter\n enable: 1\n from: tab\n to: return_or_enter\n\n underscore:\n desc: <modifier> + [from] = Underscore\n enable: 1\n from: period\n to: shift + hyphen\n\n custom:\n desc: <modifier> + Custom Keys\n enable: 1\n rules:\n # Examples\n # - from: p\n # to: shift + equal_sign\n\n remap capslock:\n desc: Caps Lock = [to] / [alone]\n enable: 1\n to: left_control\n alone: escape\n\n remap l-control:\n desc: Left Control = [to] / [alone]\n enable: 1\n to: left_control\n alone: escape\n\n remap r-control:\n desc: Right Control = [to] / [alone]\n enable: 0\n to: right_control\n alone: escape\n\n remap l-command:\n desc: Left Command = [to] / [alone]\n enable: 0\n to: left_command\n alone: left_command\n\n remap r-command:\n desc: Right Command = [to] / [alone]\n enable: 0\n to: right_command\n alone: right_command\n\n remap l-shift:\n desc: Left Shift = [to] / [alone]\n enable: 0\n to: left_shift\n alone: left_shift\n\n remap r-shift:\n desc: Right Shift = [to] / [alone]\n enable: 0\n to: right_shift\n alone: right_shift\n\n mouse mode:\n desc: <modifier> + { [on] / [off] } = Mouse Mode On / Off\n enable: 1\n on: 9\n off: 0\n\n mouse move:\n desc: (Mouse Mode) [up] / [right] / [down] / [left] = Move Mouse Up / Right / Down / Left\n enable: 1\n up: e\n right: f\n down: d\n left: s\n speed: 1.0\n\n mouse buttons:\n desc: (Mouse Mode) [left] / [middle] / [right] = Mouse Buttons Left / Middle / Right\n enable: 1\n left: j\n middle: m\n right: l\n\n mouse wheel up/down:\n desc: (Mouse Mode) [up] / [down] = Mouse Wheel Up / Down\n enable: 1\n up: i\n down: k\n speed: 1.0\n\n mouse wheel left/right:\n desc: (Mouse Mode) [left] / [right] = Mouse Wheel Left / Right\n enable: 1\n left: h\n right: semicolon\n speed: 1.0\n\n touch to mouse move:\n desc: Touchpad + { [up] / [right] / [down] / [left] } = Move Mouse Up / Right / Down / Left\n enable: 1\n up: e\n right: f\n down: d\n left: s\n speed: 1.0\n\n touch to mouse buttons:\n desc: Touchpad + { [left] / [middle] / [right] } = Mouse Buttons Left / Middle / Right\n enable: 1\n left: j\n middle: m\n right: l\n\n touch to mouse wheel up/down:\n desc: Touchpad + { [up] / [down] } = Mouse Wheel Up / Down\n enable: 1\n up: i\n down: k\n speed: 1.0\n\n touch to mouse wheel left/right:\n desc: Touchpad + { [left] / [right] } = Mouse Wheel Left / Right\n enable: 1\n left: h\n right: semicolon\n speed: 1.0\n\n\napps:\n others:\n enable: 1\n\n login:\n enable: 1\n id:\n - com.apple.loginwindow\n\n terminal:\n enable: 1\n id:\n - com.apple.Terminal\n - com.googlecode.iterm2\n - org.alacritty\n exe:\n - cmd.exe\n\n vscode:\n enable: 0\n id:\n - com.microsoft.VSCode\n - com.vscodium\n exe:\n - Code.exe\n\n atom:\n enable: 0\n id:\n - com.github.atom\n - dev.pulsar-edit.pulsar\n\n eclipse:\n enable: 0\n id:\n - org.eclipse.platform.ide\n exe:\n - eclipse.exe\n\n sonicpi:\n enable: 0\n id:\n - net.sonic-pi.app\n\n\nkey_labels: # display names for key codes\n spacebar: Space\n return_or_enter: Enter\n grave_accent_and_tilde: Backtick\n button1: Left Click\n button2: Right Click\n button3: Middle Click\n japanese_eisuu: 英数\n japanese_kana: かな\n\n";
|
|
14999
15112
|
const defaults = yaml.parse(defaultsYML);
|
|
15000
15113
|
const defaultConfig = loc(io.home, '.config', 'keycomfort', 'config.yml');
|
|
15001
15114
|
|
|
@@ -15176,57 +15289,67 @@ function requireMain () {
|
|
|
15176
15289
|
if (userConfig) config = merge(config, userConfig);
|
|
15177
15290
|
}
|
|
15178
15291
|
let modifier = config.rules.modifier.key;
|
|
15179
|
-
let apps
|
|
15180
|
-
let labels
|
|
15181
|
-
let vim
|
|
15292
|
+
let apps = config.apps;
|
|
15293
|
+
let labels = config.key_labels;
|
|
15294
|
+
let vim = config.vim_like;
|
|
15182
15295
|
|
|
15183
|
-
// run rules
|
|
15184
15296
|
let ruleSet = new RuleSet('KeyComfort');
|
|
15185
|
-
for (let i in rules) {
|
|
15186
|
-
|
|
15187
|
-
// rule config
|
|
15188
|
-
let rc = config.rules[i];
|
|
15189
|
-
if (!rc) continue;
|
|
15190
|
-
if (!rc.enable) continue; // rule disabled
|
|
15191
15297
|
|
|
15298
|
+
function addRule(rule, rc, desc = undefined) {
|
|
15192
15299
|
// overwrite conf with vim-like mappings
|
|
15193
|
-
if (
|
|
15300
|
+
if (vim && rc.vim) rc = merge(rc, rc.vim);
|
|
15194
15301
|
|
|
15195
15302
|
// format rule description
|
|
15196
|
-
|
|
15197
|
-
|
|
15198
|
-
|
|
15199
|
-
|
|
15200
|
-
|
|
15201
|
-
let newRule;
|
|
15303
|
+
if (!desc) {
|
|
15304
|
+
desc = rc.desc.replaceAll(/(?:<modifier>|\[([_0-9a-z]+)\])/gi, (_, m1) => {
|
|
15305
|
+
return label(m1 ? rc[m1] : modifier, labels);
|
|
15306
|
+
});
|
|
15307
|
+
}
|
|
15202
15308
|
|
|
15203
|
-
//
|
|
15309
|
+
// apply rule
|
|
15204
15310
|
if (typeof rule == 'function') {
|
|
15205
|
-
|
|
15206
|
-
|
|
15207
|
-
continue;
|
|
15311
|
+
rule(rc, ruleSet.add(desc));
|
|
15312
|
+
return;
|
|
15208
15313
|
}
|
|
15209
15314
|
|
|
15210
|
-
// app-specific
|
|
15211
|
-
|
|
15212
|
-
|
|
15213
|
-
|
|
15214
|
-
|
|
15215
|
-
|
|
15216
|
-
|
|
15217
|
-
|
|
15218
|
-
|
|
15219
|
-
|
|
15220
|
-
|
|
15221
|
-
|
|
15315
|
+
// apply app-specific rules
|
|
15316
|
+
if (rule.apps) {
|
|
15317
|
+
let newRule;
|
|
15318
|
+
let enabled = []; // enabled apps
|
|
15319
|
+
for (let app in rule.apps) {
|
|
15320
|
+
if (app == 'others') continue;
|
|
15321
|
+
if (!apps[app]) continue; // uknown app
|
|
15322
|
+
if (!apps[app].enable) continue; // globally disabled
|
|
15323
|
+
if (!rc.apps[app]) continue; // disabled for this rule
|
|
15324
|
+
if (isEmpty(apps[app].id)) continue; // no app-id
|
|
15325
|
+
enabled = enabled.concat(apps[app].id);
|
|
15326
|
+
newRule = ruleSet.add(desc + ` (${app})`);
|
|
15327
|
+
newRule.cond(if_app(...apps[app].id));
|
|
15328
|
+
rule.apps[app](rc, newRule);
|
|
15329
|
+
}
|
|
15330
|
+
if (apps.others.enable && rc.apps.others) {
|
|
15331
|
+
newRule = ruleSet.add(desc);
|
|
15332
|
+
if (enabled.length) newRule.cond(unless_app(...enabled));
|
|
15333
|
+
rule.apps.others(rc, newRule);
|
|
15334
|
+
}
|
|
15335
|
+
delete rule.apps;
|
|
15222
15336
|
}
|
|
15223
|
-
|
|
15224
|
-
|
|
15225
|
-
|
|
15226
|
-
rule
|
|
15337
|
+
|
|
15338
|
+
// apply branching rules
|
|
15339
|
+
for (let k in rule) {
|
|
15340
|
+
addRule(rule[k], rc, `${desc} :: ${k}`); // RECURSION
|
|
15227
15341
|
}
|
|
15228
15342
|
}
|
|
15229
15343
|
|
|
15344
|
+
for (let i in rules) {
|
|
15345
|
+
// rule config
|
|
15346
|
+
let rc = config.rules[i];
|
|
15347
|
+
if (!rc) continue;
|
|
15348
|
+
if (!rc.enable) continue; // rule disabled
|
|
15349
|
+
|
|
15350
|
+
addRule(rules[i], rc);
|
|
15351
|
+
}
|
|
15352
|
+
|
|
15230
15353
|
let data = ruleSet.toJSON();
|
|
15231
15354
|
let result = JSON.stringify(data, null, 2);
|
|
15232
15355
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keycomfort",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Comfortable keyboard remaps for Karabiner/AutoHotKey",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/keycomfort.js"
|
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"dev": "rollup -c --watch",
|
|
13
13
|
"test": "echo noop",
|
|
14
|
-
"
|
|
14
|
+
"version": "npm --no-git-tag-version version",
|
|
15
|
+
"build": "rollup -c && chmod u+x ./dist/keycomfort.js",
|
|
15
16
|
"clean": "rm -rf ./dist",
|
|
16
|
-
"dist": "npm run clean; NODE_ENV=production npm run build"
|
|
17
|
+
"dist": "npm run clean; NODE_ENV=production npm run build && npm run test"
|
|
17
18
|
},
|
|
18
19
|
"repository": {
|
|
19
20
|
"type": "git",
|
|
@@ -22,6 +23,8 @@
|
|
|
22
23
|
"keywords": [
|
|
23
24
|
"keyboard",
|
|
24
25
|
"remap",
|
|
26
|
+
"accessibility",
|
|
27
|
+
"a11y",
|
|
25
28
|
"karabiner",
|
|
26
29
|
"mac",
|
|
27
30
|
"macos",
|