Skip to content

Commit a23fe50

Browse files
committed
added modtap mouse keys and power modules
keycount is now calculated in pog.py more key labels
1 parent d7ab766 commit a23fe50

File tree

8 files changed

+2893
-56
lines changed

8 files changed

+2893
-56
lines changed

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,16 @@
3030
"@mdi/font": "^7.1.96",
3131
"@viselect/vue": "^3.2.5",
3232
"@vueuse/core": "^9.12.0",
33+
"@wagmi/core": "^0.9.7",
34+
"@web3modal/ethereum": "^2.1.2",
35+
"@web3modal/html": "^2.1.2",
3336
"@wlard/vue-class-store": "^3.0.0",
3437
"@wlard/vue3-popper": "^1.3.1",
3538
"daisyui": "^2.50.0",
3639
"dayjs": "^1.11.7",
3740
"decompress": "^4.2.1",
3841
"electron-updater": "^5.3.0",
42+
"ethers": "^5",
3943
"mini-svg-data-uri": "^1.4.4",
4044
"request": "^2.88.2",
4145
"sass": "^1.58.0",

src/main/pythontemplates/coordmaphelper.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ export const coordmaphelperpy = `# coordmaphelper.py helper script to get your c
22
from kmk.handlers.sequences import simple_key_sequence
33
from kmk.keys import KC
44
from kb import KMKKeyboard as _KMKKeyboard
5+
import pog
56
class KMKKeyboard(_KMKKeyboard):
67
# *2 for split keyboards, which will typically manage twice the number of keys
78
# of one side. Having this N too large will have no impact (maybe slower boot..)
8-
N = len(_KMKKeyboard.col_pins) * len(_KMKKeyboard.row_pins) *2
9+
N = pog.keyCount * 2
910
coord_mapping = list(range(N))
1011
1112
layer = []

src/main/pythontemplates/pog.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ for i, item in enumerate(config["directPins"]):
4040
pinsArray.append(renderPin(item))
4141
pins = ",".join(pinsArray)
4242
43+
if config['wiringMethod'] == 'matrix':
44+
keyCount = len(rowPinsArray) * len(colPinsArray)
45+
else:
46+
keyCount = len(pinsArray)
47+
4348
# encoders
4449
hasEncoders = len(config['encoders']) != 0
4550
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<template>
2+
<div>
3+
<w3m-core-button label="Login"></w3m-core-button>
4+
<div v-if="accountAddress">
5+
{{ renderedAccountAddress }}
6+
<div class="btn" @click="sign">sign</div>
7+
</div>
8+
</div>
9+
</template>
10+
11+
<script lang="ts" setup>
12+
import { EthereumClient, modalConnectors, walletConnectProvider } from '@web3modal/ethereum'
13+
import { Web3Modal } from '@web3modal/html'
14+
import { configureChains, createClient, signMessage } from '@wagmi/core'
15+
import { arbitrum, mainnet, polygon } from '@wagmi/core/chains'
16+
import { watchAccount } from '@wagmi/core'
17+
import { computed, ref } from 'vue'
18+
const chains = [arbitrum, mainnet, polygon]
19+
20+
// Wagmi Core Client
21+
const { provider } = configureChains(chains, [
22+
walletConnectProvider({ projectId: '7f2678536a5b6b5643d94a6428e341a1' })
23+
])
24+
const wagmiClient = createClient({
25+
autoConnect: true,
26+
connectors: modalConnectors({
27+
projectId: '7f2678536a5b6b5643d94a6428e341a1',
28+
version: '1', // or "2"
29+
appName: 'web3Modal',
30+
chains
31+
}),
32+
provider
33+
})
34+
35+
// Web3Modal and Ethereum Client
36+
const ethereumClient = new EthereumClient(wagmiClient, chains)
37+
const web3modal = new Web3Modal(
38+
{
39+
projectId: '7f2678536a5b6b5643d94a6428e341a1',
40+
themeColor: 'orange',
41+
themeBackground: 'themeColor',
42+
enableAccountView: false
43+
},
44+
ethereumClient
45+
)
46+
// const unsubscribe = web3modal.subscribeModal((newState) =>
47+
// console.log(newState)
48+
// );
49+
const accountAddress = ref('')
50+
const unwatch = watchAccount((account) => {
51+
if (account.address) {
52+
console.log('account changed', account.address)
53+
accountAddress.value = account.address
54+
} else {
55+
accountAddress.value = ''
56+
console.log('account disconnected')
57+
}
58+
})
59+
const sign = async () => {
60+
const signature = await signMessage({
61+
message: 'pog wants authorisation'
62+
})
63+
console.log(signature)
64+
}
65+
const renderedAccountAddress = computed(() => {
66+
return accountAddress.value.slice(0, 4) + '...' + accountAddress.value.slice(-4)
67+
})
68+
</script>
69+
70+
<style lang="scss" scoped></style>

src/renderer/src/helpers/index.ts

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -236,32 +236,64 @@ export const renderLabel = (keycode: string) => {
236236
DOT: { label: '.' },
237237
COMM: { label: ',' },
238238
SLSH: { label: '/' },
239+
KP_SLASH: { label: '/' },
239240
SCLN: { label: ';' },
240241
QUOT: { label: "'" },
241242
LSFT: { icon: 'mdi-apple-keyboard-shift' },
242243
RSFT: { icon: 'mdi-apple-keyboard-shift' },
243244
LBRC: { label: '[' },
244245
RBRC: { label: ']' },
246+
LABK: { label: '<' },
247+
RABK: { label: '>' },
248+
LCBR: { label: '{' },
249+
RCBR: { label: '}' },
250+
LEFT_PAREN: { label: '(' },
251+
RIGHT_PAREN: { label: ')' },
252+
DQT: { label: '"' },
253+
COLN: { label: ':' },
254+
EXLM: { label: '!' },
255+
PERCENT: { label: '%' },
256+
AMPERSAND: { label: '&' },
257+
TILDE: { label: '~' },
258+
PIPE: { label: '|' },
259+
DOLLAR: { label: '$' },
260+
HASH: { label: '#' },
261+
QUES: { label: '?' },
245262
BSLS: { label: '\\' },
246263
MINS: { label: '-' },
247264
EQL: { label: '=' },
248265
CAPS: { icon: 'mdi-apple-keyboard-caps' },
249266
TAB: { icon: 'mdi-keyboard-tab' },
250267
BSPC: { icon: 'mdi-backspace' },
268+
DEL: { icon: 'mdi-backspace-reverse' },
251269
LCTL: { icon: 'mdi-apple-keyboard-control' },
252270
RCTL: { icon: 'mdi-apple-keyboard-control' },
253271
LALT: { icon: 'mdi-apple-keyboard-option' },
254272
RALT: { icon: 'mdi-apple-keyboard-option' },
255273
LGUI: { icon: 'mdi-apple-keyboard-command' },
256274
RGUI: { icon: 'mdi-apple-keyboard-command' },
257-
UP: { icon: 'mdi-arrow-up' },
258-
LEFT: { icon: 'mdi-arrow-left' },
259-
DOWN: { icon: 'mdi-arrow-down' },
260-
RIGHT: { icon: 'mdi-arrow-right' },
275+
HOME: { icon: 'mdi-arrow-top-left' },
276+
END: { icon: 'mdi-arrow-bottom-right' },
277+
PGDOWN: { icon: 'mdi-arrow-down' },
278+
PGUP: { icon: 'mdi-arrow-up' },
279+
UP: { icon: 'mdi-arrow-up-thin' },
280+
LEFT: { icon: 'mdi-arrow-left-thin' },
281+
DOWN: { icon: 'mdi-arrow-down-thin' },
282+
RIGHT: { icon: 'mdi-arrow-right-thin' },
261283
GRV: { label: '`' },
284+
PLUS: { label: '+' },
285+
AT: { label: '@' },
286+
UNDERSCORE: { label: '_' },
287+
CIRCUMFLEX: { label: '^' },
288+
ASTERISK: { label: '*' },
289+
262290

263291
// Layer
264292
MO: { label: 'MO' },
293+
MT: { label: 'MT' },
294+
LT: {
295+
label: 'LT'
296+
},
265297

266298
// Media
267299
MPLY: { label: 'Play/Pause', icon: 'mdi-play-pause' },
@@ -299,21 +331,28 @@ export const renderLabel = (keycode: string) => {
299331
const keyMatch = keycode.match(/KC\.(\w+)/)
300332
if (keyMatch) {
301333
const key = keyMatch[1]
302-
if (!keyLabels[key]) {
334+
const foundKey = keyLabels[key]
335+
if (!foundKey) {
303336
label += keycode
304-
} else if (keyLabels[key].icon) {
305-
label += `<i class="mdi ${keyLabels[key].icon}"></i>`
306-
} else if (keyLabels[key].label) {
307-
label += keyLabels[key].label
337+
} else if (foundKey.icon) {
338+
label += `<i class="mdi ${foundKey.icon}"></i>`
339+
} else if (foundKey.label) {
340+
label += foundKey.label
308341
}
309342
// if it has arguments render them as keycode as well
310343
if (keycode.includes('(')) {
311344
const match = keycode.match(/^[^(]+\((.*)\)$/)
312345
console.log('found params', match) // prints ["0", "KC.A"]
346+
// dont render options for some keys eg. MT
347+
313348
if (match && match[1] && match[1].includes(',')) {
314349
const params = match[1].split(',').map((a) => renderLabel(a))
315350
console.log('param list', params)
316-
label += ` ${params.join(' ')}`
351+
let maxParams = 10
352+
if(['LT', 'MT'].includes(key)){
353+
maxParams =2
354+
}
355+
label += ` ${params.slice(0,maxParams).join(' ')}`
317356
} else if (match) {
318357
// just add that key to label
319358
label += ` ${renderLabel(match[1])}`

src/renderer/src/router/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import MatrixSetup from '../components/MatrixSetup.vue'
1111
import PinSetup from '../components/PinSetup.vue'
1212
import RawKeymapEditor from '../components/RawKeymapEditor.vue'
1313
import KeyboardName from '../components/KeyboardName.vue'
14-
import CoordMap from "../components/CoordMap.vue";
14+
import CoordMap from '../components/CoordMap.vue'
15+
import Community from "../components/Community.vue";
1516

1617
const router = createRouter({
1718
history: createWebHashHistory(),
@@ -84,6 +85,11 @@ const router = createRouter({
8485
path: 'coordmap',
8586
component: CoordMap,
8687
name: 'CoordMap'
88+
},
89+
{
90+
path: 'community',
91+
component: Community,
92+
name: 'Community'
8793
}
8894
]
8995
}

src/renderer/src/screens/KeyboardConfigurator.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<li><router-link to="/configurator/coordmap">CoordMap</router-link></li>
2323
<li><router-link to="/configurator/raw-keymap">Raw Keymap</router-link></li>
2424
<li><router-link to="/configurator/firmware">Firmware</router-link></li>
25+
<!-- <li><router-link to="/configurator/community">Community</router-link></li>-->
2526
</ul>
2627
<div class="h-screen flex-1 overflow-x-auto px-4 pt-8">
2728
<h1 class="mb-8 text-center text-5xl font-bold" contenteditable="true">
@@ -57,10 +58,17 @@
5758
<script lang="ts" setup>
5859
import Popper from '@wlard/vue3-popper'
5960
import { addToHistory, keyboardStore } from '../store'
60-
import { useRoute, useRouter } from 'vue-router'
61+
import { useRoute, useRouter} from 'vue-router'
6162
import { computed } from 'vue'
6263
const router = useRouter()
6364
const route = useRoute()
65+
66+
// nav guard
67+
console.log('path is',keyboardStore.path)
68+
if(!keyboardStore.path){
69+
router.push('/')
70+
}
71+
6472
const reselectKeyboard = () => {
6573
router.push('/')
6674
}
@@ -86,6 +94,7 @@ const flashingMode = computed({
8694
keyboardStore.flashingMode = newVal ? 'automatic' : 'manual'
8795
}
8896
})
97+
8998
</script>
9099

91100
<style lang="scss" scoped>

0 commit comments

Comments
 (0)