diff --git a/src-overlay-sidecar/src-overlay-sidecar.sln b/src-overlay-sidecar/src-overlay-sidecar.sln new file mode 100644 index 00000000..11481d86 --- /dev/null +++ b/src-overlay-sidecar/src-overlay-sidecar.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.002.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "oyasumivr-overlay-sidecar", "oyasumivr-overlay-sidecar.csproj", "{240CFAD1-7680-4BA7-8F6B-A1D23ABBBB91}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {240CFAD1-7680-4BA7-8F6B-A1D23ABBBB91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {240CFAD1-7680-4BA7-8F6B-A1D23ABBBB91}.Debug|Any CPU.Build.0 = Debug|Any CPU + {240CFAD1-7680-4BA7-8F6B-A1D23ABBBB91}.Release|Any CPU.ActiveCfg = Release|Any CPU + {240CFAD1-7680-4BA7-8F6B-A1D23ABBBB91}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C577E4CD-0E1C-477D-9396-41D59EBF9B86} + EndGlobalSection +EndGlobal diff --git a/src-ui/app/components/cct-control-modal/cct-control-modal.component.ts b/src-ui/app/components/cct-control-modal/cct-control-modal.component.ts index ecc60889..b9f97b79 100644 --- a/src-ui/app/components/cct-control-modal/cct-control-modal.component.ts +++ b/src-ui/app/components/cct-control-modal/cct-control-modal.component.ts @@ -15,8 +15,6 @@ import { CCTControlService } from '../../services/cct-control/cct-control.servic animations: [fadeUp(), vshrink(), hshrink()], }) export class CCTControlModalComponent extends BaseModalComponent implements OnInit { - cctBounds = [1000, 10000]; - protected readonly setCCT = new Subject(); constructor( diff --git a/src-ui/app/services/overlay/overlay-state-sync.service.ts b/src-ui/app/services/overlay/overlay-state-sync.service.ts index 7bcc0bdd..8b00b5be 100644 --- a/src-ui/app/services/overlay/overlay-state-sync.service.ts +++ b/src-ui/app/services/overlay/overlay-state-sync.service.ts @@ -40,6 +40,7 @@ import { HardwareBrightnessControlService } from '../brightness-control/hardware import { SoftwareBrightnessControlService } from '../brightness-control/software-brightness-control.service'; import { SleepPreparationService } from '../sleep-preparation.service'; import { SystemMicMuteAutomationService } from '../system-mic-mute-automation.service'; +import { CCTControlService } from '../cct-control/cct-control.service'; @Injectable({ providedIn: 'root', @@ -113,6 +114,14 @@ export class OverlayStateSyncService { hardwareMinBrightness: 20, hardwareMaxBrightness: 160, }, + cctState: { + enabled: APP_SETTINGS_DEFAULT.cctControlEnabled, + value: 6600, + min: 1000, + max: 10000, + transitioning: false, + transitionTarget: 6600, + }, sleepPreparationAvailable: false, sleepPreparationTimedOut: false, systemMicMuted: false, @@ -123,6 +132,7 @@ export class OverlayStateSyncService { private vrchatService: VRChatService, private ipcService: IPCService, private automationConfig: AutomationConfigService, + private cctService: CCTControlService, private appSettings: AppSettingsService, private shutdownAutomationsService: ShutdownAutomationsService, private openvr: OpenVRService, @@ -143,6 +153,7 @@ export class OverlayStateSyncService { this.updateState_WhenOVRDevicesChange(); this.updateState_WhenAppSettingsChange(); this.updateState_WhenBrightnessStateChanges(); + this.updateState_WhenCCTStateChanges(); this.updateState_WhenSleepPreparationStateChanges(); this.updateState_WhenSystemMicMuteStateChanges(); } @@ -393,6 +404,30 @@ export class OverlayStateSyncService { }); } + private updateState_WhenCCTStateChanges() { + this.appSettings.settings + .pipe( + map((settings) => settings.cctControlEnabled), + distinctUntilChanged() + ) + .subscribe((enabled) => { + const state = structuredClone(this.state.value); + state.cctState!.enabled = enabled; + this.state.next(state); + }); + this.cctService.cctStream.pipe(distinctUntilChanged()).subscribe((value) => { + const state = structuredClone(this.state.value); + state.cctState!.value = value; + this.state.next(state); + }); + this.cctService.activeTransition.pipe(distinctUntilChanged()).subscribe((transition) => { + const state = structuredClone(this.state.value); + state.cctState!.transitioning = !!transition; + if (transition) state.cctState!.transitionTarget = transition.targetCCT; + this.state.next(state); + }); + } + private updateState_WhenSleepPreparationStateChanges() { this.sleepPreparation.sleepPreparationAvailable.subscribe((available) => { const state = structuredClone(this.state.value); diff --git a/src-ui/app/views/dashboard-view/views/brightness-automations-view/tabs/new-brightness-automations-tab/brightness-automation-details/brightness-automation-details.component.ts b/src-ui/app/views/dashboard-view/views/brightness-automations-view/tabs/new-brightness-automations-tab/brightness-automation-details/brightness-automation-details.component.ts index a4dae2ce..827c7c8a 100644 --- a/src-ui/app/views/dashboard-view/views/brightness-automations-view/tabs/new-brightness-automations-tab/brightness-automation-details/brightness-automation-details.component.ts +++ b/src-ui/app/views/dashboard-view/views/brightness-automations-view/tabs/new-brightness-automations-tab/brightness-automation-details/brightness-automation-details.component.ts @@ -100,30 +100,33 @@ export class BrightnessAutomationDetailsComponent implements OnInit { } protected async updateBrightness(type: BrightnessType, value: number | 'CURRENT') { + const copyCurrent = value === 'CURRENT'; const pConfig: Partial = {}; switch (type) { case 'SIMPLE': { - if (value === 'CURRENT') value = this.simpleBrightnessControl.brightness; - pConfig.brightness = Math.round(value); + if (copyCurrent) value = this.simpleBrightnessControl.brightness; + pConfig.brightness = Math.round(value as number); break; } case 'SOFTWARE': { - if (value === 'CURRENT') value = this.softwareBrightnessControl.brightness; - pConfig.softwareBrightness = Math.round(value); + if (copyCurrent) value = this.softwareBrightnessControl.brightness; + pConfig.softwareBrightness = Math.round(value as number); break; } case 'HARDWARE': { - if (value === 'CURRENT') value = this.hardwareBrightnessControl.brightness; - pConfig.hardwareBrightness = Math.round(value); + if (copyCurrent) value = this.hardwareBrightnessControl.brightness; + pConfig.hardwareBrightness = Math.round(value as number); break; } } await this.updateConfig(pConfig); - this.vshakeElements.push('BRIGHTNESS_' + type); - setTimeout(() => { - const index = this.vshakeElements.indexOf('BRIGHTNESS_' + type); - if (index >= 0) this.vshakeElements.splice(index, 1); - }, 300); + if (copyCurrent) { + this.vshakeElements.push('BRIGHTNESS_' + type); + setTimeout(() => { + const index = this.vshakeElements.indexOf('BRIGHTNESS_' + type); + if (index >= 0) this.vshakeElements.splice(index, 1); + }, 300); + } } protected async toggleChangeBrightness() {