diff --git a/.gitignore b/.gitignore index 42bd71b..ea96cb9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ dist out .DS_Store *.log* +electron.vite.config.1716830836044.mjs diff --git a/resources/config.yaml b/resources/config.yaml new file mode 100644 index 0000000..b27b8f9 --- /dev/null +++ b/resources/config.yaml @@ -0,0 +1,19 @@ +slider_mapping: + 0: master + 1: chrome.exe + 2: spotify.exe + 3: + - pathofexile_x64.exe + - rocketleague.exe + 4: discord.exe + +# set this to true if you want the controls inverted (i.e. top is 0%, bottom is 100%) +invert_sliders: false + +# settings for connecting to the arduino board +com_port: COM4 +baud_rate: 9600 + +# adjust the amount of signal noise reduction depending on your hardware quality +# supported values are "low" (excellent hardware), "default" (regular hardware) or "high" (bad, noisy hardware) +noise_reduction: default \ No newline at end of file diff --git a/src/main/index.js b/src/main/index.js index da9e3d0..304b3bc 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -2,6 +2,20 @@ import { app, shell, BrowserWindow, ipcMain } from 'electron' import { join } from 'path' import { electronApp, optimizer, is } from '@electron-toolkit/utils' import icon from '../../resources/icon.png?asset' +import fs from 'node:fs/promises' + + +async function loadConfigurationYAML() { + try { + const data = await fs.readFile('./resources//config.yaml', { encoding: 'utf8' }); + console.log(data); + return data + } catch (err) { + console.log(err); + return (`There was an error reading the file:
${err} `) + } + +} function createWindow() { // Create the browser window. @@ -51,6 +65,7 @@ app.whenReady().then(() => { // IPC test ipcMain.on('ping', () => console.log('pong')) + ipcMain.handle("loadConfigurationYML", loadConfigurationYAML) createWindow() diff --git a/src/renderer/src/App.vue b/src/renderer/src/App.vue index 7fa454c..3bc8b62 100644 --- a/src/renderer/src/App.vue +++ b/src/renderer/src/App.vue @@ -6,8 +6,13 @@ import { ref } from 'vue' const movies = ref([]) const apiKey = 'a0eb411ca9c81896004dce1d27a7245b' +const configuration = ref('Loading....') const ipcHandle = () => window.electron.ipcRenderer.send('ping') +const getConfigFileContents = async () => { + const returnValue = await window.electron.ipcRenderer.invoke('loadConfigurationYML') + configuration.value = returnValue +} const getTrendingMovies = (category) => { return fetch(`https://api.themoviedb.org/3/trending/movie/${category}?api_key=${apiKey}`) @@ -15,7 +20,6 @@ const getTrendingMovies = (category) => { .then((data) => { movies.value = data.results }) - // .then(() => console.log(movies.value)) } onMounted(() => { @@ -26,21 +30,11 @@ onMounted(() => {