From 47df750b482f41d403736f8bc5dcd1384526fe2d Mon Sep 17 00:00:00 2001 From: mishamyrt Date: Fri, 5 Jan 2024 01:24:41 +0300 Subject: [PATCH] refactor: migrate to `nuga-lib` HID keyboard logic is placed in a separate repository --- .github/workflows/build.yaml | 8 +- .github/workflows/linux-builder.yaml | 4 +- .github/workflows/quality-assurance.yaml | 36 ++-- .gitignore | 8 +- .vscode/settings.json | 5 + Makefile | 8 +- README.md | 5 - app/memtest.go | 21 --- app/variables.go | 7 - {app/build => build}/README.md | 0 {app/build => build}/appicon.png | Bin {app/build => build}/darwin/Info.dev.plist | 0 {app/build => build}/darwin/Info.plist | 0 .../share/applications/co.myrt.nuga.desktop | 0 .../AppDir/usr/share/icons/256x256/nuga.png | Bin .../linux/AppImageBuilder.yaml | 0 .../build => build}/linux/appimage.Dockerfile | 0 {app/build => build}/linux/build-nuga.sh | 0 {app/build => build}/linux/pack-appimage.sh | 2 +- {app/build => build}/linux/wails.Dockerfile | 0 {app/build => build}/windows/icon.ico | Bin {app/build => build}/windows/info.json | 0 .../windows/installer/project.nsi | 0 .../windows/installer/wails_tools.nsh | 0 .../windows/wails.exe.manifest | 0 {app/config => config}/config.go | 0 first.txt | 1 - {app/frontend => frontend}/.babelrc | 0 {app/frontend => frontend}/.eslintrc.cjs | 0 {app/frontend => frontend}/.stylelintrc.cjs | 0 {app/frontend => frontend}/README.md | 0 {app/frontend => frontend}/index.html | 0 {app/frontend => frontend}/package.json | 0 {app/frontend => frontend}/package.json.md5 | 0 {app/frontend => frontend}/pnpm-lock.yaml | 0 {app/frontend => frontend}/src/app/App.svelte | 0 .../src/app/ui/Content.svelte | 0 .../src/app/ui/Sidebar.svelte | 0 .../src/app/ui/Toolbar.svelte | 0 .../src/assets/images/Arrows@2x.png | Bin .../src/assets/images/keyboard-75.svg | 0 .../src/assets/images/select-arrows-light.png | Bin .../src/assets/images/select-arrows.png | Bin .../src/entities/app/api/app.ts | 0 .../src/entities/app/api/browser.ts | 0 .../src/entities/app/api/settings.ts | 0 .../src/entities/app/api/version.ts | 0 .../src/entities/app/index.ts | 0 .../src/entities/app/model/constants.ts | 0 .../src/entities/app/model/index.ts | 0 .../src/entities/app/model/store.ts | 0 .../src/entities/app/model/types.ts | 0 .../app/ui/AppConnectionDialog.svelte | 0 .../src/entities/app/ui/AppLogo.svelte | 0 .../src/entities/app/ui/AppSidebarMenu.svelte | 0 .../entities/app/ui/icons/AppIconBulb.svelte | 0 .../entities/app/ui/icons/AppIconCable.svelte | 0 .../app/ui/icons/AppIconDisplay.svelte | 0 .../entities/app/ui/icons/AppIconGear.svelte | 0 .../app/ui/icons/AppIconKeyboard.svelte | 0 .../src/entities/app/ui/icons/index.ts | 0 .../src/entities/app/ui/index.ts | 0 .../src/entities/device/api/firmware.ts | 0 .../src/entities/device/api/index.ts | 0 .../src/entities/device/api/settings.ts | 0 .../src/entities/device/index.ts | 0 .../src/entities/device/model/constants.ts | 0 .../src/entities/device/model/index.ts | 0 .../entities/device/model/stores/firmware.ts | 0 .../entities/device/model/stores/settings.ts | 0 .../src/entities/device/model/types.ts | 0 .../entities/device/ui/DeviceInfoGroup.svelte | 0 .../src/entities/keys/index.ts | 0 .../src/entities/keys/model/const.ts | 0 .../src/entities/keys/model/layouts/halo65.ts | 0 .../src/entities/keys/model/layouts/halo75.ts | 0 .../src/entities/keys/model/layouts/halo96.ts | 0 .../src/entities/keys/model/layouts/index.ts | 0 .../src/entities/keys/model/store.ts | 0 .../src/entities/keys/model/types.ts | 0 .../src/entities/keys/model/utils.ts | 0 .../src/entities/keys/ui/KeyboardKeys.svelte | 0 .../src/entities/lights/api/color.ts | 0 .../src/entities/lights/api/mode.ts | 0 .../src/entities/lights/api/preset.ts | 0 .../src/entities/lights/api/state.ts | 0 .../src/entities/lights/index.ts | 0 .../src/entities/lights/model/const.ts | 0 .../src/entities/lights/model/index.ts | 0 .../src/entities/lights/model/store.ts | 0 .../src/entities/lights/model/types.ts | 0 .../src/entities/lights/model/utils.ts | 0 .../lights/ui/LightSettingsGroup.svelte | 0 .../src/entities/lights/utils/hex.ts | 0 .../src/entities/lights/utils/index.ts | 0 .../src/entities/lights/utils/parse.ts | 0 .../src/features/app/app-updates/index.ts | 0 .../features/app/app-updates/model/store.ts | 0 .../features/app/app-updates/model/utils.ts | 0 .../app/app-updates/ui/AppUpdates.svelte | 0 .../src/features/app/change-settings/index.ts | 0 .../ui/AppDarkThemeToggle.svelte | 0 .../ui/AppUISwitchSegment.svelte | 0 .../src/features/app/index.ts | 0 .../src/features/app/logging-switch/index.ts | 0 .../app/logging-switch/model/store.ts | 0 .../app/logging-switch/model/utils.ts | 0 .../logging-switch/ui/LoggingSwitch.svelte | 0 .../src/features/app/restart/index.ts | 0 .../app/restart/ui/RestartButton.svelte | 0 .../src/features/device/change-mode/index.ts | 0 .../ui/IndividualModeToggle.svelte | 0 .../device/change-mode/ui/OSModeSelect.svelte | 0 .../src/features/device/index.ts | 0 .../src/features/lights/edit-color/index.ts | 0 .../features/lights/edit-color/model/store.ts | 0 .../edit-color/ui/LightsColorEditor.svelte | 0 .../src/features/lights/index.ts | 0 .../features/lights/keyboard-preview/index.ts | 0 .../lights/keyboard-preview/model/const.ts | 0 .../lights/keyboard-preview/model/index.ts | 0 .../lights/keyboard-preview/model/store.ts | 0 .../keyboard-preview/model/utils/colors.ts | 0 .../keyboard-preview/model/utils/contrast.ts | 0 .../keyboard-preview/model/utils/matrix.ts | 0 .../keyboard-preview/ui/KeyboardLights.svelte | 0 .../src/features/lights/preset/index.ts | 0 .../lights/preset/ui/LoadPresetButton.svelte | 0 .../lights/preset/ui/SavePresetButton.svelte | 0 .../lights/select-brightness/index.ts | 0 .../lights/select-brightness/model/store.ts | 0 .../lights/select-brightness/model/types.ts | 0 .../ui/LightsBrightnessSlider.svelte | 0 .../src/features/lights/select-color/index.ts | 0 .../lights/select-color/model/store.ts | 0 .../lights/select-color/model/types.ts | 0 .../ui/LightsColorSelector.svelte | 0 .../src/features/lights/select-mode/index.ts | 0 .../lights/select-mode/model/store.ts | 0 .../lights/select-mode/model/types.ts | 0 .../select-mode/ui/LightsModeSelect.svelte | 0 .../src/features/lights/select-speed/index.ts | 0 .../lights/select-speed/model/store.ts | 0 .../lights/select-speed/model/types.ts | 0 .../select-speed/ui/LightsSpeedSlider.svelte | 0 .../src/features/lights/switch-power/index.ts | 0 .../lights/switch-power/model/store.ts | 0 .../lights/switch-power/model/types.ts | 0 .../switch-power/ui/LightsPowerToggle.svelte | 0 {app/frontend => frontend}/src/main.ts | 0 .../src/pages/device/DevicePage.svelte | 0 .../src/pages/device/index.ts | 0 {app/frontend => frontend}/src/pages/index.ts | 0 .../src/pages/keys/KeysPage.svelte | 0 .../src/pages/keys/index.ts | 0 .../src/pages/lights/LightsPage.svelte | 0 .../src/pages/lights/LightsToolbar.svelte | 0 .../src/pages/lights/index.ts | 0 .../src/shared/api/connection.ts | 0 .../src/shared/api/index.ts | 0 .../src/shared/lib/from-wails-event.ts | 0 .../src/shared/lib/index.ts | 0 .../src/shared/lib/sequential-effect.ts | 0 .../src/shared/lib/strings.ts | 0 .../src/shared/model/constants.ts | 0 .../src/shared/model/index.ts | 0 .../src/shared/model/store-connection.ts | 0 .../src/shared/model/store-navigation.ts | 0 .../src/shared/model/types.ts | 0 {app/frontend => frontend}/src/style.css | 0 {app/frontend => frontend}/src/vite-env.d.ts | 0 .../src/widgets/app/index.ts | 0 .../src/widgets/app/ui/AppDebugModal.svelte | 0 .../src/widgets/device/index.ts | 0 .../widgets/device/ui/DeviceConnection.svelte | 0 .../src/widgets/device/ui/DeviceInfo.svelte | 0 .../widgets/device/ui/DeviceSettings.svelte | 0 .../src/widgets/lights/index.ts | 0 .../lights/ui/LightsDomainSettings.svelte | 0 .../src/widgets/lights/ui/LightsPreset.svelte | 0 {app/frontend => frontend}/svelte.config.js | 0 {app/frontend => frontend}/tsconfig.json | 0 {app/frontend => frontend}/tsconfig.node.json | 0 {app/frontend => frontend}/vite.config.ts | 0 app/go.mod => go.mod | 7 +- app/go.sum => go.sum | 22 +-- go.work | 8 - go.work.sum | 70 -------- .../application/application.go | 0 .../application/options.go | 0 {app/internal => internal}/dto/environment.go | 0 {app/internal => internal}/dto/files.go | 0 {app/internal => internal}/dto/lights.go | 8 +- {app/internal => internal}/dto/preset.go | 2 +- {app/internal => internal}/entity/config.go | 0 {app/internal => internal}/errors/errors.go | 0 .../interfaces/repository.go | 8 +- .../interfaces/usecase.go | 5 +- .../repository/device/device.go | 13 +- .../repository/environment/environment.go | 0 .../repository/preset/preset.go | 0 .../repository/repository.go | 0 .../repository/settings/file.go | 0 .../repository/settings/path.go | 0 .../repository/settings/settings.go | 0 {app/internal => internal}/usecase/device.go | 11 +- .../usecase/environment.go | 0 {app/internal => internal}/usecase/lights.go | 70 ++++---- .../internal => internal}/usecase/settings.go | 0 {app/internal => internal}/usecase/usecase.go | 0 lib/README.md | 11 -- lib/docs/protocol.md | 88 ---------- lib/examples/describe/main.go | 46 ----- lib/go.mod | 9 - lib/pkg/bit/mask.go | 30 ---- lib/pkg/color/errors.go | 7 - lib/pkg/color/parse.go | 25 --- lib/pkg/color/presets.go | 18 -- lib/pkg/color/rgb.go | 6 - lib/pkg/device/device.go | 71 -------- lib/pkg/device/errors.go | 9 - lib/pkg/device/simulation.go | 14 -- lib/pkg/device/supported.go | 56 ------ lib/pkg/hid/constants.go | 8 - lib/pkg/hid/errors.go | 17 -- lib/pkg/hid/handle.go | 160 ------------------ lib/pkg/hid/lifecycle.go | 19 --- lib/pkg/hid/types.go | 8 - lib/pkg/hid/version.go | 15 -- lib/pkg/light/colors.go | 111 ------------ lib/pkg/light/constants.go | 53 ------ lib/pkg/light/controller-k916.go | 136 --------------- lib/pkg/light/controller-simulation.go | 72 -------- lib/pkg/light/controller.go | 9 - lib/pkg/light/effect-backlight.go | 60 ------- lib/pkg/light/effect-misc.go | 49 ------ lib/pkg/light/effect/backlight.go | 141 --------------- lib/pkg/light/effect/domain.go | 17 -- lib/pkg/light/effect/feature.go | 14 -- lib/pkg/light/effect/halolight.go | 46 ----- lib/pkg/light/effect/mode.go | 10 -- lib/pkg/light/effect/sidelight.go | 53 ------ lib/pkg/light/errors.go | 12 -- lib/pkg/light/params.go | 79 --------- app/main.go => main.go | 6 + app/Makefile => makefiles/appdir.mk | 0 makefiles/build.mk | 6 +- makefiles/dev.mk | 11 -- makefiles/linux-builder.mk | 10 +- makefiles/qa.mk | 25 ++- {app/pkg => pkg}/github/api.go | 0 {app/pkg => pkg}/github/repo.go | 0 resources/simulations/halo65.json | 1 - resources/simulations/halo75.json | 1 - resources/simulations/halo96.json | 1 - utils/k916-dumper/main.go | 71 -------- app/wails.json => wails.json | 0 257 files changed, 126 insertions(+), 1814 deletions(-) create mode 100644 .vscode/settings.json delete mode 100644 app/memtest.go delete mode 100644 app/variables.go rename {app/build => build}/README.md (100%) rename {app/build => build}/appicon.png (100%) rename {app/build => build}/darwin/Info.dev.plist (100%) rename {app/build => build}/darwin/Info.plist (100%) rename {app/build => build}/linux/AppDir/usr/share/applications/co.myrt.nuga.desktop (100%) rename {app/build => build}/linux/AppDir/usr/share/icons/256x256/nuga.png (100%) rename {app/build => build}/linux/AppImageBuilder.yaml (100%) rename {app/build => build}/linux/appimage.Dockerfile (100%) rename {app/build => build}/linux/build-nuga.sh (100%) rename {app/build => build}/linux/pack-appimage.sh (81%) rename {app/build => build}/linux/wails.Dockerfile (100%) rename {app/build => build}/windows/icon.ico (100%) rename {app/build => build}/windows/info.json (100%) rename {app/build => build}/windows/installer/project.nsi (100%) rename {app/build => build}/windows/installer/wails_tools.nsh (100%) rename {app/build => build}/windows/wails.exe.manifest (100%) rename {app/config => config}/config.go (100%) delete mode 100644 first.txt rename {app/frontend => frontend}/.babelrc (100%) rename {app/frontend => frontend}/.eslintrc.cjs (100%) rename {app/frontend => frontend}/.stylelintrc.cjs (100%) rename {app/frontend => frontend}/README.md (100%) rename {app/frontend => frontend}/index.html (100%) rename {app/frontend => frontend}/package.json (100%) rename {app/frontend => frontend}/package.json.md5 (100%) rename {app/frontend => frontend}/pnpm-lock.yaml (100%) rename {app/frontend => frontend}/src/app/App.svelte (100%) rename {app/frontend => frontend}/src/app/ui/Content.svelte (100%) rename {app/frontend => frontend}/src/app/ui/Sidebar.svelte (100%) rename {app/frontend => frontend}/src/app/ui/Toolbar.svelte (100%) rename {app/frontend => frontend}/src/assets/images/Arrows@2x.png (100%) rename {app/frontend => frontend}/src/assets/images/keyboard-75.svg (100%) rename {app/frontend => frontend}/src/assets/images/select-arrows-light.png (100%) rename {app/frontend => frontend}/src/assets/images/select-arrows.png (100%) rename {app/frontend => frontend}/src/entities/app/api/app.ts (100%) rename {app/frontend => frontend}/src/entities/app/api/browser.ts (100%) rename {app/frontend => frontend}/src/entities/app/api/settings.ts (100%) rename {app/frontend => frontend}/src/entities/app/api/version.ts (100%) rename {app/frontend => frontend}/src/entities/app/index.ts (100%) rename {app/frontend => frontend}/src/entities/app/model/constants.ts (100%) rename {app/frontend => frontend}/src/entities/app/model/index.ts (100%) rename {app/frontend => frontend}/src/entities/app/model/store.ts (100%) rename {app/frontend => frontend}/src/entities/app/model/types.ts (100%) rename {app/frontend => frontend}/src/entities/app/ui/AppConnectionDialog.svelte (100%) rename {app/frontend => frontend}/src/entities/app/ui/AppLogo.svelte (100%) rename {app/frontend => frontend}/src/entities/app/ui/AppSidebarMenu.svelte (100%) rename {app/frontend => frontend}/src/entities/app/ui/icons/AppIconBulb.svelte (100%) rename {app/frontend => frontend}/src/entities/app/ui/icons/AppIconCable.svelte (100%) rename {app/frontend => frontend}/src/entities/app/ui/icons/AppIconDisplay.svelte (100%) rename {app/frontend => frontend}/src/entities/app/ui/icons/AppIconGear.svelte (100%) rename {app/frontend => frontend}/src/entities/app/ui/icons/AppIconKeyboard.svelte (100%) rename {app/frontend => frontend}/src/entities/app/ui/icons/index.ts (100%) rename {app/frontend => frontend}/src/entities/app/ui/index.ts (100%) rename {app/frontend => frontend}/src/entities/device/api/firmware.ts (100%) rename {app/frontend => frontend}/src/entities/device/api/index.ts (100%) rename {app/frontend => frontend}/src/entities/device/api/settings.ts (100%) rename {app/frontend => frontend}/src/entities/device/index.ts (100%) rename {app/frontend => frontend}/src/entities/device/model/constants.ts (100%) rename {app/frontend => frontend}/src/entities/device/model/index.ts (100%) rename {app/frontend => frontend}/src/entities/device/model/stores/firmware.ts (100%) rename {app/frontend => frontend}/src/entities/device/model/stores/settings.ts (100%) rename {app/frontend => frontend}/src/entities/device/model/types.ts (100%) rename {app/frontend => frontend}/src/entities/device/ui/DeviceInfoGroup.svelte (100%) rename {app/frontend => frontend}/src/entities/keys/index.ts (100%) rename {app/frontend => frontend}/src/entities/keys/model/const.ts (100%) rename {app/frontend => frontend}/src/entities/keys/model/layouts/halo65.ts (100%) rename {app/frontend => frontend}/src/entities/keys/model/layouts/halo75.ts (100%) rename {app/frontend => frontend}/src/entities/keys/model/layouts/halo96.ts (100%) rename {app/frontend => frontend}/src/entities/keys/model/layouts/index.ts (100%) rename {app/frontend => frontend}/src/entities/keys/model/store.ts (100%) rename {app/frontend => frontend}/src/entities/keys/model/types.ts (100%) rename {app/frontend => frontend}/src/entities/keys/model/utils.ts (100%) rename {app/frontend => frontend}/src/entities/keys/ui/KeyboardKeys.svelte (100%) rename {app/frontend => frontend}/src/entities/lights/api/color.ts (100%) rename {app/frontend => frontend}/src/entities/lights/api/mode.ts (100%) rename {app/frontend => frontend}/src/entities/lights/api/preset.ts (100%) rename {app/frontend => frontend}/src/entities/lights/api/state.ts (100%) rename {app/frontend => frontend}/src/entities/lights/index.ts (100%) rename {app/frontend => frontend}/src/entities/lights/model/const.ts (100%) rename {app/frontend => frontend}/src/entities/lights/model/index.ts (100%) rename {app/frontend => frontend}/src/entities/lights/model/store.ts (100%) rename {app/frontend => frontend}/src/entities/lights/model/types.ts (100%) rename {app/frontend => frontend}/src/entities/lights/model/utils.ts (100%) rename {app/frontend => frontend}/src/entities/lights/ui/LightSettingsGroup.svelte (100%) rename {app/frontend => frontend}/src/entities/lights/utils/hex.ts (100%) rename {app/frontend => frontend}/src/entities/lights/utils/index.ts (100%) rename {app/frontend => frontend}/src/entities/lights/utils/parse.ts (100%) rename {app/frontend => frontend}/src/features/app/app-updates/index.ts (100%) rename {app/frontend => frontend}/src/features/app/app-updates/model/store.ts (100%) rename {app/frontend => frontend}/src/features/app/app-updates/model/utils.ts (100%) rename {app/frontend => frontend}/src/features/app/app-updates/ui/AppUpdates.svelte (100%) rename {app/frontend => frontend}/src/features/app/change-settings/index.ts (100%) rename {app/frontend => frontend}/src/features/app/change-settings/ui/AppDarkThemeToggle.svelte (100%) rename {app/frontend => frontend}/src/features/app/change-settings/ui/AppUISwitchSegment.svelte (100%) rename {app/frontend => frontend}/src/features/app/index.ts (100%) rename {app/frontend => frontend}/src/features/app/logging-switch/index.ts (100%) rename {app/frontend => frontend}/src/features/app/logging-switch/model/store.ts (100%) rename {app/frontend => frontend}/src/features/app/logging-switch/model/utils.ts (100%) rename {app/frontend => frontend}/src/features/app/logging-switch/ui/LoggingSwitch.svelte (100%) rename {app/frontend => frontend}/src/features/app/restart/index.ts (100%) rename {app/frontend => frontend}/src/features/app/restart/ui/RestartButton.svelte (100%) rename {app/frontend => frontend}/src/features/device/change-mode/index.ts (100%) rename {app/frontend => frontend}/src/features/device/change-mode/ui/IndividualModeToggle.svelte (100%) rename {app/frontend => frontend}/src/features/device/change-mode/ui/OSModeSelect.svelte (100%) rename {app/frontend => frontend}/src/features/device/index.ts (100%) rename {app/frontend => frontend}/src/features/lights/edit-color/index.ts (100%) rename {app/frontend => frontend}/src/features/lights/edit-color/model/store.ts (100%) rename {app/frontend => frontend}/src/features/lights/edit-color/ui/LightsColorEditor.svelte (100%) rename {app/frontend => frontend}/src/features/lights/index.ts (100%) rename {app/frontend => frontend}/src/features/lights/keyboard-preview/index.ts (100%) rename {app/frontend => frontend}/src/features/lights/keyboard-preview/model/const.ts (100%) rename {app/frontend => frontend}/src/features/lights/keyboard-preview/model/index.ts (100%) rename {app/frontend => frontend}/src/features/lights/keyboard-preview/model/store.ts (100%) rename {app/frontend => frontend}/src/features/lights/keyboard-preview/model/utils/colors.ts (100%) rename {app/frontend => frontend}/src/features/lights/keyboard-preview/model/utils/contrast.ts (100%) rename {app/frontend => frontend}/src/features/lights/keyboard-preview/model/utils/matrix.ts (100%) rename {app/frontend => frontend}/src/features/lights/keyboard-preview/ui/KeyboardLights.svelte (100%) rename {app/frontend => frontend}/src/features/lights/preset/index.ts (100%) rename {app/frontend => frontend}/src/features/lights/preset/ui/LoadPresetButton.svelte (100%) rename {app/frontend => frontend}/src/features/lights/preset/ui/SavePresetButton.svelte (100%) rename {app/frontend => frontend}/src/features/lights/select-brightness/index.ts (100%) rename {app/frontend => frontend}/src/features/lights/select-brightness/model/store.ts (100%) rename {app/frontend => frontend}/src/features/lights/select-brightness/model/types.ts (100%) rename {app/frontend => frontend}/src/features/lights/select-brightness/ui/LightsBrightnessSlider.svelte (100%) rename {app/frontend => frontend}/src/features/lights/select-color/index.ts (100%) rename {app/frontend => frontend}/src/features/lights/select-color/model/store.ts (100%) rename {app/frontend => frontend}/src/features/lights/select-color/model/types.ts (100%) rename {app/frontend => frontend}/src/features/lights/select-color/ui/LightsColorSelector.svelte (100%) rename {app/frontend => frontend}/src/features/lights/select-mode/index.ts (100%) rename {app/frontend => frontend}/src/features/lights/select-mode/model/store.ts (100%) rename {app/frontend => frontend}/src/features/lights/select-mode/model/types.ts (100%) rename {app/frontend => frontend}/src/features/lights/select-mode/ui/LightsModeSelect.svelte (100%) rename {app/frontend => frontend}/src/features/lights/select-speed/index.ts (100%) rename {app/frontend => frontend}/src/features/lights/select-speed/model/store.ts (100%) rename {app/frontend => frontend}/src/features/lights/select-speed/model/types.ts (100%) rename {app/frontend => frontend}/src/features/lights/select-speed/ui/LightsSpeedSlider.svelte (100%) rename {app/frontend => frontend}/src/features/lights/switch-power/index.ts (100%) rename {app/frontend => frontend}/src/features/lights/switch-power/model/store.ts (100%) rename {app/frontend => frontend}/src/features/lights/switch-power/model/types.ts (100%) rename {app/frontend => frontend}/src/features/lights/switch-power/ui/LightsPowerToggle.svelte (100%) rename {app/frontend => frontend}/src/main.ts (100%) rename {app/frontend => frontend}/src/pages/device/DevicePage.svelte (100%) rename {app/frontend => frontend}/src/pages/device/index.ts (100%) rename {app/frontend => frontend}/src/pages/index.ts (100%) rename {app/frontend => frontend}/src/pages/keys/KeysPage.svelte (100%) rename {app/frontend => frontend}/src/pages/keys/index.ts (100%) rename {app/frontend => frontend}/src/pages/lights/LightsPage.svelte (100%) rename {app/frontend => frontend}/src/pages/lights/LightsToolbar.svelte (100%) rename {app/frontend => frontend}/src/pages/lights/index.ts (100%) rename {app/frontend => frontend}/src/shared/api/connection.ts (100%) rename {app/frontend => frontend}/src/shared/api/index.ts (100%) rename {app/frontend => frontend}/src/shared/lib/from-wails-event.ts (100%) rename {app/frontend => frontend}/src/shared/lib/index.ts (100%) rename {app/frontend => frontend}/src/shared/lib/sequential-effect.ts (100%) rename {app/frontend => frontend}/src/shared/lib/strings.ts (100%) rename {app/frontend => frontend}/src/shared/model/constants.ts (100%) rename {app/frontend => frontend}/src/shared/model/index.ts (100%) rename {app/frontend => frontend}/src/shared/model/store-connection.ts (100%) rename {app/frontend => frontend}/src/shared/model/store-navigation.ts (100%) rename {app/frontend => frontend}/src/shared/model/types.ts (100%) rename {app/frontend => frontend}/src/style.css (100%) rename {app/frontend => frontend}/src/vite-env.d.ts (100%) rename {app/frontend => frontend}/src/widgets/app/index.ts (100%) rename {app/frontend => frontend}/src/widgets/app/ui/AppDebugModal.svelte (100%) rename {app/frontend => frontend}/src/widgets/device/index.ts (100%) rename {app/frontend => frontend}/src/widgets/device/ui/DeviceConnection.svelte (100%) rename {app/frontend => frontend}/src/widgets/device/ui/DeviceInfo.svelte (100%) rename {app/frontend => frontend}/src/widgets/device/ui/DeviceSettings.svelte (100%) rename {app/frontend => frontend}/src/widgets/lights/index.ts (100%) rename {app/frontend => frontend}/src/widgets/lights/ui/LightsDomainSettings.svelte (100%) rename {app/frontend => frontend}/src/widgets/lights/ui/LightsPreset.svelte (100%) rename {app/frontend => frontend}/svelte.config.js (100%) rename {app/frontend => frontend}/tsconfig.json (100%) rename {app/frontend => frontend}/tsconfig.node.json (100%) rename {app/frontend => frontend}/vite.config.ts (100%) rename app/go.mod => go.mod (89%) rename app/go.sum => go.sum (86%) delete mode 100644 go.work delete mode 100644 go.work.sum rename {app/internal => internal}/application/application.go (100%) rename {app/internal => internal}/application/options.go (100%) rename {app/internal => internal}/dto/environment.go (100%) rename {app/internal => internal}/dto/files.go (100%) rename {app/internal => internal}/dto/lights.go (85%) rename {app/internal => internal}/dto/preset.go (86%) rename {app/internal => internal}/entity/config.go (100%) rename {app/internal => internal}/errors/errors.go (100%) rename {app/internal => internal}/interfaces/repository.go (91%) rename {app/internal => internal}/interfaces/usecase.go (94%) rename {app/internal => internal}/repository/device/device.go (77%) rename {app/internal => internal}/repository/environment/environment.go (100%) rename {app/internal => internal}/repository/preset/preset.go (100%) rename {app/internal => internal}/repository/repository.go (100%) rename {app/internal => internal}/repository/settings/file.go (100%) rename {app/internal => internal}/repository/settings/path.go (100%) rename {app/internal => internal}/repository/settings/settings.go (100%) rename {app/internal => internal}/usecase/device.go (92%) rename {app/internal => internal}/usecase/environment.go (100%) rename {app/internal => internal}/usecase/lights.go (70%) rename {app/internal => internal}/usecase/settings.go (100%) rename {app/internal => internal}/usecase/usecase.go (100%) delete mode 100644 lib/README.md delete mode 100644 lib/docs/protocol.md delete mode 100644 lib/examples/describe/main.go delete mode 100644 lib/go.mod delete mode 100644 lib/pkg/bit/mask.go delete mode 100644 lib/pkg/color/errors.go delete mode 100644 lib/pkg/color/parse.go delete mode 100644 lib/pkg/color/presets.go delete mode 100644 lib/pkg/color/rgb.go delete mode 100644 lib/pkg/device/device.go delete mode 100644 lib/pkg/device/errors.go delete mode 100644 lib/pkg/device/simulation.go delete mode 100644 lib/pkg/device/supported.go delete mode 100644 lib/pkg/hid/constants.go delete mode 100644 lib/pkg/hid/errors.go delete mode 100644 lib/pkg/hid/handle.go delete mode 100644 lib/pkg/hid/lifecycle.go delete mode 100644 lib/pkg/hid/types.go delete mode 100644 lib/pkg/hid/version.go delete mode 100644 lib/pkg/light/colors.go delete mode 100644 lib/pkg/light/constants.go delete mode 100644 lib/pkg/light/controller-k916.go delete mode 100644 lib/pkg/light/controller-simulation.go delete mode 100644 lib/pkg/light/controller.go delete mode 100644 lib/pkg/light/effect-backlight.go delete mode 100644 lib/pkg/light/effect-misc.go delete mode 100644 lib/pkg/light/effect/backlight.go delete mode 100644 lib/pkg/light/effect/domain.go delete mode 100644 lib/pkg/light/effect/feature.go delete mode 100644 lib/pkg/light/effect/halolight.go delete mode 100644 lib/pkg/light/effect/mode.go delete mode 100644 lib/pkg/light/effect/sidelight.go delete mode 100644 lib/pkg/light/errors.go delete mode 100644 lib/pkg/light/params.go rename app/main.go => main.go (83%) rename app/Makefile => makefiles/appdir.mk (100%) rename {app/pkg => pkg}/github/api.go (100%) rename {app/pkg => pkg}/github/repo.go (100%) delete mode 100644 resources/simulations/halo65.json delete mode 100644 resources/simulations/halo75.json delete mode 100644 resources/simulations/halo96.json delete mode 100644 utils/k916-dumper/main.go rename app/wails.json => wails.json (100%) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 48377b4d..e77c3539 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -33,12 +33,12 @@ jobs: uses: actions/setup-go@v4 with: go-version: ${{ env.GO_VERSION }} - cache-dependency-path: app/go.sum + cache-dependency-path: go.sum - name: Setup pnpm uses: pnpm/action-setup@v2 with: run_install: | - cwd: app/frontend/ + cwd: frontend/ args: [--frozen-lockfile] version: ${{ env.PNPM_VERSION }} - name: Setup QEMU @@ -54,8 +54,8 @@ jobs: run: brew install hidapi - name: Setup Wails run: go install github.com/wailsapp/wails/v2/cmd/wails@v${WAILS_VERSION} - - name: Sync workspace - run: go work sync + - name: Install go deps + run: go mod tidy # Linux build - name: Build x86_64 binary if: runner.os == 'Linux' diff --git a/.github/workflows/linux-builder.yaml b/.github/workflows/linux-builder.yaml index 9e2acbba..0850fd68 100644 --- a/.github/workflows/linux-builder.yaml +++ b/.github/workflows/linux-builder.yaml @@ -7,8 +7,8 @@ on: - main paths: - '.github/workflows/linux-builder.yaml' - - 'app/build/linux/wails.Dockerfile' - - 'app/build/linux/build-nuga.sh' + - 'build/linux/wails.Dockerfile' + - 'build/linux/build-nuga.sh' jobs: arm64: diff --git a/.github/workflows/quality-assurance.yaml b/.github/workflows/quality-assurance.yaml index 1854b897..ca90901d 100644 --- a/.github/workflows/quality-assurance.yaml +++ b/.github/workflows/quality-assurance.yaml @@ -19,7 +19,7 @@ jobs: uses: actions/setup-go@v4 with: go-version: ${{ env.GO_VERSION }} - cache-dependency-path: app/go.sum + cache-dependency-path: go.sum - uses: pnpm/action-setup@v2 with: version: ${{ env.PNPM_VERSION }} @@ -27,42 +27,30 @@ jobs: run: sudo apt install libudev-dev -y - name: Install frontend deps run: | - cd app/frontend + cd frontend pnpm install --frozen-lockfile cd ../.. - name: Create dummy dist dir run: | - mkdir -p app/frontend/dist - echo "." > app/frontend/dist/.gitkeep - - name: Sync workspace - run: go work sync - - name: golangci-lint lib + mkdir -p frontend/dist + echo "." > frontend/dist/.gitkeep + - name: Install go deps + run: go mod tidy + - name: Lint with golangci-lint uses: golangci/golangci-lint-action@v3 with: - args: --config=../.golangci.yaml - working-directory: ./lib + args: --config=./.golangci.yaml skip-cache: true - - name: revive lib + - name: Lint with revive uses: docker://morphy/revive-action:v2 with: config: revive.toml - path: "./lib/..." - - name: golangci-lint app - uses: golangci/golangci-lint-action@v3 - with: - args: --config=../.golangci.yaml - working-directory: ./app - skip-cache: true - - name: revive app - uses: docker://morphy/revive-action:v2 - with: - config: revive.toml - path: "./app/..." + path: "./..." - name: Lint frontend scripts run: | - cd app/frontend + cd frontend pnpm run lint:scripts - name: Lint frontend styles run: | - cd app/frontend + cd frontend pnpm run lint:styles diff --git a/.gitignore b/.gitignore index 5627bb32..1d60313d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,9 +3,7 @@ .vscode # App -app/build/bin -app/frontend/node_modules -app/frontend/dist -app/frontend/wailsjs - +bin +node_modules dist +wailsjs diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..7168cd39 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "eslint.workingDirectories": [ + "./frontend/" + ] +} diff --git a/Makefile b/Makefile index 9d3a6701..a5789a1a 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ OS := `echo $(shell uname) | tr A-Z a-z` ARCH := $(shell arch) include makefiles/build.mk +include makefiles/appdir.mk include makefiles/install.mk include makefiles/dev.mk include makefiles/qa.mk @@ -12,18 +13,19 @@ include makefiles/linux-builder.mk .PHONY: configure configure: + make setup-qa go work sync wails doctor .PHONY: generate generate: - ./scripts/update-version.mjs app/wails.json "$(VERSION)" + ./scripts/update-version.mjs wails.json "$(VERSION)" cd app; wails generate module .PHONY: clean clean: - rm -rf app/frontend/node_modules - rm -rf app/frontend/dist + rm -rf frontend/node_modules + rm -rf frontend/dist rm -rf "$(BUILD_PATH)" rm -rf "$(DIST_PATH)" diff --git a/README.md b/README.md index ee9c42ae..03101e8a 100644 --- a/README.md +++ b/README.md @@ -21,11 +21,6 @@ Application for controlling NuPhy® keyboards. 4. The application requests permission to Input Monitoring. This is required to work with the USB HID device. Grant permission. 5. Restart the app -## Packages - -* [lib](./lib/) – Golang library. -* [app](./app/) – Graphic interface for managing the state of the keyboard. - ## Development For local development, you need to set up environments. For this purpose you will need: diff --git a/app/memtest.go b/app/memtest.go deleted file mode 100644 index 02670ea4..00000000 --- a/app/memtest.go +++ /dev/null @@ -1,21 +0,0 @@ -//go:build memtest - -package main - -import ( - "log" - "net/http" - _ "net/http/pprof" - - "github.com/pkg/profile" -) - -func init() { - profile.Start(profile.MemProfile) - go func() { - err := http.ListenAndServe(":8080", nil) - if err != nil { - log.Fatalf("Could not start server: %v", err) - } - }() -} diff --git a/app/variables.go b/app/variables.go deleted file mode 100644 index fc290b31..00000000 --- a/app/variables.go +++ /dev/null @@ -1,7 +0,0 @@ -package main - -// AppVersion represents current executable version -var AppVersion = "dev" - -// AppName represents app name -var AppName = "Nuga" diff --git a/app/build/README.md b/build/README.md similarity index 100% rename from app/build/README.md rename to build/README.md diff --git a/app/build/appicon.png b/build/appicon.png similarity index 100% rename from app/build/appicon.png rename to build/appicon.png diff --git a/app/build/darwin/Info.dev.plist b/build/darwin/Info.dev.plist similarity index 100% rename from app/build/darwin/Info.dev.plist rename to build/darwin/Info.dev.plist diff --git a/app/build/darwin/Info.plist b/build/darwin/Info.plist similarity index 100% rename from app/build/darwin/Info.plist rename to build/darwin/Info.plist diff --git a/app/build/linux/AppDir/usr/share/applications/co.myrt.nuga.desktop b/build/linux/AppDir/usr/share/applications/co.myrt.nuga.desktop similarity index 100% rename from app/build/linux/AppDir/usr/share/applications/co.myrt.nuga.desktop rename to build/linux/AppDir/usr/share/applications/co.myrt.nuga.desktop diff --git a/app/build/linux/AppDir/usr/share/icons/256x256/nuga.png b/build/linux/AppDir/usr/share/icons/256x256/nuga.png similarity index 100% rename from app/build/linux/AppDir/usr/share/icons/256x256/nuga.png rename to build/linux/AppDir/usr/share/icons/256x256/nuga.png diff --git a/app/build/linux/AppImageBuilder.yaml b/build/linux/AppImageBuilder.yaml similarity index 100% rename from app/build/linux/AppImageBuilder.yaml rename to build/linux/AppImageBuilder.yaml diff --git a/app/build/linux/appimage.Dockerfile b/build/linux/appimage.Dockerfile similarity index 100% rename from app/build/linux/appimage.Dockerfile rename to build/linux/appimage.Dockerfile diff --git a/app/build/linux/build-nuga.sh b/build/linux/build-nuga.sh similarity index 100% rename from app/build/linux/build-nuga.sh rename to build/linux/build-nuga.sh diff --git a/app/build/linux/pack-appimage.sh b/build/linux/pack-appimage.sh similarity index 81% rename from app/build/linux/pack-appimage.sh rename to build/linux/pack-appimage.sh index 42f7c188..09f04768 100755 --- a/app/build/linux/pack-appimage.sh +++ b/build/linux/pack-appimage.sh @@ -3,7 +3,7 @@ pack_arch() { cd /opt/nuga/app || exit 1 make "AppDir/$1" - cd /opt/nuga/app/build/bin/ || exit 1 + cd /opt/nuga/build/bin/ || exit 1 appimage-builder } diff --git a/app/build/linux/wails.Dockerfile b/build/linux/wails.Dockerfile similarity index 100% rename from app/build/linux/wails.Dockerfile rename to build/linux/wails.Dockerfile diff --git a/app/build/windows/icon.ico b/build/windows/icon.ico similarity index 100% rename from app/build/windows/icon.ico rename to build/windows/icon.ico diff --git a/app/build/windows/info.json b/build/windows/info.json similarity index 100% rename from app/build/windows/info.json rename to build/windows/info.json diff --git a/app/build/windows/installer/project.nsi b/build/windows/installer/project.nsi similarity index 100% rename from app/build/windows/installer/project.nsi rename to build/windows/installer/project.nsi diff --git a/app/build/windows/installer/wails_tools.nsh b/build/windows/installer/wails_tools.nsh similarity index 100% rename from app/build/windows/installer/wails_tools.nsh rename to build/windows/installer/wails_tools.nsh diff --git a/app/build/windows/wails.exe.manifest b/build/windows/wails.exe.manifest similarity index 100% rename from app/build/windows/wails.exe.manifest rename to build/windows/wails.exe.manifest diff --git a/app/config/config.go b/config/config.go similarity index 100% rename from app/config/config.go rename to config/config.go diff --git a/first.txt b/first.txt deleted file mode 100644 index 9607403f..00000000 --- a/first.txt +++ /dev/null @@ -1 +0,0 @@ -0x06, 0x09, 0xbc, 0x00, 0x40, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 diff --git a/app/frontend/.babelrc b/frontend/.babelrc similarity index 100% rename from app/frontend/.babelrc rename to frontend/.babelrc diff --git a/app/frontend/.eslintrc.cjs b/frontend/.eslintrc.cjs similarity index 100% rename from app/frontend/.eslintrc.cjs rename to frontend/.eslintrc.cjs diff --git a/app/frontend/.stylelintrc.cjs b/frontend/.stylelintrc.cjs similarity index 100% rename from app/frontend/.stylelintrc.cjs rename to frontend/.stylelintrc.cjs diff --git a/app/frontend/README.md b/frontend/README.md similarity index 100% rename from app/frontend/README.md rename to frontend/README.md diff --git a/app/frontend/index.html b/frontend/index.html similarity index 100% rename from app/frontend/index.html rename to frontend/index.html diff --git a/app/frontend/package.json b/frontend/package.json similarity index 100% rename from app/frontend/package.json rename to frontend/package.json diff --git a/app/frontend/package.json.md5 b/frontend/package.json.md5 similarity index 100% rename from app/frontend/package.json.md5 rename to frontend/package.json.md5 diff --git a/app/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml similarity index 100% rename from app/frontend/pnpm-lock.yaml rename to frontend/pnpm-lock.yaml diff --git a/app/frontend/src/app/App.svelte b/frontend/src/app/App.svelte similarity index 100% rename from app/frontend/src/app/App.svelte rename to frontend/src/app/App.svelte diff --git a/app/frontend/src/app/ui/Content.svelte b/frontend/src/app/ui/Content.svelte similarity index 100% rename from app/frontend/src/app/ui/Content.svelte rename to frontend/src/app/ui/Content.svelte diff --git a/app/frontend/src/app/ui/Sidebar.svelte b/frontend/src/app/ui/Sidebar.svelte similarity index 100% rename from app/frontend/src/app/ui/Sidebar.svelte rename to frontend/src/app/ui/Sidebar.svelte diff --git a/app/frontend/src/app/ui/Toolbar.svelte b/frontend/src/app/ui/Toolbar.svelte similarity index 100% rename from app/frontend/src/app/ui/Toolbar.svelte rename to frontend/src/app/ui/Toolbar.svelte diff --git a/app/frontend/src/assets/images/Arrows@2x.png b/frontend/src/assets/images/Arrows@2x.png similarity index 100% rename from app/frontend/src/assets/images/Arrows@2x.png rename to frontend/src/assets/images/Arrows@2x.png diff --git a/app/frontend/src/assets/images/keyboard-75.svg b/frontend/src/assets/images/keyboard-75.svg similarity index 100% rename from app/frontend/src/assets/images/keyboard-75.svg rename to frontend/src/assets/images/keyboard-75.svg diff --git a/app/frontend/src/assets/images/select-arrows-light.png b/frontend/src/assets/images/select-arrows-light.png similarity index 100% rename from app/frontend/src/assets/images/select-arrows-light.png rename to frontend/src/assets/images/select-arrows-light.png diff --git a/app/frontend/src/assets/images/select-arrows.png b/frontend/src/assets/images/select-arrows.png similarity index 100% rename from app/frontend/src/assets/images/select-arrows.png rename to frontend/src/assets/images/select-arrows.png diff --git a/app/frontend/src/entities/app/api/app.ts b/frontend/src/entities/app/api/app.ts similarity index 100% rename from app/frontend/src/entities/app/api/app.ts rename to frontend/src/entities/app/api/app.ts diff --git a/app/frontend/src/entities/app/api/browser.ts b/frontend/src/entities/app/api/browser.ts similarity index 100% rename from app/frontend/src/entities/app/api/browser.ts rename to frontend/src/entities/app/api/browser.ts diff --git a/app/frontend/src/entities/app/api/settings.ts b/frontend/src/entities/app/api/settings.ts similarity index 100% rename from app/frontend/src/entities/app/api/settings.ts rename to frontend/src/entities/app/api/settings.ts diff --git a/app/frontend/src/entities/app/api/version.ts b/frontend/src/entities/app/api/version.ts similarity index 100% rename from app/frontend/src/entities/app/api/version.ts rename to frontend/src/entities/app/api/version.ts diff --git a/app/frontend/src/entities/app/index.ts b/frontend/src/entities/app/index.ts similarity index 100% rename from app/frontend/src/entities/app/index.ts rename to frontend/src/entities/app/index.ts diff --git a/app/frontend/src/entities/app/model/constants.ts b/frontend/src/entities/app/model/constants.ts similarity index 100% rename from app/frontend/src/entities/app/model/constants.ts rename to frontend/src/entities/app/model/constants.ts diff --git a/app/frontend/src/entities/app/model/index.ts b/frontend/src/entities/app/model/index.ts similarity index 100% rename from app/frontend/src/entities/app/model/index.ts rename to frontend/src/entities/app/model/index.ts diff --git a/app/frontend/src/entities/app/model/store.ts b/frontend/src/entities/app/model/store.ts similarity index 100% rename from app/frontend/src/entities/app/model/store.ts rename to frontend/src/entities/app/model/store.ts diff --git a/app/frontend/src/entities/app/model/types.ts b/frontend/src/entities/app/model/types.ts similarity index 100% rename from app/frontend/src/entities/app/model/types.ts rename to frontend/src/entities/app/model/types.ts diff --git a/app/frontend/src/entities/app/ui/AppConnectionDialog.svelte b/frontend/src/entities/app/ui/AppConnectionDialog.svelte similarity index 100% rename from app/frontend/src/entities/app/ui/AppConnectionDialog.svelte rename to frontend/src/entities/app/ui/AppConnectionDialog.svelte diff --git a/app/frontend/src/entities/app/ui/AppLogo.svelte b/frontend/src/entities/app/ui/AppLogo.svelte similarity index 100% rename from app/frontend/src/entities/app/ui/AppLogo.svelte rename to frontend/src/entities/app/ui/AppLogo.svelte diff --git a/app/frontend/src/entities/app/ui/AppSidebarMenu.svelte b/frontend/src/entities/app/ui/AppSidebarMenu.svelte similarity index 100% rename from app/frontend/src/entities/app/ui/AppSidebarMenu.svelte rename to frontend/src/entities/app/ui/AppSidebarMenu.svelte diff --git a/app/frontend/src/entities/app/ui/icons/AppIconBulb.svelte b/frontend/src/entities/app/ui/icons/AppIconBulb.svelte similarity index 100% rename from app/frontend/src/entities/app/ui/icons/AppIconBulb.svelte rename to frontend/src/entities/app/ui/icons/AppIconBulb.svelte diff --git a/app/frontend/src/entities/app/ui/icons/AppIconCable.svelte b/frontend/src/entities/app/ui/icons/AppIconCable.svelte similarity index 100% rename from app/frontend/src/entities/app/ui/icons/AppIconCable.svelte rename to frontend/src/entities/app/ui/icons/AppIconCable.svelte diff --git a/app/frontend/src/entities/app/ui/icons/AppIconDisplay.svelte b/frontend/src/entities/app/ui/icons/AppIconDisplay.svelte similarity index 100% rename from app/frontend/src/entities/app/ui/icons/AppIconDisplay.svelte rename to frontend/src/entities/app/ui/icons/AppIconDisplay.svelte diff --git a/app/frontend/src/entities/app/ui/icons/AppIconGear.svelte b/frontend/src/entities/app/ui/icons/AppIconGear.svelte similarity index 100% rename from app/frontend/src/entities/app/ui/icons/AppIconGear.svelte rename to frontend/src/entities/app/ui/icons/AppIconGear.svelte diff --git a/app/frontend/src/entities/app/ui/icons/AppIconKeyboard.svelte b/frontend/src/entities/app/ui/icons/AppIconKeyboard.svelte similarity index 100% rename from app/frontend/src/entities/app/ui/icons/AppIconKeyboard.svelte rename to frontend/src/entities/app/ui/icons/AppIconKeyboard.svelte diff --git a/app/frontend/src/entities/app/ui/icons/index.ts b/frontend/src/entities/app/ui/icons/index.ts similarity index 100% rename from app/frontend/src/entities/app/ui/icons/index.ts rename to frontend/src/entities/app/ui/icons/index.ts diff --git a/app/frontend/src/entities/app/ui/index.ts b/frontend/src/entities/app/ui/index.ts similarity index 100% rename from app/frontend/src/entities/app/ui/index.ts rename to frontend/src/entities/app/ui/index.ts diff --git a/app/frontend/src/entities/device/api/firmware.ts b/frontend/src/entities/device/api/firmware.ts similarity index 100% rename from app/frontend/src/entities/device/api/firmware.ts rename to frontend/src/entities/device/api/firmware.ts diff --git a/app/frontend/src/entities/device/api/index.ts b/frontend/src/entities/device/api/index.ts similarity index 100% rename from app/frontend/src/entities/device/api/index.ts rename to frontend/src/entities/device/api/index.ts diff --git a/app/frontend/src/entities/device/api/settings.ts b/frontend/src/entities/device/api/settings.ts similarity index 100% rename from app/frontend/src/entities/device/api/settings.ts rename to frontend/src/entities/device/api/settings.ts diff --git a/app/frontend/src/entities/device/index.ts b/frontend/src/entities/device/index.ts similarity index 100% rename from app/frontend/src/entities/device/index.ts rename to frontend/src/entities/device/index.ts diff --git a/app/frontend/src/entities/device/model/constants.ts b/frontend/src/entities/device/model/constants.ts similarity index 100% rename from app/frontend/src/entities/device/model/constants.ts rename to frontend/src/entities/device/model/constants.ts diff --git a/app/frontend/src/entities/device/model/index.ts b/frontend/src/entities/device/model/index.ts similarity index 100% rename from app/frontend/src/entities/device/model/index.ts rename to frontend/src/entities/device/model/index.ts diff --git a/app/frontend/src/entities/device/model/stores/firmware.ts b/frontend/src/entities/device/model/stores/firmware.ts similarity index 100% rename from app/frontend/src/entities/device/model/stores/firmware.ts rename to frontend/src/entities/device/model/stores/firmware.ts diff --git a/app/frontend/src/entities/device/model/stores/settings.ts b/frontend/src/entities/device/model/stores/settings.ts similarity index 100% rename from app/frontend/src/entities/device/model/stores/settings.ts rename to frontend/src/entities/device/model/stores/settings.ts diff --git a/app/frontend/src/entities/device/model/types.ts b/frontend/src/entities/device/model/types.ts similarity index 100% rename from app/frontend/src/entities/device/model/types.ts rename to frontend/src/entities/device/model/types.ts diff --git a/app/frontend/src/entities/device/ui/DeviceInfoGroup.svelte b/frontend/src/entities/device/ui/DeviceInfoGroup.svelte similarity index 100% rename from app/frontend/src/entities/device/ui/DeviceInfoGroup.svelte rename to frontend/src/entities/device/ui/DeviceInfoGroup.svelte diff --git a/app/frontend/src/entities/keys/index.ts b/frontend/src/entities/keys/index.ts similarity index 100% rename from app/frontend/src/entities/keys/index.ts rename to frontend/src/entities/keys/index.ts diff --git a/app/frontend/src/entities/keys/model/const.ts b/frontend/src/entities/keys/model/const.ts similarity index 100% rename from app/frontend/src/entities/keys/model/const.ts rename to frontend/src/entities/keys/model/const.ts diff --git a/app/frontend/src/entities/keys/model/layouts/halo65.ts b/frontend/src/entities/keys/model/layouts/halo65.ts similarity index 100% rename from app/frontend/src/entities/keys/model/layouts/halo65.ts rename to frontend/src/entities/keys/model/layouts/halo65.ts diff --git a/app/frontend/src/entities/keys/model/layouts/halo75.ts b/frontend/src/entities/keys/model/layouts/halo75.ts similarity index 100% rename from app/frontend/src/entities/keys/model/layouts/halo75.ts rename to frontend/src/entities/keys/model/layouts/halo75.ts diff --git a/app/frontend/src/entities/keys/model/layouts/halo96.ts b/frontend/src/entities/keys/model/layouts/halo96.ts similarity index 100% rename from app/frontend/src/entities/keys/model/layouts/halo96.ts rename to frontend/src/entities/keys/model/layouts/halo96.ts diff --git a/app/frontend/src/entities/keys/model/layouts/index.ts b/frontend/src/entities/keys/model/layouts/index.ts similarity index 100% rename from app/frontend/src/entities/keys/model/layouts/index.ts rename to frontend/src/entities/keys/model/layouts/index.ts diff --git a/app/frontend/src/entities/keys/model/store.ts b/frontend/src/entities/keys/model/store.ts similarity index 100% rename from app/frontend/src/entities/keys/model/store.ts rename to frontend/src/entities/keys/model/store.ts diff --git a/app/frontend/src/entities/keys/model/types.ts b/frontend/src/entities/keys/model/types.ts similarity index 100% rename from app/frontend/src/entities/keys/model/types.ts rename to frontend/src/entities/keys/model/types.ts diff --git a/app/frontend/src/entities/keys/model/utils.ts b/frontend/src/entities/keys/model/utils.ts similarity index 100% rename from app/frontend/src/entities/keys/model/utils.ts rename to frontend/src/entities/keys/model/utils.ts diff --git a/app/frontend/src/entities/keys/ui/KeyboardKeys.svelte b/frontend/src/entities/keys/ui/KeyboardKeys.svelte similarity index 100% rename from app/frontend/src/entities/keys/ui/KeyboardKeys.svelte rename to frontend/src/entities/keys/ui/KeyboardKeys.svelte diff --git a/app/frontend/src/entities/lights/api/color.ts b/frontend/src/entities/lights/api/color.ts similarity index 100% rename from app/frontend/src/entities/lights/api/color.ts rename to frontend/src/entities/lights/api/color.ts diff --git a/app/frontend/src/entities/lights/api/mode.ts b/frontend/src/entities/lights/api/mode.ts similarity index 100% rename from app/frontend/src/entities/lights/api/mode.ts rename to frontend/src/entities/lights/api/mode.ts diff --git a/app/frontend/src/entities/lights/api/preset.ts b/frontend/src/entities/lights/api/preset.ts similarity index 100% rename from app/frontend/src/entities/lights/api/preset.ts rename to frontend/src/entities/lights/api/preset.ts diff --git a/app/frontend/src/entities/lights/api/state.ts b/frontend/src/entities/lights/api/state.ts similarity index 100% rename from app/frontend/src/entities/lights/api/state.ts rename to frontend/src/entities/lights/api/state.ts diff --git a/app/frontend/src/entities/lights/index.ts b/frontend/src/entities/lights/index.ts similarity index 100% rename from app/frontend/src/entities/lights/index.ts rename to frontend/src/entities/lights/index.ts diff --git a/app/frontend/src/entities/lights/model/const.ts b/frontend/src/entities/lights/model/const.ts similarity index 100% rename from app/frontend/src/entities/lights/model/const.ts rename to frontend/src/entities/lights/model/const.ts diff --git a/app/frontend/src/entities/lights/model/index.ts b/frontend/src/entities/lights/model/index.ts similarity index 100% rename from app/frontend/src/entities/lights/model/index.ts rename to frontend/src/entities/lights/model/index.ts diff --git a/app/frontend/src/entities/lights/model/store.ts b/frontend/src/entities/lights/model/store.ts similarity index 100% rename from app/frontend/src/entities/lights/model/store.ts rename to frontend/src/entities/lights/model/store.ts diff --git a/app/frontend/src/entities/lights/model/types.ts b/frontend/src/entities/lights/model/types.ts similarity index 100% rename from app/frontend/src/entities/lights/model/types.ts rename to frontend/src/entities/lights/model/types.ts diff --git a/app/frontend/src/entities/lights/model/utils.ts b/frontend/src/entities/lights/model/utils.ts similarity index 100% rename from app/frontend/src/entities/lights/model/utils.ts rename to frontend/src/entities/lights/model/utils.ts diff --git a/app/frontend/src/entities/lights/ui/LightSettingsGroup.svelte b/frontend/src/entities/lights/ui/LightSettingsGroup.svelte similarity index 100% rename from app/frontend/src/entities/lights/ui/LightSettingsGroup.svelte rename to frontend/src/entities/lights/ui/LightSettingsGroup.svelte diff --git a/app/frontend/src/entities/lights/utils/hex.ts b/frontend/src/entities/lights/utils/hex.ts similarity index 100% rename from app/frontend/src/entities/lights/utils/hex.ts rename to frontend/src/entities/lights/utils/hex.ts diff --git a/app/frontend/src/entities/lights/utils/index.ts b/frontend/src/entities/lights/utils/index.ts similarity index 100% rename from app/frontend/src/entities/lights/utils/index.ts rename to frontend/src/entities/lights/utils/index.ts diff --git a/app/frontend/src/entities/lights/utils/parse.ts b/frontend/src/entities/lights/utils/parse.ts similarity index 100% rename from app/frontend/src/entities/lights/utils/parse.ts rename to frontend/src/entities/lights/utils/parse.ts diff --git a/app/frontend/src/features/app/app-updates/index.ts b/frontend/src/features/app/app-updates/index.ts similarity index 100% rename from app/frontend/src/features/app/app-updates/index.ts rename to frontend/src/features/app/app-updates/index.ts diff --git a/app/frontend/src/features/app/app-updates/model/store.ts b/frontend/src/features/app/app-updates/model/store.ts similarity index 100% rename from app/frontend/src/features/app/app-updates/model/store.ts rename to frontend/src/features/app/app-updates/model/store.ts diff --git a/app/frontend/src/features/app/app-updates/model/utils.ts b/frontend/src/features/app/app-updates/model/utils.ts similarity index 100% rename from app/frontend/src/features/app/app-updates/model/utils.ts rename to frontend/src/features/app/app-updates/model/utils.ts diff --git a/app/frontend/src/features/app/app-updates/ui/AppUpdates.svelte b/frontend/src/features/app/app-updates/ui/AppUpdates.svelte similarity index 100% rename from app/frontend/src/features/app/app-updates/ui/AppUpdates.svelte rename to frontend/src/features/app/app-updates/ui/AppUpdates.svelte diff --git a/app/frontend/src/features/app/change-settings/index.ts b/frontend/src/features/app/change-settings/index.ts similarity index 100% rename from app/frontend/src/features/app/change-settings/index.ts rename to frontend/src/features/app/change-settings/index.ts diff --git a/app/frontend/src/features/app/change-settings/ui/AppDarkThemeToggle.svelte b/frontend/src/features/app/change-settings/ui/AppDarkThemeToggle.svelte similarity index 100% rename from app/frontend/src/features/app/change-settings/ui/AppDarkThemeToggle.svelte rename to frontend/src/features/app/change-settings/ui/AppDarkThemeToggle.svelte diff --git a/app/frontend/src/features/app/change-settings/ui/AppUISwitchSegment.svelte b/frontend/src/features/app/change-settings/ui/AppUISwitchSegment.svelte similarity index 100% rename from app/frontend/src/features/app/change-settings/ui/AppUISwitchSegment.svelte rename to frontend/src/features/app/change-settings/ui/AppUISwitchSegment.svelte diff --git a/app/frontend/src/features/app/index.ts b/frontend/src/features/app/index.ts similarity index 100% rename from app/frontend/src/features/app/index.ts rename to frontend/src/features/app/index.ts diff --git a/app/frontend/src/features/app/logging-switch/index.ts b/frontend/src/features/app/logging-switch/index.ts similarity index 100% rename from app/frontend/src/features/app/logging-switch/index.ts rename to frontend/src/features/app/logging-switch/index.ts diff --git a/app/frontend/src/features/app/logging-switch/model/store.ts b/frontend/src/features/app/logging-switch/model/store.ts similarity index 100% rename from app/frontend/src/features/app/logging-switch/model/store.ts rename to frontend/src/features/app/logging-switch/model/store.ts diff --git a/app/frontend/src/features/app/logging-switch/model/utils.ts b/frontend/src/features/app/logging-switch/model/utils.ts similarity index 100% rename from app/frontend/src/features/app/logging-switch/model/utils.ts rename to frontend/src/features/app/logging-switch/model/utils.ts diff --git a/app/frontend/src/features/app/logging-switch/ui/LoggingSwitch.svelte b/frontend/src/features/app/logging-switch/ui/LoggingSwitch.svelte similarity index 100% rename from app/frontend/src/features/app/logging-switch/ui/LoggingSwitch.svelte rename to frontend/src/features/app/logging-switch/ui/LoggingSwitch.svelte diff --git a/app/frontend/src/features/app/restart/index.ts b/frontend/src/features/app/restart/index.ts similarity index 100% rename from app/frontend/src/features/app/restart/index.ts rename to frontend/src/features/app/restart/index.ts diff --git a/app/frontend/src/features/app/restart/ui/RestartButton.svelte b/frontend/src/features/app/restart/ui/RestartButton.svelte similarity index 100% rename from app/frontend/src/features/app/restart/ui/RestartButton.svelte rename to frontend/src/features/app/restart/ui/RestartButton.svelte diff --git a/app/frontend/src/features/device/change-mode/index.ts b/frontend/src/features/device/change-mode/index.ts similarity index 100% rename from app/frontend/src/features/device/change-mode/index.ts rename to frontend/src/features/device/change-mode/index.ts diff --git a/app/frontend/src/features/device/change-mode/ui/IndividualModeToggle.svelte b/frontend/src/features/device/change-mode/ui/IndividualModeToggle.svelte similarity index 100% rename from app/frontend/src/features/device/change-mode/ui/IndividualModeToggle.svelte rename to frontend/src/features/device/change-mode/ui/IndividualModeToggle.svelte diff --git a/app/frontend/src/features/device/change-mode/ui/OSModeSelect.svelte b/frontend/src/features/device/change-mode/ui/OSModeSelect.svelte similarity index 100% rename from app/frontend/src/features/device/change-mode/ui/OSModeSelect.svelte rename to frontend/src/features/device/change-mode/ui/OSModeSelect.svelte diff --git a/app/frontend/src/features/device/index.ts b/frontend/src/features/device/index.ts similarity index 100% rename from app/frontend/src/features/device/index.ts rename to frontend/src/features/device/index.ts diff --git a/app/frontend/src/features/lights/edit-color/index.ts b/frontend/src/features/lights/edit-color/index.ts similarity index 100% rename from app/frontend/src/features/lights/edit-color/index.ts rename to frontend/src/features/lights/edit-color/index.ts diff --git a/app/frontend/src/features/lights/edit-color/model/store.ts b/frontend/src/features/lights/edit-color/model/store.ts similarity index 100% rename from app/frontend/src/features/lights/edit-color/model/store.ts rename to frontend/src/features/lights/edit-color/model/store.ts diff --git a/app/frontend/src/features/lights/edit-color/ui/LightsColorEditor.svelte b/frontend/src/features/lights/edit-color/ui/LightsColorEditor.svelte similarity index 100% rename from app/frontend/src/features/lights/edit-color/ui/LightsColorEditor.svelte rename to frontend/src/features/lights/edit-color/ui/LightsColorEditor.svelte diff --git a/app/frontend/src/features/lights/index.ts b/frontend/src/features/lights/index.ts similarity index 100% rename from app/frontend/src/features/lights/index.ts rename to frontend/src/features/lights/index.ts diff --git a/app/frontend/src/features/lights/keyboard-preview/index.ts b/frontend/src/features/lights/keyboard-preview/index.ts similarity index 100% rename from app/frontend/src/features/lights/keyboard-preview/index.ts rename to frontend/src/features/lights/keyboard-preview/index.ts diff --git a/app/frontend/src/features/lights/keyboard-preview/model/const.ts b/frontend/src/features/lights/keyboard-preview/model/const.ts similarity index 100% rename from app/frontend/src/features/lights/keyboard-preview/model/const.ts rename to frontend/src/features/lights/keyboard-preview/model/const.ts diff --git a/app/frontend/src/features/lights/keyboard-preview/model/index.ts b/frontend/src/features/lights/keyboard-preview/model/index.ts similarity index 100% rename from app/frontend/src/features/lights/keyboard-preview/model/index.ts rename to frontend/src/features/lights/keyboard-preview/model/index.ts diff --git a/app/frontend/src/features/lights/keyboard-preview/model/store.ts b/frontend/src/features/lights/keyboard-preview/model/store.ts similarity index 100% rename from app/frontend/src/features/lights/keyboard-preview/model/store.ts rename to frontend/src/features/lights/keyboard-preview/model/store.ts diff --git a/app/frontend/src/features/lights/keyboard-preview/model/utils/colors.ts b/frontend/src/features/lights/keyboard-preview/model/utils/colors.ts similarity index 100% rename from app/frontend/src/features/lights/keyboard-preview/model/utils/colors.ts rename to frontend/src/features/lights/keyboard-preview/model/utils/colors.ts diff --git a/app/frontend/src/features/lights/keyboard-preview/model/utils/contrast.ts b/frontend/src/features/lights/keyboard-preview/model/utils/contrast.ts similarity index 100% rename from app/frontend/src/features/lights/keyboard-preview/model/utils/contrast.ts rename to frontend/src/features/lights/keyboard-preview/model/utils/contrast.ts diff --git a/app/frontend/src/features/lights/keyboard-preview/model/utils/matrix.ts b/frontend/src/features/lights/keyboard-preview/model/utils/matrix.ts similarity index 100% rename from app/frontend/src/features/lights/keyboard-preview/model/utils/matrix.ts rename to frontend/src/features/lights/keyboard-preview/model/utils/matrix.ts diff --git a/app/frontend/src/features/lights/keyboard-preview/ui/KeyboardLights.svelte b/frontend/src/features/lights/keyboard-preview/ui/KeyboardLights.svelte similarity index 100% rename from app/frontend/src/features/lights/keyboard-preview/ui/KeyboardLights.svelte rename to frontend/src/features/lights/keyboard-preview/ui/KeyboardLights.svelte diff --git a/app/frontend/src/features/lights/preset/index.ts b/frontend/src/features/lights/preset/index.ts similarity index 100% rename from app/frontend/src/features/lights/preset/index.ts rename to frontend/src/features/lights/preset/index.ts diff --git a/app/frontend/src/features/lights/preset/ui/LoadPresetButton.svelte b/frontend/src/features/lights/preset/ui/LoadPresetButton.svelte similarity index 100% rename from app/frontend/src/features/lights/preset/ui/LoadPresetButton.svelte rename to frontend/src/features/lights/preset/ui/LoadPresetButton.svelte diff --git a/app/frontend/src/features/lights/preset/ui/SavePresetButton.svelte b/frontend/src/features/lights/preset/ui/SavePresetButton.svelte similarity index 100% rename from app/frontend/src/features/lights/preset/ui/SavePresetButton.svelte rename to frontend/src/features/lights/preset/ui/SavePresetButton.svelte diff --git a/app/frontend/src/features/lights/select-brightness/index.ts b/frontend/src/features/lights/select-brightness/index.ts similarity index 100% rename from app/frontend/src/features/lights/select-brightness/index.ts rename to frontend/src/features/lights/select-brightness/index.ts diff --git a/app/frontend/src/features/lights/select-brightness/model/store.ts b/frontend/src/features/lights/select-brightness/model/store.ts similarity index 100% rename from app/frontend/src/features/lights/select-brightness/model/store.ts rename to frontend/src/features/lights/select-brightness/model/store.ts diff --git a/app/frontend/src/features/lights/select-brightness/model/types.ts b/frontend/src/features/lights/select-brightness/model/types.ts similarity index 100% rename from app/frontend/src/features/lights/select-brightness/model/types.ts rename to frontend/src/features/lights/select-brightness/model/types.ts diff --git a/app/frontend/src/features/lights/select-brightness/ui/LightsBrightnessSlider.svelte b/frontend/src/features/lights/select-brightness/ui/LightsBrightnessSlider.svelte similarity index 100% rename from app/frontend/src/features/lights/select-brightness/ui/LightsBrightnessSlider.svelte rename to frontend/src/features/lights/select-brightness/ui/LightsBrightnessSlider.svelte diff --git a/app/frontend/src/features/lights/select-color/index.ts b/frontend/src/features/lights/select-color/index.ts similarity index 100% rename from app/frontend/src/features/lights/select-color/index.ts rename to frontend/src/features/lights/select-color/index.ts diff --git a/app/frontend/src/features/lights/select-color/model/store.ts b/frontend/src/features/lights/select-color/model/store.ts similarity index 100% rename from app/frontend/src/features/lights/select-color/model/store.ts rename to frontend/src/features/lights/select-color/model/store.ts diff --git a/app/frontend/src/features/lights/select-color/model/types.ts b/frontend/src/features/lights/select-color/model/types.ts similarity index 100% rename from app/frontend/src/features/lights/select-color/model/types.ts rename to frontend/src/features/lights/select-color/model/types.ts diff --git a/app/frontend/src/features/lights/select-color/ui/LightsColorSelector.svelte b/frontend/src/features/lights/select-color/ui/LightsColorSelector.svelte similarity index 100% rename from app/frontend/src/features/lights/select-color/ui/LightsColorSelector.svelte rename to frontend/src/features/lights/select-color/ui/LightsColorSelector.svelte diff --git a/app/frontend/src/features/lights/select-mode/index.ts b/frontend/src/features/lights/select-mode/index.ts similarity index 100% rename from app/frontend/src/features/lights/select-mode/index.ts rename to frontend/src/features/lights/select-mode/index.ts diff --git a/app/frontend/src/features/lights/select-mode/model/store.ts b/frontend/src/features/lights/select-mode/model/store.ts similarity index 100% rename from app/frontend/src/features/lights/select-mode/model/store.ts rename to frontend/src/features/lights/select-mode/model/store.ts diff --git a/app/frontend/src/features/lights/select-mode/model/types.ts b/frontend/src/features/lights/select-mode/model/types.ts similarity index 100% rename from app/frontend/src/features/lights/select-mode/model/types.ts rename to frontend/src/features/lights/select-mode/model/types.ts diff --git a/app/frontend/src/features/lights/select-mode/ui/LightsModeSelect.svelte b/frontend/src/features/lights/select-mode/ui/LightsModeSelect.svelte similarity index 100% rename from app/frontend/src/features/lights/select-mode/ui/LightsModeSelect.svelte rename to frontend/src/features/lights/select-mode/ui/LightsModeSelect.svelte diff --git a/app/frontend/src/features/lights/select-speed/index.ts b/frontend/src/features/lights/select-speed/index.ts similarity index 100% rename from app/frontend/src/features/lights/select-speed/index.ts rename to frontend/src/features/lights/select-speed/index.ts diff --git a/app/frontend/src/features/lights/select-speed/model/store.ts b/frontend/src/features/lights/select-speed/model/store.ts similarity index 100% rename from app/frontend/src/features/lights/select-speed/model/store.ts rename to frontend/src/features/lights/select-speed/model/store.ts diff --git a/app/frontend/src/features/lights/select-speed/model/types.ts b/frontend/src/features/lights/select-speed/model/types.ts similarity index 100% rename from app/frontend/src/features/lights/select-speed/model/types.ts rename to frontend/src/features/lights/select-speed/model/types.ts diff --git a/app/frontend/src/features/lights/select-speed/ui/LightsSpeedSlider.svelte b/frontend/src/features/lights/select-speed/ui/LightsSpeedSlider.svelte similarity index 100% rename from app/frontend/src/features/lights/select-speed/ui/LightsSpeedSlider.svelte rename to frontend/src/features/lights/select-speed/ui/LightsSpeedSlider.svelte diff --git a/app/frontend/src/features/lights/switch-power/index.ts b/frontend/src/features/lights/switch-power/index.ts similarity index 100% rename from app/frontend/src/features/lights/switch-power/index.ts rename to frontend/src/features/lights/switch-power/index.ts diff --git a/app/frontend/src/features/lights/switch-power/model/store.ts b/frontend/src/features/lights/switch-power/model/store.ts similarity index 100% rename from app/frontend/src/features/lights/switch-power/model/store.ts rename to frontend/src/features/lights/switch-power/model/store.ts diff --git a/app/frontend/src/features/lights/switch-power/model/types.ts b/frontend/src/features/lights/switch-power/model/types.ts similarity index 100% rename from app/frontend/src/features/lights/switch-power/model/types.ts rename to frontend/src/features/lights/switch-power/model/types.ts diff --git a/app/frontend/src/features/lights/switch-power/ui/LightsPowerToggle.svelte b/frontend/src/features/lights/switch-power/ui/LightsPowerToggle.svelte similarity index 100% rename from app/frontend/src/features/lights/switch-power/ui/LightsPowerToggle.svelte rename to frontend/src/features/lights/switch-power/ui/LightsPowerToggle.svelte diff --git a/app/frontend/src/main.ts b/frontend/src/main.ts similarity index 100% rename from app/frontend/src/main.ts rename to frontend/src/main.ts diff --git a/app/frontend/src/pages/device/DevicePage.svelte b/frontend/src/pages/device/DevicePage.svelte similarity index 100% rename from app/frontend/src/pages/device/DevicePage.svelte rename to frontend/src/pages/device/DevicePage.svelte diff --git a/app/frontend/src/pages/device/index.ts b/frontend/src/pages/device/index.ts similarity index 100% rename from app/frontend/src/pages/device/index.ts rename to frontend/src/pages/device/index.ts diff --git a/app/frontend/src/pages/index.ts b/frontend/src/pages/index.ts similarity index 100% rename from app/frontend/src/pages/index.ts rename to frontend/src/pages/index.ts diff --git a/app/frontend/src/pages/keys/KeysPage.svelte b/frontend/src/pages/keys/KeysPage.svelte similarity index 100% rename from app/frontend/src/pages/keys/KeysPage.svelte rename to frontend/src/pages/keys/KeysPage.svelte diff --git a/app/frontend/src/pages/keys/index.ts b/frontend/src/pages/keys/index.ts similarity index 100% rename from app/frontend/src/pages/keys/index.ts rename to frontend/src/pages/keys/index.ts diff --git a/app/frontend/src/pages/lights/LightsPage.svelte b/frontend/src/pages/lights/LightsPage.svelte similarity index 100% rename from app/frontend/src/pages/lights/LightsPage.svelte rename to frontend/src/pages/lights/LightsPage.svelte diff --git a/app/frontend/src/pages/lights/LightsToolbar.svelte b/frontend/src/pages/lights/LightsToolbar.svelte similarity index 100% rename from app/frontend/src/pages/lights/LightsToolbar.svelte rename to frontend/src/pages/lights/LightsToolbar.svelte diff --git a/app/frontend/src/pages/lights/index.ts b/frontend/src/pages/lights/index.ts similarity index 100% rename from app/frontend/src/pages/lights/index.ts rename to frontend/src/pages/lights/index.ts diff --git a/app/frontend/src/shared/api/connection.ts b/frontend/src/shared/api/connection.ts similarity index 100% rename from app/frontend/src/shared/api/connection.ts rename to frontend/src/shared/api/connection.ts diff --git a/app/frontend/src/shared/api/index.ts b/frontend/src/shared/api/index.ts similarity index 100% rename from app/frontend/src/shared/api/index.ts rename to frontend/src/shared/api/index.ts diff --git a/app/frontend/src/shared/lib/from-wails-event.ts b/frontend/src/shared/lib/from-wails-event.ts similarity index 100% rename from app/frontend/src/shared/lib/from-wails-event.ts rename to frontend/src/shared/lib/from-wails-event.ts diff --git a/app/frontend/src/shared/lib/index.ts b/frontend/src/shared/lib/index.ts similarity index 100% rename from app/frontend/src/shared/lib/index.ts rename to frontend/src/shared/lib/index.ts diff --git a/app/frontend/src/shared/lib/sequential-effect.ts b/frontend/src/shared/lib/sequential-effect.ts similarity index 100% rename from app/frontend/src/shared/lib/sequential-effect.ts rename to frontend/src/shared/lib/sequential-effect.ts diff --git a/app/frontend/src/shared/lib/strings.ts b/frontend/src/shared/lib/strings.ts similarity index 100% rename from app/frontend/src/shared/lib/strings.ts rename to frontend/src/shared/lib/strings.ts diff --git a/app/frontend/src/shared/model/constants.ts b/frontend/src/shared/model/constants.ts similarity index 100% rename from app/frontend/src/shared/model/constants.ts rename to frontend/src/shared/model/constants.ts diff --git a/app/frontend/src/shared/model/index.ts b/frontend/src/shared/model/index.ts similarity index 100% rename from app/frontend/src/shared/model/index.ts rename to frontend/src/shared/model/index.ts diff --git a/app/frontend/src/shared/model/store-connection.ts b/frontend/src/shared/model/store-connection.ts similarity index 100% rename from app/frontend/src/shared/model/store-connection.ts rename to frontend/src/shared/model/store-connection.ts diff --git a/app/frontend/src/shared/model/store-navigation.ts b/frontend/src/shared/model/store-navigation.ts similarity index 100% rename from app/frontend/src/shared/model/store-navigation.ts rename to frontend/src/shared/model/store-navigation.ts diff --git a/app/frontend/src/shared/model/types.ts b/frontend/src/shared/model/types.ts similarity index 100% rename from app/frontend/src/shared/model/types.ts rename to frontend/src/shared/model/types.ts diff --git a/app/frontend/src/style.css b/frontend/src/style.css similarity index 100% rename from app/frontend/src/style.css rename to frontend/src/style.css diff --git a/app/frontend/src/vite-env.d.ts b/frontend/src/vite-env.d.ts similarity index 100% rename from app/frontend/src/vite-env.d.ts rename to frontend/src/vite-env.d.ts diff --git a/app/frontend/src/widgets/app/index.ts b/frontend/src/widgets/app/index.ts similarity index 100% rename from app/frontend/src/widgets/app/index.ts rename to frontend/src/widgets/app/index.ts diff --git a/app/frontend/src/widgets/app/ui/AppDebugModal.svelte b/frontend/src/widgets/app/ui/AppDebugModal.svelte similarity index 100% rename from app/frontend/src/widgets/app/ui/AppDebugModal.svelte rename to frontend/src/widgets/app/ui/AppDebugModal.svelte diff --git a/app/frontend/src/widgets/device/index.ts b/frontend/src/widgets/device/index.ts similarity index 100% rename from app/frontend/src/widgets/device/index.ts rename to frontend/src/widgets/device/index.ts diff --git a/app/frontend/src/widgets/device/ui/DeviceConnection.svelte b/frontend/src/widgets/device/ui/DeviceConnection.svelte similarity index 100% rename from app/frontend/src/widgets/device/ui/DeviceConnection.svelte rename to frontend/src/widgets/device/ui/DeviceConnection.svelte diff --git a/app/frontend/src/widgets/device/ui/DeviceInfo.svelte b/frontend/src/widgets/device/ui/DeviceInfo.svelte similarity index 100% rename from app/frontend/src/widgets/device/ui/DeviceInfo.svelte rename to frontend/src/widgets/device/ui/DeviceInfo.svelte diff --git a/app/frontend/src/widgets/device/ui/DeviceSettings.svelte b/frontend/src/widgets/device/ui/DeviceSettings.svelte similarity index 100% rename from app/frontend/src/widgets/device/ui/DeviceSettings.svelte rename to frontend/src/widgets/device/ui/DeviceSettings.svelte diff --git a/app/frontend/src/widgets/lights/index.ts b/frontend/src/widgets/lights/index.ts similarity index 100% rename from app/frontend/src/widgets/lights/index.ts rename to frontend/src/widgets/lights/index.ts diff --git a/app/frontend/src/widgets/lights/ui/LightsDomainSettings.svelte b/frontend/src/widgets/lights/ui/LightsDomainSettings.svelte similarity index 100% rename from app/frontend/src/widgets/lights/ui/LightsDomainSettings.svelte rename to frontend/src/widgets/lights/ui/LightsDomainSettings.svelte diff --git a/app/frontend/src/widgets/lights/ui/LightsPreset.svelte b/frontend/src/widgets/lights/ui/LightsPreset.svelte similarity index 100% rename from app/frontend/src/widgets/lights/ui/LightsPreset.svelte rename to frontend/src/widgets/lights/ui/LightsPreset.svelte diff --git a/app/frontend/svelte.config.js b/frontend/svelte.config.js similarity index 100% rename from app/frontend/svelte.config.js rename to frontend/svelte.config.js diff --git a/app/frontend/tsconfig.json b/frontend/tsconfig.json similarity index 100% rename from app/frontend/tsconfig.json rename to frontend/tsconfig.json diff --git a/app/frontend/tsconfig.node.json b/frontend/tsconfig.node.json similarity index 100% rename from app/frontend/tsconfig.node.json rename to frontend/tsconfig.node.json diff --git a/app/frontend/vite.config.ts b/frontend/vite.config.ts similarity index 100% rename from app/frontend/vite.config.ts rename to frontend/vite.config.ts diff --git a/app/go.mod b/go.mod similarity index 89% rename from app/go.mod rename to go.mod index 9b4c547f..1b6bda05 100644 --- a/app/go.mod +++ b/go.mod @@ -6,17 +6,15 @@ toolchain go1.21.4 require ( github.com/jpillora/overseer v1.1.6 - github.com/pkg/profile v1.7.0 + github.com/mishamyrt/nuga-lib v0.3.0 github.com/wailsapp/wails/v2 v2.7.1 ) require ( github.com/StackExchange/wmi v1.2.1 // indirect github.com/bep/debounce v1.2.1 // indirect - github.com/felixge/fgprof v0.9.3 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect - github.com/google/pprof v0.0.0-20211214055906-6f57359322fd // indirect github.com/google/uuid v1.3.0 // indirect github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect github.com/jpillora/s3 v1.1.4 // indirect @@ -32,6 +30,7 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/rivo/uniseg v0.4.4 // indirect github.com/samber/lo v1.38.1 // indirect + github.com/sstallion/go-hid v0.14.1 // indirect github.com/tkrajina/go-reflector v0.5.6 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect @@ -40,7 +39,7 @@ require ( golang.org/x/crypto v0.14.0 // indirect golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.13.0 // indirect ) diff --git a/app/go.sum b/go.sum similarity index 86% rename from app/go.sum rename to go.sum index 631b9bb0..09b3ddfd 100644 --- a/app/go.sum +++ b/go.sum @@ -3,25 +3,17 @@ github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDO github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= github.com/bep/debounce v1.2.1 h1:v67fRdBA9UQu2NhLFXrSg0Brw7CexQekrBwDMM8bzeY= github.com/bep/debounce v1.2.1/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3ISbCJ0= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/felixge/fgprof v0.9.3 h1:VvyZxILNuCiUCSXtPtYmmtGvb65nqXh2QFWc0Wpf2/g= -github.com/felixge/fgprof v0.9.3/go.mod h1:RdbpDgzqYVh/T9fPELJyV7EYJuHB55UTEULNun8eiPw= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/google/pprof v0.0.0-20211214055906-6f57359322fd h1:1FjCyPC+syAzJ5/2S8fqdZK1R22vvA0J7JZKcuOIQ7Y= -github.com/google/pprof v0.0.0-20211214055906-6f57359322fd/go.mod h1:KgnwoLYCZ8IQu3XUZ8Nc/bM9CCZFOyjUNOSygVozoDg= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e h1:Q3+PugElBCf4PFpxhErSzU3/PY5sFL5Z6rfv4AbGAck= github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs= github.com/jpillora/overseer v1.1.6 h1:3ygYfNcR3FfOr22miu3vR1iQcXKMHbmULBh98rbkIyo= @@ -52,12 +44,12 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mishamyrt/nuga-lib v0.3.0 h1:qmk9fLoetO+QAN6buuOjELvq1RxBj3Xpi9LGC1eXqjE= +github.com/mishamyrt/nuga-lib v0.3.0/go.mod h1:Zvch+eplvbZyH0ubJSIV9bWoSDLJtbjOiuwu/YEPsYA= github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/profile v1.7.0 h1:hnbDkaNWPCLMO9wGLdBFTIZvzDrDfBM2072E1S9gJkA= -github.com/pkg/profile v1.7.0/go.mod h1:8Uer0jas47ZQMJ7VD+OHknK4YDY07LPUC6dEvqDjvNo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= @@ -69,11 +61,10 @@ github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHei github.com/smartystreets/assertions v1.0.1/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= github.com/smartystreets/gunit v1.1.3 h1:32x+htJCu3aMswhPw3teoJ+PnWPONqdNgaGs6Qt8ZaU= github.com/smartystreets/gunit v1.1.3/go.mod h1:EH5qMBab2UclzXUcpR8b93eHsIlp9u+pDQIRp5DZNzQ= +github.com/sstallion/go-hid v0.14.1 h1:shbZlKqv5fr1KnxwqtLEPGkOoA6OSUWTx9TblegATvc= +github.com/sstallion/go-hid v0.14.1/go.mod h1:fPKp4rqx0xuoTV94gwKojsPG++KNKhxuU88goGuGM7I= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/tkrajina/go-reflector v0.5.6 h1:hKQ0gyocG7vgMD2M3dRlYN6WBBOmdoOzJ6njQSepKdE= @@ -103,12 +94,11 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= diff --git a/go.work b/go.work deleted file mode 100644 index c21413bd..00000000 --- a/go.work +++ /dev/null @@ -1,8 +0,0 @@ -go 1.21 - -toolchain go1.21.4 - -use ( - ./app - ./lib -) diff --git a/go.work.sum b/go.work.sum deleted file mode 100644 index 1d43d912..00000000 --- a/go.work.sum +++ /dev/null @@ -1,70 +0,0 @@ -atomicgo.dev/cursor v0.1.1/go.mod h1:Lr4ZJB3U7DfPPOkbH7/6TOtJ4vFGHlgj1nc+n900IpU= -atomicgo.dev/keyboard v0.2.8/go.mod h1:BC4w9g00XkxH/f1HXhW2sXmJFOCWbKn9xrOunSFtExQ= -bitbucket.org/creachadair/shell v0.0.7/go.mod h1:oqtXSSvSYr4624lnnabXHaBsYW6RD80caLi2b3hJk0U= -github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= -github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= -github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= -github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo= -github.com/alecthomas/chroma v0.10.0/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s= -github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= -github.com/bitfield/script v0.19.0/go.mod h1:ana6F8YOSZ3ImT8SauIzuYSqXgFVkSUJ6kgja+WMmIY= -github.com/charmbracelet/glamour v0.5.0/go.mod h1:9ZRtG19AUIzcTm7FGLGbq3D5WKQ5UyZBbQsMQN0XIqc= -github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= -github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= -github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= -github.com/flytam/filenamify v1.0.0/go.mod h1:Dzf9kVycwcsBlr2ATg6uxjqiFgKGH+5SKFuhdeP5zu8= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= -github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= -github.com/go-git/go-git/v5 v5.3.0/go.mod h1:xdX4bWJ48aOrdhnl2XqHYstHbbp6+LFS4r4X+lNVprw= -github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= -github.com/gookit/color v1.5.2/go.mod h1:w8h4bGiHeeBpvQVePTutdbERIUf3oJE5lZ8HM0UgXyg= -github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c= -github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/jackmordaunt/icns v1.0.0/go.mod h1:7TTQVEuGzVVfOPPlLNHJIkzA6CoV7aH1Dv9dW351oOo= -github.com/jaypipes/ghw v0.12.0/go.mod h1:jeJGbkRB2lL3/gxYzNYzEDETV1ZJ56OKr+CSeSEym+g= -github.com/jaypipes/pcidb v1.0.0/go.mod h1:TnYUvqhPBzCKnH34KrIX22kAeEbDCSRJ9cqLRCuNDfk= -github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= -github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= -github.com/leaanthony/clir v1.3.0/go.mod h1:k/RBkdkFl18xkkACMCLt09bhiZnrGORoxmomeMvDpE0= -github.com/leaanthony/winicon v1.0.0/go.mod h1:en5xhijl92aphrJdmRPlh4NI1L6wq3gEm0LpXAPghjU= -github.com/lithammer/fuzzysearch v1.1.5/go.mod h1:1R1LRNk7yKid1BaQkmuLQaHruxcC4HmAH30Dh61Ih1Q= -github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= -github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/microcosm-cc/bluemonday v1.0.17/go.mod h1:Z0r70sCuXHig8YpBzCc5eGHAap2K7e/u082ZUpDRRqM= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= -github.com/muesli/termenv v0.9.0/go.mod h1:R/LzAKf+suGs4IsO95y7+7DpFHO0KABgnZqtlyx2mBw= -github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= -github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/pterm/pterm v0.12.49/go.mod h1:D4OBoWNqAfXkm5QLTjIgjNiMXPHemLJHnIreGUsWzWg= -github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= -github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs= -github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= -github.com/sstallion/go-hid v0.14.0 h1:bSCzyw5E9lGrdQb1NXgRYfmf/z+B+DfSftDlmjOMbfk= -github.com/sstallion/go-hid v0.14.0/go.mod h1:UaqSxWjbdX9mId5JiqsMAnVtZymx/GSvQMgnzHMks2M= -github.com/sstallion/go-tools v1.0.0/go.mod h1:y3Rklut4T6cPLmNkaU0obckQpnVSSvAZlB2N87qgUtg= -github.com/tc-hib/winres v0.2.1/go.mod h1:C/JaNhH3KBvhNKVbvdlDWkbMDO9H4fKKDaN7/07SSuk= -github.com/tidwall/gjson v1.9.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= -github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= -github.com/tidwall/sjson v1.1.7/go.mod h1:w/yG+ezBeTdUxiKs5NcPicO9diP38nk96QBAbIIGeFs= -github.com/wzshiming/ctc v1.2.3/go.mod h1:2tVAtIY7SUyraSk0JxvwmONNPFL4ARavPuEsg5+KA28= -github.com/wzshiming/winseq v0.0.0-20200112104235-db357dc107ae/go.mod h1:VTAq37rkGeV+WOybvZwjXiJOicICdpLCN8ifpISjK20= -github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= -github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/yuin/goldmark-emoji v1.0.1/go.mod h1:2w1E6FEWLcDQkoTE+7HU6QF1F6SLlNGjRIBbIZQFqkQ= -golang.org/x/image v0.12.0/go.mod h1:Lu90jvHG7GfemOIcldsh9A2hS01ocl6oNO7ype5mEnk= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= -golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -howett.net/plist v1.0.0/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g= diff --git a/app/internal/application/application.go b/internal/application/application.go similarity index 100% rename from app/internal/application/application.go rename to internal/application/application.go diff --git a/app/internal/application/options.go b/internal/application/options.go similarity index 100% rename from app/internal/application/options.go rename to internal/application/options.go diff --git a/app/internal/dto/environment.go b/internal/dto/environment.go similarity index 100% rename from app/internal/dto/environment.go rename to internal/dto/environment.go diff --git a/app/internal/dto/files.go b/internal/dto/files.go similarity index 100% rename from app/internal/dto/files.go rename to internal/dto/files.go diff --git a/app/internal/dto/lights.go b/internal/dto/lights.go similarity index 85% rename from app/internal/dto/lights.go rename to internal/dto/lights.go index 4eec7e71..db80a42e 100644 --- a/app/internal/dto/lights.go +++ b/internal/dto/lights.go @@ -1,13 +1,11 @@ package dto import ( - "nuga/pkg/color" - "nuga/pkg/light" - "nuga/pkg/light/effect" + "github.com/mishamyrt/nuga-lib/light" ) // LightModes represents all domain modes -type LightModes []effect.Domain +type LightModes []light.Domain // LightState represents keyboard light state. type LightState struct { @@ -31,4 +29,4 @@ type LightStateRequest struct { } // BacklightColors represents backlight color array for modes -type BacklightColors [][]color.RGB +type BacklightColors [][]light.RGB diff --git a/app/internal/dto/preset.go b/internal/dto/preset.go similarity index 86% rename from app/internal/dto/preset.go rename to internal/dto/preset.go index 8f200e89..f3d80df4 100644 --- a/app/internal/dto/preset.go +++ b/internal/dto/preset.go @@ -1,6 +1,6 @@ package dto -import "nuga/pkg/light" +import "github.com/mishamyrt/nuga-lib/light" // LightsStatePreset represents lights state type LightsStatePreset *light.Effects diff --git a/app/internal/entity/config.go b/internal/entity/config.go similarity index 100% rename from app/internal/entity/config.go rename to internal/entity/config.go diff --git a/app/internal/errors/errors.go b/internal/errors/errors.go similarity index 100% rename from app/internal/errors/errors.go rename to internal/errors/errors.go diff --git a/app/internal/interfaces/repository.go b/internal/interfaces/repository.go similarity index 91% rename from app/internal/interfaces/repository.go rename to internal/interfaces/repository.go index 821cdf16..3d8fbe42 100644 --- a/app/internal/interfaces/repository.go +++ b/internal/interfaces/repository.go @@ -2,10 +2,10 @@ package interfaces import ( - "nuga/pkg/device" - "nuga/pkg/light" "nuga_ui/internal/dto" "nuga_ui/internal/entity" + + "github.com/mishamyrt/nuga-lib" ) // Repository represents an aggregate repository that encapsulates various repositories related to the application. @@ -21,8 +21,8 @@ type DeviceRepository interface { IsConnected() bool Connect() string Disconnect() error - Simulate(template light.SimulationTemplate) (string, error) - Get() *device.Device + Simulate(template *nuga.SimulationTemplate) (string, error) + Get() *nuga.Device } // SettingsRepository defines the interface for managing application settings. diff --git a/app/internal/interfaces/usecase.go b/internal/interfaces/usecase.go similarity index 94% rename from app/internal/interfaces/usecase.go rename to internal/interfaces/usecase.go index 445e3995..a89b02a5 100644 --- a/app/internal/interfaces/usecase.go +++ b/internal/interfaces/usecase.go @@ -2,9 +2,10 @@ package interfaces import ( "context" - "nuga/pkg/color" "nuga_ui/internal/dto" "nuga_ui/internal/entity" + + "github.com/mishamyrt/nuga-lib/light" ) // Usecase represents an aggregate use case that encapsulates various use cases related to the application. @@ -63,7 +64,7 @@ type LightsUsecase interface { GetLightState() (dto.LightState, error) SetLightState(r dto.LightStateRequest) error GetBacklightColors() (dto.BacklightColors, error) - SetBacklightColor(mode, index uint8, color color.RGB) error + SetBacklightColor(mode, index uint8, color light.RGB) error SavePreset() error LoadPreset() error } diff --git a/app/internal/repository/device/device.go b/internal/repository/device/device.go similarity index 77% rename from app/internal/repository/device/device.go rename to internal/repository/device/device.go index 000f390c..5b437509 100644 --- a/app/internal/repository/device/device.go +++ b/internal/repository/device/device.go @@ -2,13 +2,12 @@ package device import ( - "nuga/pkg/device" - "nuga/pkg/light" + "github.com/mishamyrt/nuga-lib" ) // Repository represents device repository type Repository struct { - dev *device.Device + dev *nuga.Device } // New creates device repository @@ -22,7 +21,7 @@ func (r *Repository) IsConnected() bool { } // Get returns device instance -func (r *Repository) Get() *device.Device { +func (r *Repository) Get() *nuga.Device { return r.dev } @@ -30,7 +29,7 @@ func (r *Repository) Get() *device.Device { func (r *Repository) Connect() string { var err error if r.dev == nil { - r.dev, err = device.Open() + r.dev, err = nuga.Open() if err != nil { return "" } @@ -49,8 +48,8 @@ func (r *Repository) Disconnect() error { } // Simulate connection with device -func (r *Repository) Simulate(template light.SimulationTemplate) (string, error) { - dev, err := device.OpenSimulation(template) +func (r *Repository) Simulate(template *nuga.SimulationTemplate) (string, error) { + dev, err := nuga.OpenSimulation(template) if err != nil { return "", err } diff --git a/app/internal/repository/environment/environment.go b/internal/repository/environment/environment.go similarity index 100% rename from app/internal/repository/environment/environment.go rename to internal/repository/environment/environment.go diff --git a/app/internal/repository/preset/preset.go b/internal/repository/preset/preset.go similarity index 100% rename from app/internal/repository/preset/preset.go rename to internal/repository/preset/preset.go diff --git a/app/internal/repository/repository.go b/internal/repository/repository.go similarity index 100% rename from app/internal/repository/repository.go rename to internal/repository/repository.go diff --git a/app/internal/repository/settings/file.go b/internal/repository/settings/file.go similarity index 100% rename from app/internal/repository/settings/file.go rename to internal/repository/settings/file.go diff --git a/app/internal/repository/settings/path.go b/internal/repository/settings/path.go similarity index 100% rename from app/internal/repository/settings/path.go rename to internal/repository/settings/path.go diff --git a/app/internal/repository/settings/settings.go b/internal/repository/settings/settings.go similarity index 100% rename from app/internal/repository/settings/settings.go rename to internal/repository/settings/settings.go diff --git a/app/internal/usecase/device.go b/internal/usecase/device.go similarity index 92% rename from app/internal/usecase/device.go rename to internal/usecase/device.go index ce8cf3d7..c1cac866 100644 --- a/app/internal/usecase/device.go +++ b/internal/usecase/device.go @@ -5,11 +5,10 @@ import ( "context" "encoding/json" "log" - "nuga/pkg/hid" - "nuga/pkg/light" "nuga_ui/internal/interfaces" "os" + "github.com/mishamyrt/nuga-lib" "github.com/wailsapp/wails/v2/pkg/runtime" ) @@ -23,12 +22,12 @@ type DeviceUsecase struct { func (d *DeviceUsecase) OnStartup(ctx context.Context, repo *interfaces.Repository) error { d.repo = repo d.ctx = ctx - return hid.Init() + return nuga.Init() } // OnShutdown is a life-cycle hook that runs when app finishes func (d *DeviceUsecase) OnShutdown() error { - return hid.Exit() + return nuga.Exit() } // SimulateConnection start connection simulation @@ -53,13 +52,13 @@ func (d *DeviceUsecase) SimulateConnection() string { log.Printf("Error while reading simulation template: %v", err) return "" } - var template light.SimulationTemplate + var template nuga.SimulationTemplate err = json.Unmarshal(content, &template) if err != nil { log.Printf("Error while parsing simulation template: %v", err) return "" } - name, err := d.repo.Device.Simulate(template) + name, err := d.repo.Device.Simulate(&template) if err != nil { log.Printf("Error while starting simulation: %v", err) return "" diff --git a/app/internal/usecase/environment.go b/internal/usecase/environment.go similarity index 100% rename from app/internal/usecase/environment.go rename to internal/usecase/environment.go diff --git a/app/internal/usecase/lights.go b/internal/usecase/lights.go similarity index 70% rename from app/internal/usecase/lights.go rename to internal/usecase/lights.go index 32026e40..8fb83ed2 100644 --- a/app/internal/usecase/lights.go +++ b/internal/usecase/lights.go @@ -2,14 +2,13 @@ package usecase import ( "context" - "nuga/pkg/color" - "nuga/pkg/light" - "nuga/pkg/light/effect" "nuga_ui/internal/dto" "nuga_ui/internal/entity" "nuga_ui/internal/errors" "nuga_ui/internal/interfaces" + "github.com/mishamyrt/nuga-lib" + "github.com/mishamyrt/nuga-lib/light" "github.com/wailsapp/wails/v2/pkg/runtime" ) @@ -33,13 +32,24 @@ func (l *LightsUsecase) OnShutdown() error { // GetLightModes returns light modes func (l *LightsUsecase) GetLightModes() dto.LightModes { - return l.repo.Device.Get().LightDomains + dev := l.repo.Device.Get() + var modes dto.LightModes = make([]light.Domain, 0) + if dev.Capabilities.Has(nuga.BacklightCapability) { + modes = append(modes, light.BacklightDomain) + } + if dev.Capabilities.Has(nuga.SidelightCapability) { + modes = append(modes, light.SidelightDomain) + } + if dev.Capabilities.Has(nuga.HalolightCapability) { + modes = append(modes, light.HaloDomain) + } + return modes } // GetLightState returns lights state func (l *LightsUsecase) GetLightState() (dto.LightState, error) { var state dto.LightState - effects, err := l.repo.Device.Get().Light.GetEffects() + effects, err := l.repo.Device.Get().Features.Light.GetEffects() if err != nil { return state, err } @@ -54,7 +64,7 @@ func (l *LightsUsecase) GetLightState() (dto.LightState, error) { func (l *LightsUsecase) GetBacklightColors() (dto.BacklightColors, error) { dev := l.repo.Device.Get() config := l.repo.Settings.GetMode() - colors, err := dev.Light.GetColors() + colors, err := dev.Features.Light.GetBacklightColors() if err != nil { return nil, err } @@ -67,7 +77,7 @@ func (l *LightsUsecase) GetBacklightColors() (dto.BacklightColors, error) { // SetLightState updates lights state func (l *LightsUsecase) SetLightState(r dto.LightStateRequest) error { dev := l.repo.Device.Get() - state, err := dev.Light.GetEffects() + state, err := dev.Features.Light.GetEffects() if err != nil { return err } @@ -75,49 +85,49 @@ func (l *LightsUsecase) SetLightState(r dto.LightStateRequest) error { if err != nil { return err } - err = l.applyMiscState(&state.Sidelight, r.Sidelight, effect.Sidelight) + err = l.applyMiscState(&state.Sidelight, r.Sidelight, light.SidelightDomain) if err != nil { return err } - err = l.applyMiscState(&state.Halo, r.Halo, effect.Halo) + err = l.applyMiscState(&state.Halo, r.Halo, light.HaloDomain) if err != nil { return err } - return dev.Light.SetEffects(state) + return dev.Features.Light.SetEffects(state) } // SetBacklightColor sets backlight color by mode and index -func (l *LightsUsecase) SetBacklightColor(mode, index uint8, color color.RGB) error { +func (l *LightsUsecase) SetBacklightColor(mode, index uint8, color light.RGB) error { dev := l.repo.Device.Get() config := l.repo.Settings.GetMode() - colors, err := dev.Light.GetColors() + colors, err := dev.Features.Light.GetBacklightColors() if err != nil { return err } if config.IndividualSettings { if config.OSMode == entity.MacOSMode { - colors.SetMacBacklight(mode, index, color) + colors.SetMac(mode, index, &color) } else { - colors.SetWinBacklight(mode, index, color) + colors.SetWin(mode, index, &color) } } else { - colors.SetWinBacklight(mode, index, color) - colors.SetMacBacklight(mode, index, color) + colors.SetWin(mode, index, &color) + colors.SetMac(mode, index, &color) } - return dev.Light.SetColors(colors) + return dev.Features.Light.SetBacklightColors(colors) } // SavePreset initiates preset save process func (l *LightsUsecase) SavePreset() error { dev := l.repo.Device.Get() - state, err := dev.Light.GetEffects() + state, err := dev.Features.Light.GetEffects() if err != nil { return err } if err != nil { return err } - colors, err := dev.Light.GetColors() + colors, err := dev.Features.Light.GetBacklightColors() if err != nil { return err } @@ -154,12 +164,12 @@ func (l *LightsUsecase) LoadPreset() error { return errors.ErrPresetWrongDevice } - colorState := light.ColorsFromSlice(preset.Colors) - err = dev.Light.SetColors(colorState) + colorState := light.BacklightColorsFromSlice(preset.Colors) + err = dev.Features.Light.SetBacklightColors(colorState) if err != nil { return err } - err = dev.Light.SetEffects(preset.State) + err = dev.Features.Light.SetEffects(preset.State) if err != nil { return err } @@ -167,21 +177,21 @@ func (l *LightsUsecase) LoadPreset() error { } func (l *LightsUsecase) applyBacklightState(b *light.BacklightEffect, r dto.LightDomainRequest) error { - b.Mode = effect.Backlight.Find(r.Mode) + b.Mode = light.BacklightDomain.Find(r.Mode) if b.Mode == nil { - b.Mode = &effect.BacklightOff + b.Mode = &light.BacklightOff } if b.Mode.Code == 0 { return nil } fea := b.Mode.Features - if fea.IsSet(effect.Speed) { + if fea.IsSet(light.Speed) { err := b.SetSpeed(r.Speed) if err != nil { return err } } - if fea.IsSet(effect.SpecificColor) { + if fea.IsSet(light.SpecificColor) { err := b.SetColor(r.Color) if err != nil { return err @@ -197,23 +207,23 @@ func (l *LightsUsecase) applyBacklightState(b *light.BacklightEffect, r dto.Ligh func (l *LightsUsecase) applyMiscState( e *light.MiscEffect, r dto.LightDomainRequest, - d effect.Domain, + d light.Domain, ) error { e.Mode = d.Find(r.Mode) if e.Mode == nil { - e.Mode = &effect.SidelightOff + e.Mode = &light.SidelightOff } if e.Mode.Code == 0 { r.Speed = 0 e.Color = 0 return nil } - if e.Mode.Features.IsSet(effect.Speed) { + if e.Mode.Features.IsSet(light.Speed) { e.Speed = r.Speed } else { r.Speed = 0 } - if e.Mode.Features.IsSet(effect.SpecificColor) { + if e.Mode.Features.IsSet(light.SpecificColor) { e.Color = r.Color } else { e.Color = 0 diff --git a/app/internal/usecase/settings.go b/internal/usecase/settings.go similarity index 100% rename from app/internal/usecase/settings.go rename to internal/usecase/settings.go diff --git a/app/internal/usecase/usecase.go b/internal/usecase/usecase.go similarity index 100% rename from app/internal/usecase/usecase.go rename to internal/usecase/usecase.go diff --git a/lib/README.md b/lib/README.md deleted file mode 100644 index 0df0b2f3..00000000 --- a/lib/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Nuga library - -A library that provides the ability to control NuPhy® keyboards using Golang. - -## Protocol - -The library is based on reverse-engineering of the keyboard protocol. The knowledge that was obtained is recorded in the [`docs`](./docs/) folder. - -## Trademarks - -NuPhy® is a registered trademark of NuPhy Studio. Nuga is an unofficial product and is not affiliated with NuPhy Studio. diff --git a/lib/docs/protocol.md b/lib/docs/protocol.md deleted file mode 100644 index a4df241c..00000000 --- a/lib/docs/protocol.md +++ /dev/null @@ -1,88 +0,0 @@ -# USB backlight protocol - -The keypad backlight (not contour halo) is controlled by means of two queries. One lists the effect colors, the other lists the parameters. - -### Params - -#### Read - -1. SET_REPORT 5 `0x05, 0x83, 0xb6, 0x00, 0x00, 0x00` -2. GET_REPORT 6 - -In response, a similar result will come twice. The values will be the same. This is probably to confirm that the data transfer is correct. - -```sh -# Header -0x06, 0x83, 0xb6, 0x00, 0x00, 0x00, 0x00, 0x00, -# Header 2? -0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a, 0xa5, -# Current effect ↓ -0x03, 0x03, 0x03, 0x00, 0x00, 0x01, 0x20, 0x00, -0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, -0x02, 0x00, 0x04, 0x00, 0xff, 0xff, 0x00, 0x44, -0x07, 0x44, 0x00, 0x44, 0x07, 0x44, 0x07, 0x44, -0x00, 0x44, 0x07, 0x44, 0x07, 0x44, 0x07, 0x44, -0x07, 0x44, 0x07, 0x44, 0x07, 0x44, 0x07, 0x44, -0x07, 0x44, 0x07, 0x44, 0x07, 0x44, 0x07, 0x44, -0x07, 0x44, 0x07, 0x44, 0x07, 0x44, 0x07, 0x44, -0x07, 0x44, 0x07, 0x44, 0x07, 0x44, 0x07, 0x44, -0x07, 0x44, 0x07, 0x44, 0x07, 0x44, 0x07, 0x44, -0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, -0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, -0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x5a, 0xa5 -``` - -#### Structure - -The parameter description consists of the following parts: - -```sh -# ↓ Header -0x03, 0x03, 0x03, 0x00, 0x00, -# ↓ Current effect, single byte -0x01, -# ↓ Header 2 -0x20, 0x00, 0x00, 0x00, 0x00, 0x00, -0x05, 0x00, 0x04, 0x00, 0x02, 0x00, -0x04, 0x00, 0xFF, 0xFF, -# Effect parameters. To set the 0x05 effect parameters, you must change the 5 entry and so on. -# 29 pairs of color (0-7) and a value that is calculated from brightness (0-4) and speed (0-4). -# 7 in color means Random. -# value = (speed * 16) + brightness -0x07, 0x44, 0x07, 0x44, 0x07, 0x44, -0x07, 0x44, 0x07, 0x44, 0x07, 0x44, -0x07, 0x44, 0x07, 0x44, 0x07, 0x44, -0x07, 0x44, 0x07, 0x44, 0x07, 0x44, -0x07, 0x44, 0x07, 0x44, 0x07, 0x44, -0x07, 0x44, 0x07, 0x44, 0x07, 0x44, -0x07, 0x44, 0x07, 0x44, 0x07, 0x44, -0x07, 0x44, 0x07, 0x44, 0x07, 0x44, -0x07, 0x44, 0x07, 0x44, 0x07, 0x44, -0x07, 0x44, 0x07, 0x44, -# Suffix -0x04, 0x04, 0x04, 0x04, 0x04, 0x04, -0x04, 0x04, 0x04, 0x04, 0x00, 0x00, -0x00, 0x00, 0x01, 0x01, 0x00, 0x01, -0x01, 0x01, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, -0x5A, 0xA5 -``` - -### Write - - - -```sh -0x06, 0x03, 0xb6, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a, 0xa5, - - -### Colors - -1. SET_REPORT 5 `0x05, 0x88, 0xb8, 0x00, 0x00, 0x00` -2. GET_REPORT 6 diff --git a/lib/examples/describe/main.go b/lib/examples/describe/main.go deleted file mode 100644 index f386d12f..00000000 --- a/lib/examples/describe/main.go +++ /dev/null @@ -1,46 +0,0 @@ -// Package contains an example of how to use the nuga library -package main - -import ( - "encoding/json" - "fmt" - "nuga/pkg/device" - "nuga/pkg/light" - "os" -) - -func describe(d *device.Device) { - fmt.Println("Device: " + d.Name) - fmt.Println("Supported light domains:") - for i := range d.LightDomains { - fmt.Println("* " + d.LightDomains[i].Name) - } -} - -func openSimulation(tplPath string) (*device.Device, error) { - content, err := os.ReadFile(tplPath) - if err != nil { - panic(err) - } - var t light.SimulationTemplate - err = json.Unmarshal(content, &t) - if err != nil { - return nil, err - } - return device.OpenSimulation(t) -} - -func main() { - var d *device.Device - var err error - if len(os.Args) == 2 { - fmt.Println("Loading simulation") - d, err = openSimulation(os.Args[1]) - } else { - d, err = device.Open() - } - if err != nil { - panic(err) - } - describe(d) -} diff --git a/lib/go.mod b/lib/go.mod deleted file mode 100644 index f88a3203..00000000 --- a/lib/go.mod +++ /dev/null @@ -1,9 +0,0 @@ -module nuga - -go 1.20 - -require github.com/sstallion/go-hid v0.14.0 - -require ( - golang.org/x/sys v0.9.0 // indirect -) diff --git a/lib/pkg/bit/mask.go b/lib/pkg/bit/mask.go deleted file mode 100644 index 179daae5..00000000 --- a/lib/pkg/bit/mask.go +++ /dev/null @@ -1,30 +0,0 @@ -// Package bit contains utils for bit masks -package bit - -// Mask represents bit mask entity -type Mask byte - -type predicate func(f Mask) bool - -func (m *Mask) assert(features []Mask, assert predicate, defaultExit bool) bool { - for i := range features { - if assert(features[i]) { - return !defaultExit - } - } - return defaultExit -} - -// IsSet checks if bits is set. -func (m Mask) IsSet(bits ...Mask) bool { - return m.assert(bits, func(feature Mask) bool { - return m&feature == 0 - }, true) -} - -// IsSetAny checks if any of bits is set. -func (m Mask) IsSetAny(bits ...Mask) bool { - return m.assert(bits, func(feature Mask) bool { - return m&feature != 0 - }, false) -} diff --git a/lib/pkg/color/errors.go b/lib/pkg/color/errors.go deleted file mode 100644 index 24a9c524..00000000 --- a/lib/pkg/color/errors.go +++ /dev/null @@ -1,7 +0,0 @@ -// Package color contains utils to work with colors -package color - -import "errors" - -// ErrInvalidLength is returned when HEX color string length is unexpected -var ErrInvalidLength = errors.New("invalid length, must be 7 or 4") diff --git a/lib/pkg/color/parse.go b/lib/pkg/color/parse.go deleted file mode 100644 index ee65440b..00000000 --- a/lib/pkg/color/parse.go +++ /dev/null @@ -1,25 +0,0 @@ -// Package color contains utils to work with colors -package color - -import ( - "fmt" -) - -// ParseHex converts a string with HEX colour into an RGB structure -func ParseHex(s string) (RGB, error) { - c := RGB{} - var err error - switch len(s) { - case 7: - _, err = fmt.Sscanf(s, "#%02x%02x%02x", &c.R, &c.G, &c.B) - case 4: - _, err = fmt.Sscanf(s, "#%1x%1x%1x", &c.R, &c.G, &c.B) - // Double the hex digits - c.R *= 0x11 - c.G *= 0x11 - c.B *= 0x11 - default: - err = ErrInvalidLength - } - return c, err -} diff --git a/lib/pkg/color/presets.go b/lib/pkg/color/presets.go deleted file mode 100644 index 978419df..00000000 --- a/lib/pkg/color/presets.go +++ /dev/null @@ -1,18 +0,0 @@ -package color - -var ( - // Red color RGB value - Red = RGB{0xFF, 0x00, 0x00} - // Green color RGB value - Green = RGB{0x00, 0xFF, 0x00} - // Blue color RGB value - Blue = RGB{0x00, 0x00, 0xFF} - // Yellow color RGB value - Yellow = RGB{0xFF, 0xFF, 0x00} - // Purple color RGB value - Purple = RGB{0xFF, 0x00, 0xFF} - // Cyan color RGB value - Cyan = RGB{0x00, 0xFF, 0xFF} - // White color RGB value - White = RGB{0xFF, 0xFF, 0xFF} -) diff --git a/lib/pkg/color/rgb.go b/lib/pkg/color/rgb.go deleted file mode 100644 index c0eab3e2..00000000 --- a/lib/pkg/color/rgb.go +++ /dev/null @@ -1,6 +0,0 @@ -package color - -// RGB represents light color -type RGB struct { - R, G, B uint8 -} diff --git a/lib/pkg/device/device.go b/lib/pkg/device/device.go deleted file mode 100644 index 29f9de25..00000000 --- a/lib/pkg/device/device.go +++ /dev/null @@ -1,71 +0,0 @@ -// Package device is the entrypoint for keyboard device control -package device - -import ( - "nuga/pkg/hid" - "nuga/pkg/light" - "nuga/pkg/light/effect" -) - -// Device represents keyboard with its controls -type Device struct { - Name string - Layout int - Path string - Firmware string - Light light.Controller - LightDomains []effect.Domain - handle *hid.Handle -} - -// Close connection with hid device -func (d *Device) Close() error { - if d.handle == nil { - return nil - } - return d.handle.Close() -} - -// GetEffects returns keyboard effects. -func (d *Device) GetEffects() (*light.Effects, error) { - return d.Light.GetEffects() -} - -// SetEffects sets keyboard effects. -func (d *Device) SetEffects(p *light.Effects) error { - return d.Light.SetEffects(p) -} - -// GetColors returns keyboard colors state. -func (d *Device) GetColors() (*light.ColorState, error) { - return d.Light.GetColors() -} - -// SetColors sets keyboard color state. -func (d *Device) SetColors(c *light.ColorState) error { - return d.Light.SetColors(c) -} - -// Open real keyboard USB handle -func Open() (*Device, error) { - handle, err := hid.OpenHandle() - if err != nil { - return nil, err - } - info, err := handle.GetInfo() - if err != nil { - return nil, err - } - d, err := getDevice(info.Name) - if err != nil { - return nil, err - } - d.Path = info.Path - d.Firmware = info.Firmware - d.Light = light.OpenK916(handle) - if err != nil { - return nil, err - } - d.handle = handle - return d, nil -} diff --git a/lib/pkg/device/errors.go b/lib/pkg/device/errors.go deleted file mode 100644 index 23927b38..00000000 --- a/lib/pkg/device/errors.go +++ /dev/null @@ -1,9 +0,0 @@ -package device - -import "errors" - -// ErrNotSupported is returned when you try to open a keyboard that is not supported by the application -var ErrNotSupported = errors.New("device is not supported") - -// ErrWrongVendor is returned when you try to open a keyboard not from NuPhy -var ErrWrongVendor = errors.New("device vendor is not NuPhy") diff --git a/lib/pkg/device/simulation.go b/lib/pkg/device/simulation.go deleted file mode 100644 index 14c9d62c..00000000 --- a/lib/pkg/device/simulation.go +++ /dev/null @@ -1,14 +0,0 @@ -package device - -import "nuga/pkg/light" - -// OpenSimulation opens not real keyboard from template (for testing) -func OpenSimulation(t light.SimulationTemplate) (*Device, error) { - d, err := getDevice(t.Name) - if err != nil { - return nil, err - } - d.Light = light.OpenSimulation(t) - d.Path = "/simulated/device/path" - return d, nil -} diff --git a/lib/pkg/device/supported.go b/lib/pkg/device/supported.go deleted file mode 100644 index 766aed6b..00000000 --- a/lib/pkg/device/supported.go +++ /dev/null @@ -1,56 +0,0 @@ -package device - -import ( - "nuga/pkg/light/effect" - "strings" -) - -// SupportedDevices contains nuga supported keyboard list with its features -var SupportedDevices = []Device{ - { - Name: "Halo96", - Layout: 96, - LightDomains: []effect.Domain{ - effect.Backlight, - effect.Halo, - effect.Sidelight, - }, - }, - { - Name: "Halo75", - Layout: 75, - LightDomains: []effect.Domain{ - effect.Backlight, - effect.Halo, - effect.Sidelight, - }, - }, - { - Name: "Halo65", - Layout: 65, - LightDomains: []effect.Domain{ - effect.Backlight, - effect.Halo, - effect.Sidelight, - }, - }, -} - -const vendorPrefix = "NuPhy " - -func getDevice(rawName string) (*Device, error) { - if !strings.HasPrefix(rawName, vendorPrefix) { - return nil, ErrWrongVendor - } - name := strings.TrimPrefix(rawName, vendorPrefix) - var device *Device - for i := range SupportedDevices { - if SupportedDevices[i].Name == name { - device = &SupportedDevices[i] - } - } - if device == nil { - return nil, ErrNotSupported - } - return device, nil -} diff --git a/lib/pkg/hid/constants.go b/lib/pkg/hid/constants.go deleted file mode 100644 index b1977f4e..00000000 --- a/lib/pkg/hid/constants.go +++ /dev/null @@ -1,8 +0,0 @@ -// Package hid contains utils to USB HID keyboard. -package hid - -// ReportIDRead is HID report ID for writing data. -const ReportIDRead = 5 - -// ReportIDWrite is HID report ID for reading data. -const ReportIDWrite = 6 diff --git a/lib/pkg/hid/errors.go b/lib/pkg/hid/errors.go deleted file mode 100644 index 2b875bf2..00000000 --- a/lib/pkg/hid/errors.go +++ /dev/null @@ -1,17 +0,0 @@ -package hid - -import ( - "errors" - "fmt" -) - -// ErrNotFound is returned when the device wasn't found -var ErrNotFound = errors.New("keyboard is not found") - -// ErrCountMismatch is returned when transmitted number of bytes is not expected -var ErrCountMismatch = errors.New("the transmitted number of bytes is not expected") - -// NewErrCountMismatch creates a byte count mismatch error. -func NewErrCountMismatch(expected, actual int) error { - return fmt.Errorf("%w : expected %d, actual %d", ErrCountMismatch, expected, actual) -} diff --git a/lib/pkg/hid/handle.go b/lib/pkg/hid/handle.go deleted file mode 100644 index ba802243..00000000 --- a/lib/pkg/hid/handle.go +++ /dev/null @@ -1,160 +0,0 @@ -package hid - -import ( - "log" - "sync" - "time" - - "github.com/sstallion/go-hid" -) - -// RequestRetries is the number of attempts that will be made on a request. -const RequestRetries = 5 - -// Handle represents backlight device handle. -type Handle struct { - Device *hid.Device - // Debug flag. If true, then debugging data will be written to stdout when functions are executed. - Debug bool - mutex sync.Mutex -} - -// GetInfo returns handle device information. -func (h *Handle) GetInfo() (*DeviceInfo, error) { - name, err := h.Device.GetProductStr() - if err != nil { - return nil, err - } - info, err := h.Device.GetDeviceInfo() - if err != nil { - return nil, err - } - return &DeviceInfo{ - Name: name, - Path: info.Path, - Firmware: formatVersion(info.ReleaseNbr), - }, nil -} - -// SendWithRetries sends the request and resends it if the request fails. -func (h *Handle) SendWithRetries(payload []byte) error { - var err error - for i := 0; i < RequestRetries; i++ { - if h.Debug { - log.Println("Send attempt", i+1) - } - err = h.Send(payload) - if err == nil { - return nil - } - } - if err != nil { - return err - } - return ErrNotFound -} - -// Send packet to the device. -func (h *Handle) Send(payload []byte) error { - h.mutex.Lock() - defer h.mutex.Unlock() - if h.Debug { - log.Printf("Send %v: %v", len(payload), payload) - } - - transferred, err := h.Device.SendFeatureReport(payload) - if err != nil { - return err - } - expected := len(payload) - if transferred != len(payload) { - return NewErrCountMismatch(expected, transferred) - } - - h.waitSync() - return nil -} - -// Read packet from the device. -func (h *Handle) Read(count int) ([]byte, error) { - h.mutex.Lock() - defer h.mutex.Unlock() - buf := make([]byte, count) - buf[0] = 0x06 - length, err := h.Device.GetFeatureReport(buf) - if err != nil { - return nil, err - } - packet := buf[1:] - if h.Debug { - if length > 0 { - log.Printf("Read %v", buf) - } else { - log.Println("Read 0") - } - } - h.waitSync() - return packet, nil -} - -// Request sends a request to the device. -func (h *Handle) Request(payload []byte, count int) ([]byte, error) { - var resp []byte - var err error - for i := 0; i < RequestRetries; i++ { - if h.Debug { - log.Println("Read attempt", i+1) - } - resp, err = h.tryRequest(payload, count) - if len(resp) > 0 && resp[0] != 0 { - return resp, nil - } - } - if err != nil { - return resp, err - } - return resp, ErrNotFound -} - -// Close device handle. -// The function should be called after the end of operation with the device. -func (h *Handle) Close() error { - return h.Device.Close() -} - -func (h *Handle) tryRequest(payload []byte, count int) ([]byte, error) { - err := h.Send(payload) - if err != nil { - return nil, err - } - return h.Read(count) -} - -func (h *Handle) waitSync() { - time.Sleep(time.Millisecond * 50) -} - -// OpenHandle opens a connection to the device -func OpenHandle() (*Handle, error) { - var h Handle - var path string - err := hid.Enumerate(0x05AC, 0x024F, func(info *hid.DeviceInfo) error { - if info.Usage == 1 && info.UsagePage == 0xFF00 { - path = info.Path - } - return nil - }) - if err != nil { - return nil, err - } - if len(path) == 0 { - return &h, ErrNotFound - } - - device, err := hid.OpenPath(path) - if err != nil { - return &h, err - } - h.Device = device - return &h, nil -} diff --git a/lib/pkg/hid/lifecycle.go b/lib/pkg/hid/lifecycle.go deleted file mode 100644 index 935ec7bf..00000000 --- a/lib/pkg/hid/lifecycle.go +++ /dev/null @@ -1,19 +0,0 @@ -package hid - -import "github.com/sstallion/go-hid" - -// Init initializes the nuga package. -// This function MUST be called before starting with devices. -func Init() error { - err := hid.Init() - if err != nil { - return err - } - return nil -} - -// Exit finalizes the nuga package. -// This function should be called after all device handles have been closed to avoid memory leaks. -func Exit() error { - return hid.Exit() -} diff --git a/lib/pkg/hid/types.go b/lib/pkg/hid/types.go deleted file mode 100644 index 1ff4fe05..00000000 --- a/lib/pkg/hid/types.go +++ /dev/null @@ -1,8 +0,0 @@ -package hid - -// DeviceInfo represents keyboard handle information -type DeviceInfo struct { - Name string - Firmware string - Path string -} diff --git a/lib/pkg/hid/version.go b/lib/pkg/hid/version.go deleted file mode 100644 index e11096f5..00000000 --- a/lib/pkg/hid/version.go +++ /dev/null @@ -1,15 +0,0 @@ -package hid - -import "strconv" - -func formatVersion(v uint16) string { - symbols := strconv.FormatInt(int64(v), 16) - version := "" - for i := range symbols { - version += string(symbols[i]) - if i != len(symbols)-1 { - version += "." - } - } - return version -} diff --git a/lib/pkg/light/colors.go b/lib/pkg/light/colors.go deleted file mode 100644 index e14ec095..00000000 --- a/lib/pkg/light/colors.go +++ /dev/null @@ -1,111 +0,0 @@ -// Package light contains set of utils to work with keyboard. -package light - -import ( - "log" - "nuga/pkg/color" -) - -// ModesCount represents modes count per OS mode -const ModesCount = 24 - -// ColorState represents keyboard color state. -type ColorState [ModesCount * 2][7]color.RGB - -// Bytes converts color state to raw byte slice. -func (s *ColorState) Bytes() []byte { - var buf = make([]byte, 0) - var c color.RGB - for effect := range s { - for i := range s[effect] { - c = s[effect][i] - buf = append(buf, c.R, c.G, c.B) - } - } - buf = append(buf, ColorsSuffix...) - return buf -} - -// Print logs color state. -func (s *ColorState) Print() { - for i := range s { - log.Println(s[i]) - } -} - -// Slice returns colors as slice -func (s *ColorState) Slice() [][]color.RGB { - return s.toSlice(s[:]) -} - -// Set color to state. -func (s *ColorState) Set(rawIndex int, index int, c color.RGB) { - s[rawIndex][index] = c -} - -// SetBacklight color to state. -func (s *ColorState) SetBacklight(m uint8, i uint8, c color.RGB) { - s[m][i] = c -} - -// SetMacBacklight color to state. -func (s *ColorState) SetMacBacklight(m uint8, i uint8, c color.RGB) { - s.SetBacklight(m+ModesCount, i, c) -} - -// SetWinBacklight color to state. -func (s *ColorState) SetWinBacklight(m uint8, i uint8, c color.RGB) { - s.SetBacklight(m, i, c) -} - -// Get color from state. -func (s *ColorState) Get(effect uint8, index uint8) color.RGB { - return s[effect][index] -} - -// GetMac returns colors for mac OS mode. -func (s *ColorState) GetMac() [][]color.RGB { - return s.toSlice(s[ModesCount : ModesCount*2]) -} - -// GetWin returns colors for win OS mode. -func (s *ColorState) GetWin() [][]color.RGB { - return s.toSlice(s[0:ModesCount]) -} - -func (s *ColorState) toSlice(modes [][7]color.RGB) [][]color.RGB { - result := make([][]color.RGB, len(modes)) - for i, colors := range modes { - result[i] = make([]color.RGB, 7) - copy(result[i], colors[:]) - } - return result -} - -// ParseColors parses the raw byte slice into ColorState. -func ParseColors(data []byte) *ColorState { - var state ColorState - var offset int - for effect := 0; effect < 48; effect++ { - for i := 0; i < 7; i++ { - offset = (effect * 21) + (i * 3) - state[effect][i] = color.RGB{ - R: data[offset], - G: data[offset+1], - B: data[offset+2], - } - } - } - return &state -} - -// ColorsFromSlice loads color state from colors slice -func ColorsFromSlice(modes [][]color.RGB) *ColorState { - var state ColorState - for effect := 0; effect < 48; effect++ { - for i := 0; i < 7; i++ { - state[effect][i] = modes[effect][i] - } - } - return &state -} diff --git a/lib/pkg/light/constants.go b/lib/pkg/light/constants.go deleted file mode 100644 index 43b45d54..00000000 --- a/lib/pkg/light/constants.go +++ /dev/null @@ -1,53 +0,0 @@ -package light - -// ParamsLength represents Halo75 params count. -const ParamsLength = 123 - -// ColorOffset represents Halo75 color start offset. -const ColorOffset = 22 - -// CmdGetParams represents keyboard params reading command. -var CmdGetParams = []byte{ - 0x05, 0x83, 0xb6, 0x00, 0x00, 0x00, -} - -// CmdSetParams represents keyboard params writing command header. -var CmdSetParams = []byte{ - 0x06, 0x03, 0xb6, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a, 0xa5, -} - -// CmdGetColors represents keyboard color reading command. -var CmdGetColors = []byte{ - 0x05, 0x88, 0xb8, 0x00, 0x00, 0x00, -} - -// CmdSetColors represents keyboard color writing command header. -var CmdSetColors = []byte{ - 0x06, 0x08, 0xb8, 0x00, 0x40, 0x00, 0x00, 0x00, -} - -// ParamsHeader represents keyboard params header. -var ParamsHeader = []byte{ - 0x03, 0x03, 0x03, 0x00, 0x00, -} - -// ParamsMiscHeader represents keyboard misc params header. -var ParamsMiscHeader = []byte{ - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, -} - -// ParamsSuffix represents keyboard params suffix. -var ParamsSuffix = []byte{ - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x5A, 0xA5, -} - -// ColorsSuffix represents keyboard params suffix. -var ColorsSuffix = []byte{ - 0x90, 0x0E, 0xBF, 0xEF, 0xF0, 0xC2, 0x05, 0xE4, 0xA3, 0xF0, - 0xE4, 0x90, 0x0E, 0xC1, 0xF0, 0x90, -} diff --git a/lib/pkg/light/controller-k916.go b/lib/pkg/light/controller-k916.go deleted file mode 100644 index 66419948..00000000 --- a/lib/pkg/light/controller-k916.go +++ /dev/null @@ -1,136 +0,0 @@ -package light - -import ( - "nuga/pkg/color" - "nuga/pkg/hid" -) - -// K916Controller represents NuPhy BYK916 keyboard lights controller. -type K916Controller struct { - Handle *hid.Handle -} - -// GetPath returns keyboard path. -func (d *K916Controller) GetPath() (string, error) { - info, err := d.Handle.Device.GetDeviceInfo() - if err != nil { - return "", err - } - return info.Path, nil -} - -// GetRawEffects returns raw effects data. -func (d *K916Controller) GetRawEffects() ([]byte, error) { - response, err := d.Handle.Request(CmdGetParams, 270) - if err != nil { - return []byte{}, err - } - return response, nil -} - -// GetEffectsBuffer returns trimmed effects buffer. -func (d *K916Controller) GetEffectsBuffer() ([]byte, error) { - raw, err := d.GetRawEffects() - if err != nil { - return []byte{}, err - } - startOffset := 15 - return raw[startOffset : startOffset+ParamsLength], nil -} - -// GetEffects returns keyboard effects. -func (d *K916Controller) GetEffects() (*Effects, error) { - params, err := d.GetEffectsBuffer() - if err != nil { - return nil, err - } - effects := ParseParams(params) - return effects, err -} - -// GetRawColors returns raw keyboard colors. -func (d *K916Controller) GetRawColors() ([]byte, error) { - var colors []byte - colors, err := d.Handle.Request(CmdGetColors, 1050) - if err != nil { - return colors, err - } - return colors, err -} - -// GetColors returns keyboard colors state. -func (d *K916Controller) GetColors() (*ColorState, error) { - raw, err := d.GetRawColors() - if err != nil { - return nil, err - } - colorSubset := raw[7 : len(raw)-18] - return ParseColors(colorSubset), err -} - -// SetColors sets keyboard color state. -func (d *K916Controller) SetColors(c *ColorState) error { - request := make([]byte, 0) - request = append(request, CmdSetColors...) - request = append(request, c.Bytes()...) - return d.Handle.SendWithRetries(request) -} - -// ResetColors resets colors to defaults. -func (d *K916Controller) ResetColors() error { - var state ColorState - for i := range state { - state[i][0] = color.Red - state[i][1] = color.Green - state[i][2] = color.Blue - state[i][3] = color.Yellow - state[i][4] = color.Purple - state[i][5] = color.Cyan - state[i][6] = color.White - } - return d.SetColors(&state) -} - -// SetEffects sets keyboard effects. -func (d *K916Controller) SetEffects(p *Effects) error { - currentParams, err := d.GetEffectsBuffer() - if err != nil { - return err - } - paramsRequest := make([]byte, 0) - paramsRequest = append(paramsRequest, CmdSetParams...) - paramsRequest = append(paramsRequest, p.Bytes()...) - paramsRequest = append(paramsRequest, currentParams...) - paramsRequest = append(paramsRequest, make([]byte, 770)...) - return d.Handle.SendWithRetries(paramsRequest) -} - -// OpenK916 opens BYK916 NuPhy keyboard lights. -func OpenK916(handle *hid.Handle) Controller { - var lights Controller = &K916Controller{ - Handle: handle, - } - return lights -} - -// // OpenHardware opens real keyboard lights. -// func OpenHardware() (*HardwareController, error) { -// var d HardwareController -// handle, err := hid.OpenHandle() -// if err != nil { -// return nil, err -// } -// d.Handle = handle -// return &d, nil -// } - -// // Open hardware keyboard lights as Lights. -// func Open() (Controller, error) { -// var lights Controller -// h, err := OpenHardware() -// if err != nil { -// return nil, err -// } -// lights = h -// return lights, nil -// } diff --git a/lib/pkg/light/controller-simulation.go b/lib/pkg/light/controller-simulation.go deleted file mode 100644 index e829b55a..00000000 --- a/lib/pkg/light/controller-simulation.go +++ /dev/null @@ -1,72 +0,0 @@ -package light - -// SimulationTemplate represents simulation data. -type SimulationTemplate struct { - Colors []int - Params []int - Name string -} - -// ControllerSimulation represents simulated light. -type ControllerSimulation struct { - template SimulationTemplate - effects *Effects - colors *ColorState -} - -func (d *ControllerSimulation) setupEffects() { - startOffset := 15 - paramsSubset := d.template.Params[startOffset : startOffset+ParamsLength] - effects := ParseParams( - intToBytes(paramsSubset), - ) - d.effects = effects -} - -func (d *ControllerSimulation) setupColors() { - colorSubset := d.template.Colors[7 : len(d.template.Colors)-18] - d.colors = ParseColors( - intToBytes(colorSubset), - ) -} - -// GetEffects returns current simulated effect. -func (d *ControllerSimulation) GetEffects() (*Effects, error) { - return d.effects, nil -} - -// SetEffects sets current simulated effect. -func (d *ControllerSimulation) SetEffects(p *Effects) error { - d.effects = p - return nil -} - -// GetColors returns current simulated color. -func (d *ControllerSimulation) GetColors() (*ColorState, error) { - return d.colors, nil -} - -// SetColors sets current simulated color. -func (d *ControllerSimulation) SetColors(c *ColorState) error { - d.colors = c - return nil -} - -// OpenSimulation returns simulated light from template. -func OpenSimulation(t SimulationTemplate) Controller { - var lights Controller - var d ControllerSimulation - d.template = t - d.setupEffects() - d.setupColors() - lights = &d - return lights -} - -func intToBytes(v []int) []byte { - bytes := make([]byte, len(v)) - for i := range v { - bytes[i] = byte(v[i]) - } - return bytes -} diff --git a/lib/pkg/light/controller.go b/lib/pkg/light/controller.go deleted file mode 100644 index 6c3979f7..00000000 --- a/lib/pkg/light/controller.go +++ /dev/null @@ -1,9 +0,0 @@ -package light - -// Controller is the basic interface that all light sources must implement -type Controller interface { - GetEffects() (*Effects, error) - SetEffects(p *Effects) error - GetColors() (*ColorState, error) - SetColors(c *ColorState) error -} diff --git a/lib/pkg/light/effect-backlight.go b/lib/pkg/light/effect-backlight.go deleted file mode 100644 index 8f4bbab6..00000000 --- a/lib/pkg/light/effect-backlight.go +++ /dev/null @@ -1,60 +0,0 @@ -package light - -import "nuga/pkg/light/effect" - -// BacklightEffect represents keyboard backlight effect state. -type BacklightEffect struct { - Mode *effect.Mode `json:"mode"` - Params []EffectParams `json:"params"` -} - -// CurrentParams returns current effect params. -func (p *BacklightEffect) CurrentParams() *EffectParams { - code := p.Mode.Code - if code == 0 { - return nil - } - return &p.Params[code-1] -} - -// SetBrightness sets current effect brightness. -func (p *BacklightEffect) SetBrightness(brightness uint8) error { - if p.Mode.Code == 0 { - return ErrLightsOff - } - if brightness > 4 { - return ErrOutOfRange - } - p.CurrentParams().Brightness = brightness - return nil -} - -// SetSpeed sets current effect speed. -func (p *BacklightEffect) SetSpeed(speed uint8) error { - if p.Mode.Code == 0 { - return ErrLightsOff - } - if !p.Mode.Features.IsSet(effect.Speed) { - return ErrNotSupported - } - if speed > 4 { - return ErrOutOfRange - } - p.CurrentParams().Speed = speed - return nil -} - -// SetColor sets current effect color. -func (p *BacklightEffect) SetColor(color uint8) error { - if p.Mode.Code == 0 { - return ErrLightsOff - } - if !p.Mode.Features.IsSetAny(effect.SpecificColor, effect.RandomColor) { - return ErrNotSupported - } - if color == 7 && !p.Mode.Features.IsSet(effect.RandomColor) { - return ErrNotSupported - } - p.CurrentParams().Color = color - return nil -} diff --git a/lib/pkg/light/effect-misc.go b/lib/pkg/light/effect-misc.go deleted file mode 100644 index 896f6f97..00000000 --- a/lib/pkg/light/effect-misc.go +++ /dev/null @@ -1,49 +0,0 @@ -package light - -import "nuga/pkg/light/effect" - -// MiscEffect represents a non-main light, e.g. Halolight. -type MiscEffect struct { - Mode *effect.Mode `json:"mode"` - EffectParams -} - -// SetBrightness of misc effect. -func (p *MiscEffect) SetBrightness(brightness uint8) error { - if p.Mode.Code == 0 { - return ErrLightsOff - } - if brightness > 4 { - return ErrOutOfRange - } - p.Brightness = brightness - return nil -} - -// SetSpeed of misc effect. -func (p *MiscEffect) SetSpeed(speed uint8) error { - if p.Mode.Code == 0 { - return ErrLightsOff - } - if !p.Mode.Features.IsSet(effect.Speed) { - return ErrNotSupported - } - if speed > 4 { - return ErrOutOfRange - } - p.Speed = speed - return nil -} - -// SetColor of misc effect. -func (p *MiscEffect) SetColor(color uint8) error { - if !p.Mode.Features.IsSet(effect.SpecificColor) { - return ErrNotSupported - } - // 6, not 7, because the extra lights do not support random colors - if color > 6 { - return ErrOutOfRange - } - p.Color = color - return nil -} diff --git a/lib/pkg/light/effect/backlight.go b/lib/pkg/light/effect/backlight.go deleted file mode 100644 index ffa19f85..00000000 --- a/lib/pkg/light/effect/backlight.go +++ /dev/null @@ -1,141 +0,0 @@ -// Package effect contains presets of keyboard light effects -package effect - -var ( - // BacklightOff represents keyboard backlight off mode. - BacklightOff = Mode{ - "Lights off", - 0, - 0, - } - // BacklightStatic represents keyboard backlight fixed mode. - BacklightStatic = Mode{ - "Static", - 1, - SpecificColor | RandomColor, - } - // BacklightRespire represents keyboard backlight respire mode. - BacklightRespire = Mode{ - "Respire", - 2, - SpecificColor | RandomColor | Speed, - } - // BacklightRainbow represents keyboard backlight rainbow mode. - BacklightRainbow = Mode{ - "Rainbow", - 3, - Speed, - } - // BacklightFlashAway represents keyboard backlight flash away mode. - BacklightFlashAway = Mode{ - "Flash away", - 4, - SpecificColor | RandomColor | Speed, - } - // RaindropsBacklightMode = Mode{ - // "Raindrops", - // 5, - // SpecificColor | RandomColor | Speed, - // } - - // BacklightRainbowWheel represents keyboard backlight rainbow wheel mode. - BacklightRainbowWheel = Mode{ - "Rainbow wheel", - 6, - SpecificColor | RandomColor | Speed, - } - // BacklightRipplesShining represents keyboard backlight ripples shining mode. - BacklightRipplesShining = Mode{ - "Ripples shining", - 7, - SpecificColor | RandomColor | Speed, - } - // BacklightStarsTwinkle represents keyboard backlight ripples shining mode. - BacklightStarsTwinkle = Mode{ - "Stars twinkle", - 8, - SpecificColor | RandomColor | Speed, - } - // ShadowDisappearBacklightMode = Mode{ - // "Shadow disappear", - // 9, - // SpecificColor | RandomColor | Speed, - // } - - // RetroSnakeBacklightMode = Mode{ - // "Retro snake", - // 10, - // SpecificColor | RandomColor | Speed, - // } - - // BacklightNeonStream represents keyboard backlight neon stream mode. - BacklightNeonStream = Mode{ - "Neon stream", - 11, - SpecificColor | RandomColor | Speed, - } - // BacklightReaction represents keyboard backlight reaction mode. - BacklightReaction = Mode{ - "Reaction", - 12, - SpecificColor | RandomColor | Speed, - } - // BacklightSineWave represents keyboard backlight sine wave mode. - BacklightSineWave = Mode{ - "Sine wave", - 13, - SpecificColor | RandomColor | Speed, - } - // RetinueScanningBacklightMode = Mode{ - // "Retinue scanning", - // 14, - // SpecificColor | RandomColor | Speed, - // } - - // BacklightRotatingWindmill represents keyboard backlight rotating windmill mode. - BacklightRotatingWindmill = Mode{ - "Rotating windmill", - 15, - Speed, - } - // BacklightColorfulWaterfall represents keyboard backlight colorful waterfall mode. - BacklightColorfulWaterfall = Mode{ - "Colorful waterfall", - 16, - Speed, - } - // BacklightBlossoming represents keyboard backlight blossoming mode. - BacklightBlossoming = Mode{ - "Blossoming", - 17, - Speed, - } - // BacklightCustom represents keyboard backlight game mode. - BacklightCustom = Mode{ - "Custom", - 18, - 0, - } -) - -// Backlight is a list of backlight effects. -var Backlight = Domain{ - Name: "Backlight", - Modes: []Mode{ - BacklightOff, - BacklightStatic, - BacklightRespire, - BacklightRainbow, - BacklightFlashAway, - BacklightRainbowWheel, - BacklightRipplesShining, - BacklightStarsTwinkle, - BacklightNeonStream, - BacklightReaction, - BacklightSineWave, - BacklightRotatingWindmill, - BacklightColorfulWaterfall, - BacklightBlossoming, - BacklightCustom, - }, -} diff --git a/lib/pkg/light/effect/domain.go b/lib/pkg/light/effect/domain.go deleted file mode 100644 index e26af242..00000000 --- a/lib/pkg/light/effect/domain.go +++ /dev/null @@ -1,17 +0,0 @@ -package effect - -// Domain is a type of keyboard lights with its mode -type Domain struct { - Name string `json:"name"` - Modes []Mode `json:"modes"` -} - -// Find mode in list. Returns nil if not found -func (d *Domain) Find(code byte) *Mode { - for i := range d.Modes { - if d.Modes[i].Code == code { - return &d.Modes[i] - } - } - return nil -} diff --git a/lib/pkg/light/effect/feature.go b/lib/pkg/light/effect/feature.go deleted file mode 100644 index 3d33dd76..00000000 --- a/lib/pkg/light/effect/feature.go +++ /dev/null @@ -1,14 +0,0 @@ -package effect - -import ( - "nuga/pkg/bit" -) - -const ( - // SpecificColor flag indicates that mode supports specific color. - SpecificColor bit.Mask = 1 << iota - // RandomColor flag indicates that mode supports random color - RandomColor bit.Mask = 2 << iota - // Speed flag indicates that mode supports speed. - Speed bit.Mask = 4 << iota -) diff --git a/lib/pkg/light/effect/halolight.go b/lib/pkg/light/effect/halolight.go deleted file mode 100644 index fc649a2a..00000000 --- a/lib/pkg/light/effect/halolight.go +++ /dev/null @@ -1,46 +0,0 @@ -package effect - -var ( - // HalolightOff represents keyboard halolight off mode. - HalolightOff = Mode{ - "Lights off", - 0, - 0, - } - // HalolightRainbowWheel represents keyboard halolight rainbow wheel mode. - HalolightRainbowWheel = Mode{ - "Rainbow wheel", - 1, - Speed | RandomColor, - } - // HalolightRainbow represents keyboard halolight rainbow mode. - HalolightRainbow = Mode{ - "Rainbow", - 2, - Speed | RandomColor, - } - // HalolightFixed represents keyboard halolight fixed mode. - HalolightFixed = Mode{ - "Fixed", - 3, - SpecificColor, - } - // HalolightRespire represents keyboard halolight respire mode. - HalolightRespire = Mode{ - "Respire", - 4, - SpecificColor | Speed, - } -) - -// Halo is a domain for halolight effects. -var Halo = Domain{ - Name: "Halo", - Modes: []Mode{ - HalolightOff, - HalolightRainbowWheel, - HalolightRainbow, - HalolightFixed, - HalolightRespire, - }, -} diff --git a/lib/pkg/light/effect/mode.go b/lib/pkg/light/effect/mode.go deleted file mode 100644 index 9ea21251..00000000 --- a/lib/pkg/light/effect/mode.go +++ /dev/null @@ -1,10 +0,0 @@ -package effect - -import "nuga/pkg/bit" - -// Mode represents keyboard light mode -type Mode struct { - Name string `json:"name"` - Code byte `json:"code"` - Features bit.Mask `json:"features"` -} diff --git a/lib/pkg/light/effect/sidelight.go b/lib/pkg/light/effect/sidelight.go deleted file mode 100644 index 1a6fe3e8..00000000 --- a/lib/pkg/light/effect/sidelight.go +++ /dev/null @@ -1,53 +0,0 @@ -package effect - -var ( - // SidelightOff represents keyboard sidelight off mode. - SidelightOff = Mode{ - "Lights off", - 0, - 0, - } - // SidelightRainbowStream represents keyboard sidelight rainbow stream mode. - SidelightRainbowStream = Mode{ - "Rainbow stream", - 1, - Speed | RandomColor, - } - // SidelightRainbow represents keyboard sidelight rainbow mode. - SidelightRainbow = Mode{ - "Rainbow", - 2, - Speed | RandomColor, - } - // SidelightFixed represents keyboard sidelight fixed mode. - SidelightFixed = Mode{ - "Fixed on", - 3, - SpecificColor, - } - // SidelightRespire represents keyboard sidelight respire mode. - SidelightRespire = Mode{ - "Respire", - 4, - SpecificColor | Speed, - } - // SidelightNeonStream represents keyboard sidelight neon stream mode. - SidelightNeonStream = Mode{ - "Neon stream", - 5, - Speed | RandomColor, - } -) - -// Sidelight is a domain for sidelight effects. -var Sidelight = Domain{ - Name: "Sidelight", - Modes: []Mode{ - SidelightOff, - SidelightRainbowStream, - SidelightRainbow, - SidelightFixed, - SidelightRespire, - SidelightNeonStream, - }, -} diff --git a/lib/pkg/light/errors.go b/lib/pkg/light/errors.go deleted file mode 100644 index ab27611b..00000000 --- a/lib/pkg/light/errors.go +++ /dev/null @@ -1,12 +0,0 @@ -package light - -import "errors" - -// ErrLightsOff is returned when the user tries to perform an action with the light off. -var ErrLightsOff = errors.New("this action cannot be performed when the lights are off") - -// ErrNotSupported is returned when the user tries to change a property that is not supported by the effect. -var ErrNotSupported = errors.New("current light mode does not support changing this property") - -// ErrOutOfRange is returned when the value transmitted by the user is outside the permitted limit. -var ErrOutOfRange = errors.New("passed value is outside the permitted limits") diff --git a/lib/pkg/light/params.go b/lib/pkg/light/params.go deleted file mode 100644 index 5ff0fa38..00000000 --- a/lib/pkg/light/params.go +++ /dev/null @@ -1,79 +0,0 @@ -package light - -import ( - "math" - "nuga/pkg/light/effect" -) - -// EffectParams represents keyboard effect parameters. -type EffectParams struct { - // Color represents effect color. Number from 0 to 7 - Color uint8 `json:"color"` - // Speed represents effect speed. Number from 0 to 4 - Speed uint8 `json:"speed"` - // Speed represents effect speed. Number from 0 to 4 - Brightness uint8 `json:"brightness"` -} - -// Effects represents keyboard effects state. -type Effects struct { - Backlight BacklightEffect `json:"backlight"` - Sidelight MiscEffect `json:"sidelight"` - Halo MiscEffect `json:"halo"` -} - -// Bytes returns effects as a raw byte slice. -func (b *Effects) Bytes() []byte { - buf := make([]byte, 0) - buf = append(buf, ParamsHeader...) - buf = append(buf, b.Backlight.Mode.Code) - buf = append(buf, ParamsMiscHeader...) - buf = append( - buf, - b.Sidelight.Mode.Code, - b.Sidelight.Color, - b.Sidelight.Brightness, - b.Sidelight.Speed, - ) - buf = append( - buf, - b.Halo.Mode.Code, - b.Halo.Color, - b.Halo.Brightness, - b.Halo.Speed, - ) - buf = append(buf, 0xFF, 0xFF) - for _, param := range b.Backlight.Params { - value := (param.Speed * 16) + param.Brightness - buf = append(buf, param.Color, value) - } - buf = append(buf, ParamsSuffix...) - return buf -} - -// ParseParams parses raw bytes to effects struct. -func ParseParams(data []byte) *Effects { - result := &Effects{} - var offset int - var value uint8 - result.Halo.Mode = effect.Halo.Find(data[16]) - result.Halo.Color = data[17] - result.Halo.Brightness = data[18] - result.Halo.Speed = data[19] - result.Sidelight.Mode = effect.Sidelight.Find(data[12]) - result.Sidelight.Color = data[13] - result.Sidelight.Brightness = data[14] - result.Sidelight.Speed = data[15] - result.Backlight.Mode = effect.Backlight.Find(data[5]) - result.Backlight.Params = make([]EffectParams, 29) - for i := range result.Backlight.Params { - offset = ColorOffset + (i * 2) - value = data[offset+1] - result.Backlight.Params[i] = EffectParams{ - Color: data[offset], - Speed: uint8(math.Floor(float64(value) / 16)), - Brightness: value % 16, - } - } - return result -} diff --git a/app/main.go b/main.go similarity index 83% rename from app/main.go rename to main.go index 1e63fc65..9cfc1036 100644 --- a/app/main.go +++ b/main.go @@ -11,6 +11,12 @@ import ( "path" ) +// AppVersion represents current executable version +var AppVersion = "dev" + +// AppName represents app name +var AppName = "Nuga" + //go:embed all:frontend/dist var assets embed.FS diff --git a/app/Makefile b/makefiles/appdir.mk similarity index 100% rename from app/Makefile rename to makefiles/appdir.mk diff --git a/makefiles/build.mk b/makefiles/build.mk index d3f8c600..86d373ba 100644 --- a/makefiles/build.mk +++ b/makefiles/build.mk @@ -1,5 +1,5 @@ # Nuga build Makefile targets -BUILD_PATH = app/build/bin +BUILD_PATH = build/bin PLATFORMS_DARWIN = darwin/amd64,darwin/arm64 LD_FLAGS = -X 'nuga_ui/internal/nuga.AppVersion=v$(VERSION)' -s -w @@ -49,7 +49,3 @@ build/release: release/darwin: mv "$(DIST_PATH)/Nuga-arm64.zip" "$(DIST_PATH)/Nuga-$(VERSION)-mac-arm64.zip" mv "$(DIST_PATH)/Nuga-amd64.zip" "$(DIST_PATH)/Nuga-$(VERSION)-mac-amd64.zip" - -.PHONY: build/dumper -build/dumper: - go build -o dist/k916-dumper utils/k916-dumper/main.go diff --git a/makefiles/dev.mk b/makefiles/dev.mk index 516071d3..8c6e19b5 100644 --- a/makefiles/dev.mk +++ b/makefiles/dev.mk @@ -2,14 +2,3 @@ .PHONY: dev dev: cd app; wails dev -loglevel Debug -v 2 - -.PHONY: dev-memtest -dev-memtest: - cd app; wails dev -tags memtest -loglevel Debug -v 2 - -.PHONY: memtest-view -memtest-view: - go tool pprof \ - -http=:8081 \ - -alloc_space \ - http://localhost:8080/debug/pprof/heap diff --git a/makefiles/linux-builder.mk b/makefiles/linux-builder.mk index d5867f91..bd3e2ab7 100644 --- a/makefiles/linux-builder.mk +++ b/makefiles/linux-builder.mk @@ -4,7 +4,7 @@ APPIMAGE_BUILDER_IMAGE = mishamyrt/nuga-appimage-builder # Wails builder functions define build_builder - cd app/build/linux; docker buildx build \ + cd build/linux; docker buildx build \ --file wails.Dockerfile \ --load \ --platform "linux/$(1)" \ @@ -28,14 +28,14 @@ define build_binary endef define copy_appimage - cp "app/build/bin/Nuga-latest-$(1).AppImage" "$(DIST_PATH)/Nuga-$(VERSION)-$(2).AppImage" + cp "build/bin/Nuga-latest-$(1).AppImage" "$(DIST_PATH)/Nuga-$(VERSION)-$(2).AppImage" endef # AppImage builder .PHONY: linux-builder/image-appimage linux-builder/image-appimage: - cd app/build/linux; docker buildx build \ + cd build/linux; docker buildx build \ --file appimage.Dockerfile \ --load \ --platform "linux/amd64" \ @@ -70,12 +70,12 @@ linux-builder/push-image-amd64: .PHONY: linux-builder/binary-arm64 linux-builder/binary-arm64: $(DIST_PATH) $(call build_binary,arm64) - mv app/build/bin/Nuga-linux-aarch64 dist/Nuga-linux-arm64 + mv build/bin/Nuga-linux-aarch64 dist/Nuga-linux-arm64 .PHONY: linux-builder/binary-amd64 linux-builder/binary-amd64: $(call build_binary,amd64) - mv app/build/bin/Nuga-linux-x86_64 dist/Nuga-linux-amd64 + mv build/bin/Nuga-linux-x86_64 dist/Nuga-linux-amd64 .PHONY: linux-builder/binary linux-builder/binary: diff --git a/makefiles/qa.mk b/makefiles/qa.mk index 5b98ca7a..0a64ccb8 100644 --- a/makefiles/qa.mk +++ b/makefiles/qa.mk @@ -1,18 +1,15 @@ -define go_lint - golangci-lint run ./$(1)/... - revive -config ./revive.toml ./$(1)/... -endef +GOLANGCI_LINT_VERSION = v1.55.2 +REVIVE_VERSION = v1.3.4 + +.PHONY: setup-qa +setup-qa: + curl -sSfL \ + https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \ + | sh -s -- -b $(GO_BIN_PATH) $(GOLANGCI_LINT_VERSION) + go install github.com/mgechev/revive@$(REVIVE_VERSION) .PHONY: lint lint: - make lint-lib - make lint-app - -.PHONY: lint-lib -lint-lib: - $(call go_lint,lib) + golangci-lint run ./... + revive -config ./revive.toml ./... -.PHONY: lint-app -lint-app: - $(call go_lint,app) - cd app/frontend; pnpm run lint diff --git a/app/pkg/github/api.go b/pkg/github/api.go similarity index 100% rename from app/pkg/github/api.go rename to pkg/github/api.go diff --git a/app/pkg/github/repo.go b/pkg/github/repo.go similarity index 100% rename from app/pkg/github/repo.go rename to pkg/github/repo.go diff --git a/resources/simulations/halo65.json b/resources/simulations/halo65.json deleted file mode 100644 index 84dc8085..00000000 --- a/resources/simulations/halo65.json +++ /dev/null @@ -1 +0,0 @@ -{"Colors":[136,0,0,0,0,0,0,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,64,1,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"Params":[131,182,0,0,0,0,0,0,0,0,0,0,0,90,165,3,3,3,0,0,0,32,1,0,0,0,0,0,1,2,0,0,0,4,0,255,255,7,68,7,68,0,68,0,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,4,4,4,4,3,4,4,4,4,4,0,0,0,0,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,90,165,3,3,3,0,0,0,32,1,0,0,0,0,0,1,2,0,0,0,4,0,255,255,7,68,7,68,0,68,0,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,4,4,4,4,3,4,4,4,4,4,0,0,0,0,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,90,165,0,0,0,0,0,0,0,0],"Name":"NuPhy Halo65"} \ No newline at end of file diff --git a/resources/simulations/halo75.json b/resources/simulations/halo75.json deleted file mode 100644 index 36f55d3e..00000000 --- a/resources/simulations/halo75.json +++ /dev/null @@ -1 +0,0 @@ -{"Colors":[136,0,0,0,0,0,0,0,255,255,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,0,255,255,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,144,14,191,239,240,194,5,228,163,240,228,144,14,193,240,144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"Params":[131,182,0,0,0,0,0,1,0,0,0,0,0,90,165,3,3,3,0,0,2,32,0,0,0,0,0,3,5,4,2,0,4,4,2,255,255,1,68,3,20,7,68,7,34,7,68,7,34,7,68,3,68,7,68,7,68,7,68,7,68,7,68,7,68,7,36,255,255,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,4,4,4,4,4,4,4,4,4,4,0,0,0,0,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,90,165,3,3,3,0,0,2,32,0,0,0,0,0,3,5,4,2,0,4,4,2,255,255,1,68,3,20,7,68,7,34,7,68,7,34,7,68,3,68,7,68,7,68,7,68,7,68,7,68,7,68,7,36,255,255,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,4,4,4,4,4,4,4,4,4,4,0,0,0,0,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,90,165,0,0,0,0,0,0,0,0],"Name":"NuPhy Halo75"} \ No newline at end of file diff --git a/resources/simulations/halo96.json b/resources/simulations/halo96.json deleted file mode 100644 index 492547ef..00000000 --- a/resources/simulations/halo96.json +++ /dev/null @@ -1 +0,0 @@ -{"Colors":[136,0,0,0,0,0,0,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,0,255,0,255,0,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,255,255,255,255,255,144,14,192,239,240,194,5,228,163,240,228,144,14,194,240,144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"Params":[131,182,0,0,0,0,0,0,0,0,0,0,0,90,165,3,3,3,0,0,12,32,0,0,0,0,0,5,0,4,0,0,0,4,0,255,255,0,68,7,68,0,68,7,68,7,68,0,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,4,4,4,4,4,4,4,4,4,4,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,90,165,3,3,3,0,0,12,32,0,0,0,0,0,5,0,4,0,0,0,4,0,255,255,0,68,7,68,0,68,7,68,7,68,0,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,7,68,4,4,4,4,4,4,4,4,4,4,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,90,165,0,0,0,0,0,0,0,0],"Name":"NuPhy Halo96"} \ No newline at end of file diff --git a/utils/k916-dumper/main.go b/utils/k916-dumper/main.go deleted file mode 100644 index b5c8d7f5..00000000 --- a/utils/k916-dumper/main.go +++ /dev/null @@ -1,71 +0,0 @@ -package main - -import ( - "encoding/json" - "fmt" - "io/ioutil" - "log" - "nuga/pkg/hid" - "nuga/pkg/light" - "os" -) - -type ProtocolDump struct { - Colors []int - Params []int - Name string -} - -func formatDump(colors []byte, params []byte, name string) (string, error) { - var dump ProtocolDump - dump.Name = name - dump.Colors = make([]int, len(colors)) - dump.Params = make([]int, len(params)) - for i := range colors { - dump.Colors[i] = int(colors[i]) - } - for i := range params { - dump.Params[i] = int(params[i]) - } - content, err := json.Marshal(dump) - if err != nil { - return "", err - } - return string(content), nil -} - -func main() { - if len(os.Args) < 2 { - fmt.Println("Output path not provided") - fmt.Println("Usage: nudumper ") - os.Exit(1) - } - outFile := os.Args[1] - handle, err := hid.OpenHandle() - if err != nil { - log.Panicf("Couldn't open HID handle: %v", err) - } - k := light.K916Controller{ - Handle: handle, - } - params, err := k.GetRawEffects() - if err != nil { - log.Panicf("Couldn't read params: %v", err) - } - name, err := k.Handle.Device.GetProductStr() - if err != nil { - log.Panicf("Couldn't read product name: %v", err) - } - colors, err := k.GetRawColors() - if err != nil { - log.Panicf("Couldn't read colors: %v", err) - } - content, err := formatDump(colors, params, name) - if err != nil { - log.Panicf("Couldn't format dump: %v", err) - } - err = ioutil.WriteFile(outFile, []byte(content), 0655) - if err != nil { - log.Panicf("Couldn't write file: %v", err) - } -} diff --git a/app/wails.json b/wails.json similarity index 100% rename from app/wails.json rename to wails.json