Skip to content

Commit

Permalink
Added more functionality to the Swedish keymap
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobEdvardsson authored and xs5871 committed Apr 7, 2024
1 parent 2cc35db commit 258e48d
Show file tree
Hide file tree
Showing 2 changed files with 138 additions and 40 deletions.
142 changes: 108 additions & 34 deletions boards/budgy/keymap_sw.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
R_ALT = KC.HT(KC.R, KC.LALT, prefer_hold=False, tap_time=300)
A_META = KC.HT(KC.A, KC.LWIN, prefer_hold=False, tap_time=300)

D_WM = KC.HT(KC.D, KC.MO(5), prefer_hold=False, tap_time=300)
SPACE_NUM = KC.HT(KC.SPACE, KC.MO(3),prefer_hold=False, tap_time=300)


# Right side
N_SHIFT = KC.HT(KC.N, KC.LSFT, prefer_hold=False, tap_time=200)
E_CTRL = KC.HT(KC.E, KC.LCTRL, prefer_hold=False, tap_time=200)
Expand All @@ -17,7 +21,8 @@
# Define
XXXX = KC.NO
____ = KC.TRANSPARENT
SYMBOL = KC.MO(1)
SYMBOL = KC.LT(1, KC.TO(6))

MOD = KC.MO(2)


Expand Down Expand Up @@ -81,25 +86,64 @@
QUOTE = KC.BSLASH
R_QUOTE = KC.RALT(KC.BSLASH)
L_QUOTE = KC.RSFT(KC.EQUAL)
HOLD_QUOTE = KC.HT(QUOTE, DUB_QUOTE)

# (-_) (.:) (,;)
DASH = KC.HT(KC.SLASH, KC.RSFT(KC.SLASH))
DOT = KC.HT(KC.DOT, KC.RSFT(KC.DOT))
COMMA = KC.HT(KC.COMMA, KC.RSFT(KC.COMMA))

# Zoom CTRL(+) CTRL(-) CTRL(0)
ZOOM_IN = KC.LCTRL(PLUS)
ZOOM_OUT = KC.LCTRL(MINUS)
ZOOM_RESET = KC.LCTRL(KC.N0)


# WM MOVEMENT
# GO
GO_LEFT = KC.LGUI(KC.LEFT)
GO_DOWN = KC.LGUI(KC.DOWN)
GO_UP = KC.LGUI(KC.UP)
GO_RIGHT = KC.LGUI(KC.RIGHT)
# MOVE
MOVE_LEFT = KC.LGUI(KC.LSFT(KC.LEFT))
MOVE_DOWN = KC.LGUI(KC.LSFT(KC.DOWN))
MOVE_UP = KC.LGUI(KC.LSFT(KC.UP))
MOVE_RIGHT = KC.LGUI(KC.LSFT(KC.RIGHT))
# JUMP
JUMP_LEFT = KC.LGUI(KC.LCTRL(KC.LEFT))
JUMP_DOWN = KC.LGUI(KC.LCTRL(KC.DOWN))
JUMP_UP = KC.LGUI(KC.LCTRL(KC.UP))
JUMP_RIGHT = KC.LGUI(KC.LCTRL(KC.RIGHT))

# MOUSE
MOUSE_LEFT = KC.MS_LEFT
MOUSE_DOWN = KC.MS_DOWN
MOUSE_UP = KC.MS_UP
MOUSE_RIGHT = KC.MS_RIGHT

LEFT_CLICK = KC.MB_LMB
RIGHT_CLICK = KC.MB_RMB

SCROLL_UP = KC.MW_UP
SCROLL_DOWN = KC.MW_DOWN
MOUSE_ESC = KC.NO


#####################
# End of definition #
#####################

COMBO_LAYER = {
(1, 2): 3,
(1, 2): 4, # Switch to F NUM layer
}


COMBOS = [
#Left Side
# Left Side
Chord((KC.F, KC.P), KC.ESC),
Chord((S_CTRL, T_SHIFT), KC.TAB),
Chord((MOUSE_UP, MOUSE_ESC), KC.ESC),


# Right side
Chord((KC.L, KC.U), KC.ENT),
Expand All @@ -110,45 +154,75 @@
# fmt: off
# flake8: noqa
KEYMAP = [
[# Colemak-DH
# q w f p b j l u y bsp
[ # Colemak-DH 0
# q w f p b j l u y '
# a r s t g m n e i o
# z x c d v k h (,;) (.:) (-_)
# spc SYM MOD SFT

KC.Q, KC.W, KC.F, KC.P, KC.B, KC.J, KC.L, KC.U, KC.Y, KC.BSPACE, \
A_META, R_ALT, S_CTRL, T_SHIFT, KC.G, KC.M, N_SHIFT, E_CTRL, I_ALT, O_META, \
KC.Z, KC.X, KC.C, KC.D, KC.V, KC.K, KC.H, COMMA, DOT, DASH, \
KC.SPACE, SYMBOL, MOD, KC.RSFT,
KC.Q, KC.W, KC.F, KC.P, KC.B, KC.J, KC.L, KC.U, KC.Y, HOLD_QUOTE, \
A_META, R_ALT, S_CTRL, T_SHIFT, KC.G, KC.M, N_SHIFT, E_CTRL, I_ALT, O_META, \
KC.Z, KC.X, KC.C, D_WM, KC.V, KC.K, KC.H, COMMA, DOT, DASH, \
SPACE_NUM, SYMBOL, MOD, KC.RSFT,
],
[# Symbol
[ # Symbol 1
# ! @ # {/} ? + - = * Å
# $ % & (/) / ~ ' " Ö Ä
# | < > [/] \ ` ´ £ € ^
# spc SYM MOD SFT
KC.EXLM, AT, KC.HASH, CIRLYBRACKET, QUESTION, PLUS, MINUS, EQUAL, MULTIPLY, SWE_Å, \
DOLLAR, PERCENT, AND, PARENT, SLASH, TILDE, QUOTE, DUB_QUOTE, SWE_Ö, SWE_Ä, \
PIPE, LESS_THAN, GREATER_THAN, SQUERE_BRACKET, BACKSLASH, L_QUOTE, R_QUOTE, POUND, EURO, HAT, \
KC.SPACE, SYMBOL, MOD, KC.RSFT,
KC.EXLM, AT, KC.HASH, CIRLYBRACKET, QUESTION, PLUS, MINUS, EQUAL, MULTIPLY, SWE_Å, \
DOLLAR, PERCENT, AND, PARENT, SLASH, TILDE, QUOTE, DUB_QUOTE, SWE_Ö, SWE_Ä, \
PIPE, LESS_THAN, GREATER_THAN, SQUERE_BRACKET, BACKSLASH, L_QUOTE, R_QUOTE, POUND, EURO, HAT, \
KC.SPACE, SYMBOL, MOD, KC.RSFT,
],
[# MOD
# BRI+ BRI- VOL- VOL+ X HOME PG_DN PG_UP END BSP
# META ALT CTRL SHIFT X X ← ↓
# ESC Mctrl Mshift TAB REP* REP* ENT + - DEL
[ # MOD 2
# BRI+ BRI- VOL- VOL+ MUTE HOME PG_DN PG_UP END BSP
# META ALT CTRL SHIFT INSERT X
# ESC PLAY/PAUSE Mshift PSCR PSCR X ENT CTRL(+) CTRL(-) CTRL(0)
# spc SYM MOD SFT
KC.BRIGHTNESS_DOWN, KC.BRIGHTNESS_UP, KC.AUDIO_VOL_DOWN, KC.AUDIO_VOL_UP, KC.MEDIA_PLAY_PAUSE, KC.HOME, KC.PGDOWN, KC.PGUP, KC.END, KC.BSPACE, \
KC.LGUI, KC.LALT, KC.LCTRL, KC.LSHIFT, XXXX, XXXX, KC.LEFT, KC.DOWN, KC.UP, KC.RIGHT, \
KC.ESC, KC.LGUI(KC.LCTRL), KC.LGUI(KC.LSHIFT), KC.TAB, XXXX, XXXX, KC.ENT, PLUS, MINUS, KC.DEL, \
KC.SPACE, SYMBOL, MOD, KC.RSFT,
KC.BRIGHTNESS_DOWN, KC.BRIGHTNESS_UP, KC.AUDIO_VOL_DOWN, KC.AUDIO_VOL_UP, KC.AUDIO_MUTE, KC.HOME, KC.PGDOWN, KC.PGUP, KC.END, KC.BSPACE, \
KC.LGUI, KC.LALT, KC.LCTRL, KC.LSHIFT,KC.INSERT, XXXX, KC.LEFT, KC.DOWN, KC.UP, KC.RIGHT, \
KC.ESC, KC.MEDIA_PLAY_PAUSE, KC.MEDIA_PREV_TRACK, KC.MEDIA_NEXT_TRACK, KC.PSCREEN, XXXX, KC.ENT, ZOOM_IN, ZOOM_OUT, ZOOM_RESET, \
KC.SPACE, SYMBOL, MOD, KC.RSFT,
],
[# NUM
# X f7 f8 f9 f10 X 7 8 9 BSP
# X f4 f5 f6 f11 X 4 5 6 X
# X f1 f2 f3 f12 0 1 2 3 X
# X X X X
XXXX, KC.F7, KC.F7, KC.F8, KC.F10, XXXX, KC.N7, KC.N8, KC.N9, KC.BSPACE, \
XXXX, KC.F4, KC.F5, KC.F6, KC.F11, XXXX, KC.N4, KC.N5, KC.N6, XXXX, \
XXXX, KC.F1, KC.F2, KC.F3, KC.F12, KC.N0, KC.N1, KC.N2, KC.N3, XXXX, \
XXXX, XXXX, XXXX, XXXX,
]
]
[ # NUM 3
# X X X X X * 7 8 9 BSP
# META ALT CTRL SHIFT X / 4 5 6 X
# X X X X X - 1 2 3 X
# X X + 0
XXXX, XXXX, XXXX, XXXX, XXXX, MULTIPLY, KC.N7, KC.N8, KC.N9, KC.BSPACE, \
KC.LGUI, KC.LALT, KC.LCTRL, KC.LSHIFT, XXXX, SLASH, KC.N4, KC.N5, KC.N6, XXXX, \
XXXX, XXXX, XXXX, XXXX, XXXX, MINUS, KC.N1, KC.N2, KC.N3, XXXX, \
XXXX, XXXX, PLUS, KC.N0,
],
[ # F NUM 4
# X X X X X X f7 f8 f9 f10
# META ALT CTRL SHIFT X X f4 f5 f6 f11
# X X X X X X f1 f2 f3 f12
# X X X X
XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, KC.F7, KC.F7, KC.F8, KC.F10, \
KC.LGUI, KC.LALT, KC.LCTRL, KC.LSHIFT, XXXX, XXXX, KC.F4, KC.F5, KC.F6, KC.F11, \
XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, KC.F1, KC.F2, KC.F3, KC.F12, \
XXXX, XXXX, XXXX, XXXX,
],
[ # WM 5
# X X X X X X ML MD MU MR
# META ALT CTRL SHIFT X X GL GD GU GR
# X X X X X X JL JD JU JR
# X X X X
XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, MOVE_LEFT, MOVE_DOWN, MOVE_UP, MOVE_RIGHT, \
KC.LGUI, KC.LALT, KC.LCTRL, KC.LSHIFT, XXXX, XXXX, GO_LEFT, GO_DOWN, GO_UP, GO_RIGHT, \
XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, JUMP_LEFT, JUMP_DOWN, JUMP_UP, JUMP_RIGHT, \
XXXX, XXXX, XXXX, XXXX,
],
[ # MOUSE 6
# X X X X X X ML MD MU MR
# META ALT CTRL SHIFT X X GL GD GU GR
# X X X X X X JL JD JU JR
# X X X X
XXXX, XXXX, MOUSE_UP, MOUSE_ESC, XXXX, SCROLL_UP, XXXX, XXXX, XXXX, XXXX, \
XXXX, MOUSE_LEFT, MOUSE_DOWN, MOUSE_RIGHT, XXXX, SCROLL_DOWN, LEFT_CLICK, RIGHT_CLICK,XXXX, XXXX, \
XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX,\
XXXX, KC.TO(0), XXXX, XXXX,
],
]
36 changes: 30 additions & 6 deletions boards/budgy/main.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# Created by https://github.com/JakobEdvardsson/

import board
import digitalio

from kb import KMKKeyboard, isRight

from kmk.extensions.media_keys import MediaKeys
from kmk.modules.combos import Combos
from kmk.modules.holdtap import HoldTap
from kmk.modules.layers import Layers
from kmk.modules.layers import Layers as _Layers
from kmk.modules.mouse_keys import MouseKeys
from kmk.modules.split import Split, SplitSide, SplitType
from kmk.modules.tapdance import TapDance

keyboard = KMKKeyboard()

Expand All @@ -26,22 +29,43 @@
data_pin2=data_pin2,
)

layers = Layers()
holdtap = HoldTap()
mediaKeys = MediaKeys()
combos = Combos()
tapdance = TapDance()

keyboard.modules = [layers, split, holdtap, mediaKeys, combos]
mousekeys = MouseKeys(
max_speed=25,
acc_interval=17, # Delta ms to apply acceleration
move_step=1
)
led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT


# Todo: Import either keymap_sw (for Swedish Colemak-DH) or keymap_us (for English qwerty)
# Enable LED if on mouse layer
class Layers(_Layers):
last_top_layer = 0

def after_hid_send(self, keyboard):
if keyboard.active_layers[0] != self.last_top_layer:
self.last_top_layer = keyboard.active_layers[0]
if self.last_top_layer == 6: # mouse layer
led.value = True
else:
led.value = False

import keymap_us as keymap # noqa: E402

# import keymap_sw as keymap # noqa: E402
layers = Layers()


keyboard.modules = [layers, split, holdtap, combos, mousekeys, tapdance]
keyboard.extensions.append(mediaKeys)

# Todo: Import either keymap_sw (for Swedish Colemak-DH) or keymap_us (for English qwerty)
# import keymap_us as keymap # noqa: E402
import keymap_sw as keymap # noqa: E402

# Combo layer
layers.combo_layers = keymap.COMBO_LAYER

Expand Down

0 comments on commit 258e48d

Please sign in to comment.