Skip to content

Commit 37d9910

Browse files
committed
Merge branch 'develop' into steam-beta
2 parents a2d9e9a + 268c24b commit 37d9910

File tree

9 files changed

+55
-32
lines changed

9 files changed

+55
-32
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111

1212
- GPU acceleration for SteamVR overlays (Community contribution by [BenjaminZehowlt](https://github.com/BenjaminZehowlt))
13+
- VR Headset device & battery level to the device list
14+
- Sleep mode toggle and sleep preparation to system tray menu
1315

1416
### Changed
1517

1618
- Added continuous scanning for lighthouses to replace manual scanning.
19+
- Migrated to Tauri v2, and upgraded various dependencies.
20+
- Localized system tray menu
1721

1822
### Fixed
1923

src-ui/app/components/device-list/device-edit-modal/device-edit-modal.component.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ export class DeviceEditModalComponent
9898
return this.lighthouseDevice?.deviceName;
9999
}
100100
case 'OPENVR': {
101-
if (this.ovrDevice?.handleType) {
101+
if (
102+
['Controller', 'GenericTracker'].includes(this.ovrDevice?.class ?? '') &&
103+
this.ovrDevice?.handleType
104+
) {
102105
return this.translate.instant(
103106
'comp.device-list.deviceRole.' + this.ovrDevice!.handleType
104107
);

src-ui/app/components/device-list/device-list-item/device-list-item.component.html

+2-6
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@
66
</div>
77
<div class="header-bar-info" (click)="editDevice()">
88
<div class="device-name" translate>{{ deviceName }}</div>
9-
<div class="device-serial" *ngIf="!deviceNickname && deviceRole"
10-
>{{ 'comp.device-list.deviceRole.' + deviceRole | translate }}
9+
<div class="device-subtitle" [class.nickname]="deviceHasNickname">
10+
{{ deviceSubtitle ?? '' | translate }}
1111
</div>
12-
<div class="device-serial" *ngIf="!deviceNickname && !deviceRole"
13-
>{{ deviceIdentifier }}
14-
</div>
15-
<div class="device-nickname" *ngIf="deviceNickname">{{ deviceNickname }}</div>
1612
</div>
1713
<div class="header-bar-spacer"></div>
1814
<div class="header-bar-action" *ngIf="!isDeviceIgnored">

src-ui/app/components/device-list/device-list-item/device-list-item.component.scss

+10-11
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,17 @@
3232
// .device-name {
3333
// }
3434

35-
.device-serial {
35+
.device-subtitle {
3636
color: var(--color-text-4);
37-
}
38-
39-
.device-nickname {
40-
width: 100%;
41-
overflow: hidden;
42-
color: var(--color-text-4);
43-
font-weight: 700;
44-
white-space: nowrap;
45-
min-height: 0;
46-
text-overflow: ellipsis;
37+
&.nickname {
38+
width: 100%;
39+
overflow: hidden;
40+
color: var(--color-text-4);
41+
font-weight: 700;
42+
white-space: nowrap;
43+
min-height: 0;
44+
text-overflow: ellipsis;
45+
}
4746
}
4847

4948
&:hover {

src-ui/app/components/device-list/device-list-item/device-list-item.component.ts

+12-9
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ export class DeviceListItemComponent implements OnInit {
4848
this._lighthouseDevice = undefined;
4949
this._ovrDevice = device;
5050
this.deviceName = device.modelNumber;
51-
this.deviceIdentifier = device.serialNumber;
52-
this.deviceRole = device.handleType;
53-
this.deviceNickname = this.openvr.getDeviceNickname(device);
5451
this.showBattery = Boolean(device.providesBatteryStatus || device.isCharging);
5552
this.isCharging = this.showBattery && device.isCharging;
5653
this.batteryPercentage = this.showBattery ? device.battery * 100 : 0;
@@ -65,6 +62,13 @@ export class DeviceListItemComponent implements OnInit {
6562
this.cssId = this.sanitizeIdentifierForCSS(device.serialNumber);
6663
this.powerButtonAnchorId = '--anchor-device-pwr-btn-' + this.cssId;
6764
this.showLHStatePopover = false;
65+
66+
const nickname = this.openvr.getDeviceNickname(device);
67+
this.deviceHasNickname = Boolean(nickname);
68+
if (nickname) this.deviceSubtitle = nickname;
69+
else if (device.handleType && ['Controller', 'GenericTracker'].includes(device.class))
70+
this.deviceSubtitle = 'comp.device-list.deviceRole.' + device.handleType;
71+
else this.deviceSubtitle = device.serialNumber;
6872
}
6973

7074
@Input() set lighthouseDevice(device: LighthouseDevice | undefined) {
@@ -73,9 +77,9 @@ export class DeviceListItemComponent implements OnInit {
7377
this._lighthouseDevice = device;
7478
this._ovrDevice = undefined;
7579
this.deviceName = 'comp.device-list.deviceName.' + device.deviceType;
76-
this.deviceIdentifier = device.deviceName;
77-
this.deviceRole = undefined;
78-
this.deviceNickname = this.lighthouse.getDeviceNickname(device);
80+
const nickname = this.lighthouse.getDeviceNickname(device);
81+
this.deviceSubtitle = nickname ?? device.deviceName;
82+
this.deviceHasNickname = Boolean(nickname);
7983
this.showBattery = false;
8084
this.isCharging = false;
8185
this.batteryPercentage = 100;
@@ -127,9 +131,8 @@ export class DeviceListItemComponent implements OnInit {
127131

128132
mode?: 'lighthouse' | 'openvr';
129133
deviceName = '';
130-
deviceIdentifier = '';
131-
deviceRole: string | undefined = undefined;
132-
deviceNickname: string | null = null;
134+
deviceSubtitle: string | null = null;
135+
deviceHasNickname = false;
133136
showBattery = false;
134137
isCharging = false;
135138
batteryPercentage = 100;

src-ui/app/components/device-list/device-list.component.ts

+7-4
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ export class DeviceListComponent implements OnInit {
9292

9393
processOpenVRDevices(devices: OVRDevice[]) {
9494
// Filter out non-controller and non-tracker devices
95-
devices = devices.filter(
96-
(device) => device.class === 'Controller' || device.class === 'GenericTracker'
95+
devices = devices.filter((device) =>
96+
['HMD', 'Controller', 'GenericTracker'].includes(device.class)
9797
);
9898
// Add missing device categories
9999
uniq(devices.map((device) => device.class))
@@ -151,10 +151,11 @@ export class DeviceListComponent implements OnInit {
151151
return 'controller';
152152
case 'GenericTracker':
153153
return 'tracker';
154+
case 'HMD':
155+
return 'hmd';
154156
case 'TrackingReference':
155157
case 'DisplayRedirect':
156158
case 'Invalid':
157-
case 'HMD':
158159
default:
159160
return undefined;
160161
}
@@ -223,7 +224,7 @@ export class DeviceListComponent implements OnInit {
223224
}
224225

225226
sortDeviceCategories() {
226-
const sortKeys = ['OpenVR-Controller', 'OpenVR-GenericTracker', 'Lighthouse'];
227+
const sortKeys = ['OpenVR-HMD', 'OpenVR-Controller', 'OpenVR-GenericTracker', 'Lighthouse'];
227228
const getKey = (category: DisplayCategory) => {
228229
switch (category.type) {
229230
case 'OpenVR':
@@ -238,6 +239,8 @@ export class DeviceListComponent implements OnInit {
238239

239240
getCategoryLabelForOpenVRDeviceClass(deviceClass: OVRDeviceClass): string {
240241
switch (deviceClass) {
242+
case 'HMD':
243+
return 'comp.device-list.category.HMD';
241244
case 'Controller':
242245
return 'comp.device-list.category.Controller';
243246
case 'GenericTracker':

src-ui/app/services/system-tray.service.ts

+13
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { SleepService } from './sleep.service';
1717
import { TranslateService } from '@ngx-translate/core';
1818
import { error } from '@tauri-apps/plugin-log';
1919
import { invoke } from '@tauri-apps/api/core';
20+
import { SleepPreparationService } from './sleep-preparation.service';
2021

2122
const CLOSE_TO_SYSTEM_TRAY_COMMAND = 'set_close_to_system_tray';
2223

@@ -29,6 +30,7 @@ export class SystemTrayService {
2930
constructor(
3031
private readonly appSettingsService: AppSettingsService,
3132
private readonly sleepService: SleepService,
33+
private readonly sleepPreparationService: SleepPreparationService,
3234
private readonly translateService: TranslateService
3335
) {}
3436

@@ -41,6 +43,8 @@ export class SystemTrayService {
4143
this._tray.next(tray);
4244
combineLatest([
4345
this.sleepService.mode,
46+
this.sleepPreparationService.sleepPreparationAvailable,
47+
this.sleepPreparationService.sleepPreparationTimedOut,
4448
this.translateService.onLangChange.pipe(startWith(this.translateService.currentLang)),
4549
])
4650
.pipe(debounceTime(50))
@@ -85,6 +89,15 @@ export class SystemTrayService {
8589
}
8690
},
8791
},
92+
{
93+
text: this.translateService.instant('systemTray.prepareForSleep'),
94+
enabled:
95+
(await firstValueFrom(this.sleepPreparationService.sleepPreparationAvailable)) &&
96+
!(await firstValueFrom(this.sleepPreparationService.sleepPreparationTimedOut)),
97+
action: async () => {
98+
await this.sleepPreparationService.prepareForSleep();
99+
},
100+
},
88101
{
89102
item: 'Separator',
90103
},

src-ui/assets/i18n/en.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"systemTray": {
33
"sleepMode": "Sleep Mode",
4-
"quit": "Quit OyasumiVR"
4+
"quit": "Quit OyasumiVR",
5+
"prepareForSleep": "Prepare for sleep"
56
},
67
"about": {
78
"author": {
@@ -355,6 +356,7 @@
355356
},
356357
"device-list": {
357358
"category": {
359+
"HMD": "Headset",
358360
"Controller": "Controllers",
359361
"GenericTracker": "Trackers",
360362
"Lighthouse": "Base Stations",

src-ui/assets/img/icon_hmd.png

2.25 KB
Loading

0 commit comments

Comments
 (0)