Skip to content

Commit 1d70709

Browse files
committed
Enable app to auto-launch with SteamVR
Added option to exit with SteamVR as well, as otherwise it can have issues relaunching Add d to debug build versions
1 parent 8cefc1c commit 1d70709

File tree

9 files changed

+39
-4
lines changed

9 files changed

+39
-4
lines changed

OpenVR2Key/App.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
<setting name="Haptic" serializeAs="String">
2323
<value>False</value>
2424
</setting>
25+
<setting name="ExitWithSteam" serializeAs="String">
26+
<value>True</value>
27+
</setting>
2528
</OpenVR2Key.Properties.Settings>
2629
</userSettings>
2730
</configuration>

OpenVR2Key/MainModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ static public Dictionary<string, Key[]> RetrieveConfig(string configName = null)
163163
#region Settings
164164
public enum Setting
165165
{
166-
Minimize, Tray, Notification, Haptic
166+
Minimize, Tray, Notification, Haptic, ExitWithSteam
167167
}
168168

169169
private static readonly Properties.Settings p = Properties.Settings.Default;

OpenVR2Key/MainWindow.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<CheckBox x:Name="CheckBox_Minimize" Margin="5" Focusable="False" Content="Minimize on launch" HorizontalAlignment="Left" VerticalAlignment="Top" Checked="CheckBox_Minimize_Checked" Unchecked="CheckBox_Minimize_Checked"/>
1515
<CheckBox x:Name="CheckBox_Tray" Margin="5" Focusable="False" Content="to system tray" HorizontalAlignment="Left" VerticalAlignment="Top" Checked="CheckBox_Tray_Checked" Unchecked="CheckBox_Tray_Checked"/>
1616
</StackPanel>
17+
<CheckBox x:Name="CheckBox_ExitWithSteamVR" Content="Exit with SteamVR" Margin="5 0 5 5" Checked="CheckBox_ExitWithSteamVR_Checked" Unchecked="CheckBox_ExitWithSteamVR_Checked"/>
1718
<CheckBox x:Name="CheckBox_DebugNotifications" Content="Show debug notifications in headset" Margin="5 0 5 5" Focusable="False" Checked="CheckBox_DebugNotifications_Checked" Unchecked="CheckBox_DebugNotifications_Checked"/>
1819
<CheckBox x:Name="CheckBox_HapticFeedback" Content="Do haptic pulse on triggering key" Margin="5 0 5 5" Focusable="False" Checked="CheckBox_HapticFeedback_Checked" Unchecked="CheckBox_HapticFeedback_Checked"/>
1920
<StackPanel Orientation="Horizontal" Margin="5 0 5 5">

OpenVR2Key/MainWindow.xaml.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public partial class MainWindow : Window
2222
private string _currentlyRunningAppId = MainModel.CONFIG_DEFAULT;
2323
private System.Windows.Forms.NotifyIcon _notifyIcon;
2424
private HashSet<string> _activeKeys = new HashSet<string>();
25+
private bool _initDone = false;
2526
public MainWindow()
2627
{
2728
InitWindow();
@@ -55,6 +56,10 @@ public MainWindow()
5556
{
5657
Label_OpenVR.Content = message;
5758
Label_OpenVR.Background = color;
59+
if (!connected && _initDone && MainModel.LoadSetting(MainModel.Setting.ExitWithSteam)) {
60+
if (_notifyIcon != null) _notifyIcon.Dispose();
61+
System.Windows.Application.Current.Shutdown();
62+
}
5863
});
5964
},
6065

@@ -129,6 +134,7 @@ public MainWindow()
129134
_controller.Init(actionKeys);
130135
InitSettings();
131136
InitTrayIcon();
137+
_initDone = true;
132138
}
133139

134140
private void WriteToLog(String message)
@@ -376,9 +382,14 @@ private void InitSettings()
376382
{
377383
CheckBox_Minimize.IsChecked = MainModel.LoadSetting(MainModel.Setting.Minimize);
378384
CheckBox_Tray.IsChecked = MainModel.LoadSetting(MainModel.Setting.Tray);
385+
CheckBox_ExitWithSteamVR.IsChecked = MainModel.LoadSetting(MainModel.Setting.ExitWithSteam);
379386
CheckBox_DebugNotifications.IsChecked = MainModel.LoadSetting(MainModel.Setting.Notification);
380387
CheckBox_HapticFeedback.IsChecked = MainModel.LoadSetting(MainModel.Setting.Haptic);
388+
#if DEBUG
389+
Label_Version.Content = $"{MainModel.GetVersion()}d";
390+
#else
381391
Label_Version.Content = MainModel.GetVersion();
392+
#endif
382393
}
383394
private bool CheckboxValue(RoutedEventArgs e)
384395
{
@@ -421,5 +432,10 @@ private void NotifyIcon_Click(object sender, EventArgs e)
421432
Activate();
422433
}
423434
#endregion
435+
436+
private void CheckBox_ExitWithSteamVR_Checked(object sender, RoutedEventArgs e)
437+
{
438+
MainModel.UpdateSetting(MainModel.Setting.ExitWithSteam, CheckboxValue(e));
439+
}
424440
}
425441
}

OpenVR2Key/Properties/Resources.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

OpenVR2Key/Properties/Resources.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,6 @@
128128
<value>..\resources\logo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
129129
</data>
130130
<data name="Version" xml:space="preserve">
131-
<value>v0.45</value>
131+
<value>v0.49</value>
132132
</data>
133133
</root>

OpenVR2Key/Properties/Settings.Designer.cs

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

OpenVR2Key/Properties/Settings.settings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,8 @@
1414
<Setting Name="Haptic" Type="System.Boolean" Scope="User">
1515
<Value Profile="(Default)">False</Value>
1616
</Setting>
17+
<Setting Name="ExitWithSteam" Type="System.Boolean" Scope="User">
18+
<Value Profile="(Default)">True</Value>
19+
</Setting>
1720
</Settings>
1821
</SettingsFile>

OpenVR2Key/app.vrmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"app_key": "boll7708.openvr2key",
44
"launch_type": "binary",
55
"binary_path_windows": "OpenVR2Key.exe",
6-
"is_dashboard_overlay": false,
6+
"is_dashboard_overlay": true,
77
"action_manifest_path": "./actions.json",
88

99
"strings": {

0 commit comments

Comments
 (0)