Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Documentation/Settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Back to [Home](https://github.com/dankrusi/WindowsVirtualDesktopHelper)

|Config|Default|Description|
| --- | --- | --- |
| debug.singleInstance | ``true`` | If true, the app will prevent multiple instances of the app from starting. Most users won't need to change this option. |
| general.startupWithWindows | ``false`` | If true, the app will register itself with Windows to startup when Windows starts (via the registry). |
| general.theme | ``"auto"`` | Can be either auto, dark or light. If set to auto, the theme is derived from the current windows theme (dark or light). |
| theme.icons.disabledOpacity | ``"0.5"`` | Defines the opacity to use for icons which are disabled. |
Expand Down
5 changes: 4 additions & 1 deletion Source/App/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ class Settings {
public static void LoadDefaults() {
// Register any known default settings here

// Debug
RegisterDefault("debug.singleInstance", true, "true - only allow a single instance of the application to run (default); false - allow multiple instances (expect errors registering hotkeys)");

// General
RegisterDefault("general.startupWithWindows", false, "If true, the app will register itself with Windows to startup when Windows starts (via the registry).");
RegisterDefault("general.theme", "auto", "Can be either auto, dark or light. If set to auto, the theme is derived from the current windows theme (dark or light).");

// Theme
RegisterDefault("theme.icons.disabledOpacity", 0.5, "Defines the opacity to use for icons which are disabled.");
RegisterDefault("theme.icons.font", "Segoe UI", "Defines the font name to use for the icons (for regular numbers, characters).");
Expand Down
16 changes: 12 additions & 4 deletions Source/Main.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Threading;
using System.Windows.Forms;

namespace WindowsVirtualDesktopHelper {
Expand All @@ -14,10 +15,17 @@ public static void Main(string[] args) {
// Load config
Settings.LoadConfig();
// Start app
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
var app = new App();
Application.Run(app.AppForm);
using (Mutex mutex = new Mutex(false, "Mutex/WindowsVirtualDesktopHelper")) {
if (Settings.GetBool("debug.singleInstance") && !mutex.WaitOne(0)) {
MessageBox.Show("WindowsVirtualDesktopHelper is already running.", "Error", MessageBoxButtons.OK);
return;
}

Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
var app = new App();
Application.Run(app.AppForm);
}
} catch (Exception e) {
// Global error handler
Console.Error.WriteLine(e);
Expand Down