From 3c017815036faa34f7f34e65c28316565ef00084 Mon Sep 17 00:00:00 2001 From: tux Date: Sat, 5 Jul 2025 18:30:05 +0530 Subject: [PATCH] fix: platform specific init --- models/MainViewModel.cs | 16 ++++++++++++---- utils/AudioCapture.cs | 7 +++++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/models/MainViewModel.cs b/models/MainViewModel.cs index 54f67e1..f71ea6d 100644 --- a/models/MainViewModel.cs +++ b/models/MainViewModel.cs @@ -1,13 +1,21 @@ -using CommunityToolkit.Mvvm.ComponentModel; +using System; +using CommunityToolkit.Mvvm.ComponentModel; namespace highminded.models; public partial class MainViewModel : ObservableObject { [ObservableProperty] private string _appName = "High Minded"; - [ObservableProperty] private string _hideShortcutKey = "ALT + SHIFT + \\"; - [ObservableProperty] private string _screenshotShortcutKey = "ALT + SHIFT + S"; - [ObservableProperty] private string _audioShortcutKey = "ALT + SHIFT + A"; + + [ObservableProperty] + private string _hideShortcutKey = OperatingSystem.IsMacOS() ? "OPTION + SHIFT + \\" : "ALT + SHIFT + \\"; + + [ObservableProperty] private string _screenshotShortcutKey = + OperatingSystem.IsMacOS() ? "OPTION + SHIFT + S" : "ALT + SHIFT + S"; + + [ObservableProperty] + private string _audioShortcutKey = OperatingSystem.IsMacOS() ? "OPTION + SHIFT + A" : "ALT + SHIFT + A"; + [ObservableProperty] private bool _isRecording = false; [ObservableProperty] private bool _isHidden = true; } \ No newline at end of file diff --git a/utils/AudioCapture.cs b/utils/AudioCapture.cs index 7a3f524..86a9a1d 100644 --- a/utils/AudioCapture.cs +++ b/utils/AudioCapture.cs @@ -1,4 +1,5 @@ -using System.IO; +using System; +using System.IO; using SoundFlow.Backends.MiniAudio; using SoundFlow.Components; using SoundFlow.Enums; @@ -7,7 +8,9 @@ namespace highminded.utils; public class AudioCapture { - private readonly MiniAudioEngine _audioEngine = new(48000, Capability.Loopback); + private readonly MiniAudioEngine _audioEngine = + new(48000, OperatingSystem.IsWindows() ? Capability.Loopback : Capability.Mixed); + private Stream? _fileStream; private Recorder? _recorder;